Local dev database via Docker Compose (npm run db:up / db:down)#416
Open
QuentinFrc wants to merge 1 commit into
Open
Local dev database via Docker Compose (npm run db:up / db:down)#416QuentinFrc wants to merge 1 commit into
QuentinFrc wants to merge 1 commit into
Conversation
Replaces the manual docker run command from the README with a small
compose file plus committed development defaults:
- docker-compose.development.yml: named volume so data survives
restarts, healthcheck + --wait so db:up returns once Postgres is
ready. Container credentials are injected from .env.development
(env_file); the host port comes from DB_PORT (${DB_PORT:?} fails
with a hint when the file is not passed).
- .env.development (committed, no secrets): Postgres credentials, host
port and a matching DATABASE_URL, so .env.local only needs the
secrets. Overridable via .env.local, which takes precedence and
stays untracked.
- db/envConfig.ts: pass the dev flag to loadEnvConfig so drizzle-kit
also picks up .env.development outside production.
- db:studio script to browse the database with Drizzle Studio.
QuentinFrc
added a commit
to QuentinFrc/pages-cms-website
that referenced
this pull request
Jul 13, 2026
Matches hunvreus/pagescms#416: the local database now starts via Docker Compose (npm run db:up), DATABASE_URL defaults to the local Docker database through the committed .env.development, and Drizzle Studio is available via npm run db:studio.
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.
What
Replaces the manual
docker runcommand from the README's quick start with a small Docker Compose setup and committed development defaults:npm run db:up/npm run db:down— starts/stops the local Postgres. The compose file uses a named volume (data survives restarts, unlike a re-created container), and a healthcheck with--waitsodb:uponly returns once Postgres actually accepts connections..env.development(committed, no secrets) — the local database credentials, host port, and a matchingDATABASE_URL. The compose file injects it into the container viaenv_file, and Next.js picks it up automatically in development, so.env.localonly needs the actual secrets (BETTER_AUTH_SECRET,CRYPTO_KEY). Anything can still be overridden in.env.local, which takes precedence and stays untracked.db/envConfig.ts— passes the dev flag toloadEnvConfigso drizzle-kit (db:migrate,db:generate) also reads.env.developmentoutside production. Production behavior is unchanged (NODE_ENV=productionkeeps loading in production mode).npm run db:studio— browse the database with Drizzle Studio; works out of the box thanks to the above.Why
The current quick start asks contributors to copy a long
docker runcommand and duplicate the connection string into.env.local. With this change the database steps becomenpm run db:up, and.env.localshrinks to the two secrets. Data also persists across restarts, anddb:upreturning "ready" removes the race where migrations run before Postgres is up.Docs
Companion docs update for the Install locally, Database and Environment variables pages: hunvreus/pagescms-website#20