Project Structure
The codebase is organized by domains (feature modules). Each domain owns its data, UI, and logic. The CMS and admin are one part of the stack.
src/domains
Feature modules. Each domain typically has:
- payload/ — Collections, fields, and admin config for that feature (Payload is used as the CMS layer).
- components/ — React components used on the frontend or in the admin.
- lib/ — Server-side helpers, hooks, or types.
Examples: cms (pages, posts, media, tenants), monetization (products, checkout, paywall), leads (newsletter, welcome emails), seo (metadata, structured data), auth (customer sign-in, sessions).
src/app
Route segments: tenant frontend under (frontend)/[tenantDomain], admin under (payload), and /docs for documentation. The host in the request determines which tenant is shown.
src/components, src/actions, src/lib
Shared UI components, server actions, and utilities (auth, env, email, payload client). Used across domains.
content/
Documentation source (MDX and _meta.js for the docs sidebar). Nextra builds the /docs tree from here.
Config
- next.config.mjs — Next.js and docs (Nextra).
- payload.config.ts — Imports collections and plugins from domains; configures db and email adapters.
- .env — Environment variables; schema in src/env.ts.