Fixes a real, previously-undiscovered build failure and a bigger
architectural gap found while testing an actual `docker build` of
proto/Dockerfile for the first time since the Payload migration:
1. Docker build failure: the (frontend)/[locale] pages use
generateStaticParams, so `next build` fully prerenders them (SSG) —
which calls the Payload Local API during the build. With no
MONGODB_URI/PAYLOAD_SECRET reachable in the build stage, `docker
build` failed outright ("missing secret key").
2. Bigger problem underneath: even if the build could reach a DB,
full SSG means a Payload admin edit would NOT appear on the public
site until a full rebuild + redeploy — directly undermining the
project's whole reason for migrating to Payload (self-service
content editing for the client).
Fix (user-confirmed direction: force-dynamic): dropped
generateStaticParams from (frontend)/[locale]/layout.tsx and
[locale]/[slug]/page.tsx, added `export const dynamic = 'force-dynamic'`
to layout.tsx + both page.tsx files. Every request now reads Payload
live — publishing in the admin is visible immediately, and the Docker
build no longer needs any DB connectivity at all (verified: a full
`docker build --target builder` now succeeds with zero env vars set).
Docker/Compose changes:
- docker-compose.staging.yml / docker-compose.prod.yml: wired
PAYLOAD_SECRET through to the app container (was documented in
.env.*.example since MITHOME-86 but never actually passed to the
container — Payload would have refused to start). No fallback,
same fail-loudly pattern as MONGODB_URI.
- Same two files: added a named `media_data_{staging,prod}` volume
mounted at /app/media — Payload's local upload storage (Media.ts)
writes there at the container's runtime cwd; without a volume,
`deploy.sh`'s `--force-recreate` would silently wipe every uploaded
logo/image on each deploy.
- docker-compose.dev.yml: was missing PAYLOAD_SECRET entirely (only
discovered because the same "missing secret key" error reproduces
there too) — added a dev-only literal value. Media persistence
already works there via the existing `./proto:/app` bind mount, no
volume needed. Also dropped the obsolete `version: '3.8'` key
(compose warns it's ignored).
- DOCKER.md: one-paragraph note on the new PAYLOAD_SECRET requirement
and where the admin account gets created.
Verified:
- `docker build --target builder` succeeds from a clean context with
zero environment variables (previously failed).
- `docker build --target runner` + `docker run` against the real dev
MongoDB (PAYLOAD_SECRET + MONGODB_URI supplied at runtime only):
/hu, /admin and /api/health all return 200 inside the container;
confirmed live in the browser that Payload content renders
correctly end-to-end through the production Next.js server, not
just `next dev`.
- `docker compose -f docker-compose.{staging,prod,dev}.yml config`
parses cleanly.
- Full gate green: tsc, lint, proto unit tests (51 passed),
scripts/pre-deploy-tests.sh (proto tests, tsc, lint, content schema,
plane-sync — all pass).
deploy.sh itself needs no changes: it already just runs
`docker compose up --build`, and that now works without any
build-time DB wiring.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
docker-compose.dev.yml's mongodb service sets MONGO_INITDB_ROOT_USERNAME/
PASSWORD, which makes the official mongo image enable --auth — but the
app service's MONGODB_URI was unauthenticated
(mongodb://mongodb:27017/mozdit). Same bug class as MITHOME-32
(staging/production), but that ticket covers docker-compose.staging.yml
/docker-compose.prod.yml specifically, not this dev file — hence the
separate MITHOME-98.
Why /api/health never caught it: that route is a pure liveness check
and never touches MongoDB. Only an endpoint that actually performs a
DB operation exercises the bug.
Verified live (docker compose -f docker-compose.dev.yml up --build):
- Reproduced the failure first: inside the running app container, a
plain `mongodb://mongodb:27017/mozdit` connection's findOne() throws
"Command find requires authentication" — confirms the hypothesis
that the app fails only on a real query, not at startup.
- With the fix in place: POST /api/contact returns 200 with a
submissionId, and the document is actually present in
contact_submissions (checked via mongosh) — a real, previously-
broken write path now works end to end.
- npm test: 58/58 passed (unaffected, as expected for a
docker-compose/doc-only change).
Also fixed the same stale unauthenticated example in DOCKER.md.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
- Updated README.md with project details, quick start instructions, and tech stack.
- Expanded TODO.md to reflect current project status and backlog items, including Linear ticket synchronization.
- Added mobile menu toggle functionality in Header component with corresponding tests for user interactions.
- Configured Next.js for Docker deployment and optimized build settings.