fix: make local dev environment work after a fresh clone#392
Open
andygrunwald wants to merge 6 commits into
Open
fix: make local dev environment work after a fresh clone#392andygrunwald wants to merge 6 commits into
andygrunwald wants to merge 6 commits into
Conversation
The `migrate:dev` script runs Prisma from packages/db, where no .env file exists (only .env.example). Prisma reads its DATABASE_URL and DIRECT_DATABASE_URL from process.env at the current working directory, so the command was failing to find connection details and could not run migrations without the developer also creating a duplicate .env inside packages/db. Wrap the command with dotenv-cli pointing at ../../apps/api/.env so a single env file (the API's own .env, already loaded by apps/api/src/app/constants.ts) serves both the API and DB migrations in local development. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The api-server's env validator throws on empty AWS_SES_ACCESS_KEY_ID or AWS_SES_SECRET_ACCESS_KEY, which prevents new contributors from booting the server out of the box after a plain `cp apps/api/.env.example apps/api/.env`. Seed harmless placeholder values (foo / bar) so the server starts without further configuration. Contributors who actually want to send mail still need to replace these with real keys; the placeholders only satisfy the boot-time presence check. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
New contributors hit two snags when following the existing instructions: 1. The clone example used a `<repo-url>` placeholder and an `app` directory name that doesn't match the actual repo, so the rest of the commands silently failed for anyone copy-pasting. 2. There was no instruction to copy `apps/api/.env.example` to `apps/api/.env`, which is now required for both the API and the DB migrations (see the migrate:dev wrapper). Replace the placeholder with the real repo URL, add the missing `apps/api/.env` copy step, and note that AWS_SES_ACCESS_KEY_ID and AWS_SES_SECRET_ACCESS_KEY must be non-empty for the server to start (the dummies in .env.example are intentional). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The instruction to `cp .env.example .env` referenced a root-level .env.example that does not exist in the repo (only `.env.self-host.example` sits at the root, and that one is for self-hosting, not local dev). After the previous commit's `cp apps/api/.env.example apps/api/.env` step, the remaining root copy was both invalid and confusing. Remove it and clarify the follow-up comment to point at apps/api/.env specifically, so contributors aren't left wondering which .env to edit. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Member
|
I would prefer to keep the split .env file for the prisma schema and API, do you agree? The other changes are good. |
This reverts commit c9b5060.
…ASE_URL / DIRECT_DATABASE_URL env vars
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Local dev setup was broken in three small but interlocking ways after a fresh clone.
Following the guide in CONTRIBUTING.md wasn't enough.
yarn workspace @plunk/db migrate:devcould not findDIRECT_DATABASE_URL. The script runs Prisma frompackages/db/, where no.envexists (only.env.example). Prisma reads connection details fromprocess.envrelative to its CWD, so migrations silently failed unless the contributor knew to also createpackages/db/.env. Fix: wrap the script withdotenv-cli -e ../../apps/api/.env, reusing the API's env file (already loaded byapps/api/src/app/constants.ts). One env file now serves both the API and DB migrations.yarn workspace api dev:serverrefused to boot from a cleancp apps/api/.env.example apps/api/.env. The env validator throws on emptyAWS_SES_ACCESS_KEY_ID/AWS_SES_SECRET_ACCESS_KEY. Fix: seed harmlessfoo/barplaceholders so the server starts. Contributors who want to actually send mail still replace these with real keys.CONTRIBUTING.mdskipped theapps/api/.envstep entirely and used a<repo-url>/cd appplaceholder. Fix: use the real repo URL/dir, add the missing copy step, and document the AWS SES dummies so they don't look like a bug.Type of Change
fix:Bug fix (PATCH version bump)docs:Documentation update (no version bump)Testing
Manual end-to-end on a clean checkout:
Following CONTRIBUTING.md.
Checklist
Related Issues
None