docs: add CONTRIBUTING.md + local dev guide - #8
Conversation
Issue TroodInc#6 asked for a contributor doc covering Docker/env setup, migrations, embedding server setup, build commands, and a troubleshooting section. New CONTRIBUTING.md covers: - Prerequisites (Node 20+, Docker Compose, npm) - Clone + install (root + embedding-server separately) - Environment (template copy, the four required keys matching .env.example: EMBEDDING_API_URL, EMBEDDING_VERSION, EMAILOCTOPUS_API_KEY, EMAILOCTOPUS_LIST_ID) - docker compose up --build for the all-in-one path, or 'docker compose up -d postgres' + 'npm run dev' when you want the API to run outside Docker - Prisma migrations (prisma:generate, prisma:migrate, prisma:push for quick sync) - Starting embedding-server/ locally on port 3001 and pointing EMBEDDING_API_URL at it; notes the default mock vector behaviour - Build/start - Troubleshooting for ECONNREFUSED from inside Docker (host.docker.internal), database-not-exist on first run (-v reset + createdb), stale Prisma client after branch switch, and port conflicts on 3000/3001 Zoho OAuth guidance from the issue is intentionally left out - there's no Zoho integration in the current codebase yet. That troubleshooting entry can land alongside the Zoho feature when it merges. All commands documented were verified against package.json, docker-compose.yml, .env.example, and embedding-server/index.js. Fixes TroodInc#6
szverev
left a comment
There was a problem hiding this comment.
Good structure and a welcome addition. Two issues would break a contributor's setup before they write any code — flagging those as blockers. The rest are minor corrections.
Blocking
-
DATABASE_URLin.env.exampleusespostgresas the hostname, which only resolves inside the Docker Compose network. Steps 3 (hybrid mode:docker compose up -d postgres+npm run devon host) and 4 (running migrations on the host) both fail immediately withgetaddrinfo ENOTFOUND postgres. The guide never instructs contributors to change the hostname tolocalhostfor host-side commands. -
The pure
docker compose up --buildpath never applies migrations. The Dockerfile only runsprisma generate;CMDisnpm run dev. Tables are never created inside the container, so every API call fails withrelation does not exist. Either addprisma migrate deployto the container startup, or add a clear note that migration must be run separately before the API is usable.
Minor
- Prerequisites say "Dockerfile targets
node:20-alpine" — actual base image isFROM node:20(Debian Bookworm). - Step 2 prose says "fill the three API-key values" but the table has four rows.
EMBEDDING_API_URL=http://localhost:3001example is wrong for Docker mode (resolves to the container itself, not the host);host.docker.internal:3001is needed. The troubleshooting section mentions this but only as a post-hoc fix.- Troubleshooting describes
prisma:migrate"hanging" — the actual failure on a badDATABASE_URLis an immediate crash (ENOTFOUND), not a hang, which sends contributors down the wrong diagnostic path.
…corrections Host-side commands (npm run dev, prisma migrate/push) now use a localhost DATABASE_URL rather than the Docker-only 'postgres' hostname. Adds a note that Docker Compose does not auto-apply migrations. Corrects node:20 base image, the values count, EMBEDDING_API_URL host.docker.internal for Docker mode, and the ENOTFOUND (crash, not hang) troubleshooting entry.
|
Thanks — addressed both blockers and the four minors:
|
Summary
Add
CONTRIBUTING.mdwith a setup / migrations / embedding-server / troubleshooting guide that covers everything a first-time contributor needs betweengit cloneandnpm run dev. Every command documented was verified againstpackage.json,docker-compose.yml,embedding-server/, and.env.example.Why this matters
Issue #6 flagged the specific gap: a new contributor has to stitch together
package.json,docker-compose.yml, and the prisma scripts by hand to get a working dev loop. The README covers the happy path at a high level but doesn't mention the embedding server's separatenpm install, the Docker vs. host-API split, or any of the common first-run pitfalls (ECONNREFUSED from inside Docker, stale Prisma client after a branch switch, ports already in use).Changes
CONTRIBUTING.md(new, 144 lines):embedding-server/separately, matching their twopackage.jsonfiles.env.exampleand fill the four keys shown there (EMBEDDING_API_URL,EMBEDDING_VERSION,EMAILOCTOPUS_API_KEY,EMAILOCTOPUS_LIST_ID)docker compose up --build, ordocker compose up -d postgres+npm run devwhen hot-reload mattersprisma:generate,prisma:migrate,prisma:pushfor rapid devembedding-server/index.jsnpm run build/npm startfor the production pathhost.docker.internalfor cross-network calls,docker compose down -vto reset the Postgres volume when the DB doesn't exist,npm run prisma:generateafter pulling (generated client isn't checked in), and port-in-use on 3000/3001What was intentionally skipped
Issue #6 mentions a "Zoho OAuth" troubleshooting bullet. No Zoho integration exists in the repo yet (
grep -rn "zoho" --include="*.ts" --include="*.md"returns nothing). Rather than fabricate setup steps for a feature that isn't there, this PR leaves that bullet out - the note can land alongside the Zoho feature when it merges.Fixes #6
This contribution was developed with AI assistance (Claude Code).