next-site architecture
Payload runs inside the Next.js server. src/app/(payload)/ holds the admin
and the REST and GraphQL API at /api; src/app/(app)/ is the public site,
which reads content through Payload’s Local API (in process, no HTTP).
- One database, owned by Payload. The Postgres adapter creates and changes
tables from the collection config. In development it pushes changes
straight to the database; in production the server applies pending
migrations from
src/migrations/when it starts. - Auth is Payload’s. The
userscollection signs in admins (and, with the shop, customers). The first user to register is made an admin. - Pages render per request. The Docker image is built without a database, so nothing is prerendered, and an owner’s edit shows on the next page view. Header, footer and redirects are read once per request.
- Uploads are stored in
MEDIA_DIRand served through/api/media/file/*. - Email goes through SMTP; with no
SMTP_HOSTit is written to the server log instead of sent.