next-site environment
Generation creates .env from .env.example and fills PAYLOAD_SECRET and
PREVIEW_SECRET with random values (yarn env:init does the same later).
| Variable | What to set |
|---|---|
DATABASE_URL | Postgres, from compose.yml. Production: Where to get it: Your PostgreSQL provider. Payload's own database. In development Payload pushes schema changes straight to it; in production pending migrations run when the server starts. See PostgreSQL. |
PAYLOAD_SECRET | Signs Payload's session tokens. Any long random string; changing it signs everyone out. Generate one with: openssl rand -hex 32 Production: A long random string, different per environment. Where to get it: |
NEXT_PUBLIC_SERVER_URL | The site's public origin, used for absolute links (emails, SEO, previews). Production: The site's public origin, e.g. |
PREVIEW_SECRET | Lets the admin's live preview open drafts. Any random string. Production: A random string. Where to get it: |
SMTP_HOST | Outgoing email. The compose stack's Mailpit catches everything sent to localhost:1025 (UI on http://localhost:8025). Leave SMTP_HOST empty and emails are written to the server log instead of sent. Production: Your mail provider's SMTP host. See Email (SMTP), including a local catcher. |
SMTP_PORT | Outgoing email. The compose stack's Mailpit catches everything sent to localhost:1025 (UI on http://localhost:8025). Leave SMTP_HOST empty and emails are written to the server log instead of sent. Production: 1025 for the compose stack's Mailpit. Port 465 turns on TLS. |
SMTP_USER | Outgoing email. The compose stack's Mailpit catches everything sent to localhost:1025 (UI on http://localhost:8025). Leave SMTP_HOST empty and emails are written to the server log instead of sent. Production: The SMTP username. Where to get it: Your mail provider. Optional: leave empty for a server without authentication, such as Mailpit. |
SMTP_PASS | Outgoing email. The compose stack's Mailpit catches everything sent to localhost:1025 (UI on http://localhost:8025). Leave SMTP_HOST empty and emails are written to the server log instead of sent. Production: The SMTP password. Where to get it: Your mail provider. Only sent whenSMTP_USER is set. |
MAIL_FROM_ADDRESS | Outgoing email. The compose stack's Mailpit catches everything sent to localhost:1025 (UI on http://localhost:8025). Leave SMTP_HOST empty and emails are written to the server log instead of sent. Production: An address on a domain your mail provider is allowed to send for. The sender of every email the site sends (orders, form submissions, password resets). A domain without SPF/DKIM for your provider lands in spam. |
MAIL_FROM_NAME | Outgoing email. The compose stack's Mailpit catches everything sent to localhost:1025 (UI on http://localhost:8025). Leave SMTP_HOST empty and emails are written to the server log instead of sent. Production: The business's name. Shown as the sender name in inboxes. |
COMPANY_NAME | Shown in the footer and SEO metadata. Production: The legal or trading name. Shown in the footer copyright line; falls back toSITE_NAME. |
SITE_NAME | Shown in the footer and SEO metadata. Production: The business's display name. The default page title, link-preview site name, and the header text until the owner uploads a logo. |
MEDIA_DIR | Where uploaded media is stored. Defaults to ./media; the Docker image uses /app/media, which should be a volume. Production: Leave unset in the Docker image ( ./media. In Docker, mount a volume at /app/media or uploads vanish with the container. |
OPENOBSERVE_URL | OpenTelemetry → OpenObserve (server): traces, logs and metrics. Leave empty and telemetry stays off. OPENOBSERVE_TOKEN is the org's ingestion token (IAM → Ingestion Tokens, o2oi_…). Any other OTLP backend: set OTEL_EXPORTER_OTLP_ENDPOINT/HEADERS instead. Production: Your OpenObserve instance. Telemetry is on only when the URL, org and token are all set. See OpenObserve. |
OPENOBSERVE_ORG | OpenTelemetry → OpenObserve (server): traces, logs and metrics. Leave empty and telemetry stays off. OPENOBSERVE_TOKEN is the org's ingestion token (IAM → Ingestion Tokens, o2oi_…). Any other OTLP backend: set OTEL_EXPORTER_OTLP_ENDPOINT/HEADERS instead. Production: The project's organization identifier. Where to get it: OpenObserve → organization settings (or the org segment of its URLs). |
OPENOBSERVE_TOKEN | OpenTelemetry → OpenObserve (server): traces, logs and metrics. Leave empty and telemetry stays off. OPENOBSERVE_TOKEN is the org's ingestion token (IAM → Ingestion Tokens, o2oi_…). Any other OTLP backend: set OTEL_EXPORTER_OTLP_ENDPOINT/HEADERS instead. Production: The organization's ingestion token ( Where to get it: OpenObserve → IAM → Ingestion Tokens. Write-only, but secret: never use it in a browser app (front ends use a RUM token). |
OTEL_SERVICE_NAME | OpenTelemetry → OpenObserve (server): traces, logs and metrics. Leave empty and telemetry stays off. OPENOBSERVE_TOKEN is the org's ingestion token (IAM → Ingestion Tokens, o2oi_…). Any other OTLP backend: set OTEL_EXPORTER_OTLP_ENDPOINT/HEADERS instead. Production: A distinct name per site, e.g. <name>-web. |
NEXT_PUBLIC_OPENOBSERVE_URL | Browser monitoring (RUM). The client token is a RUM token (Ingestion → RUM): write-only and meant to ship in the bundle — never the ingestion token above. The instance must list this site's origin in ZO_CORS_ALLOWED_ORIGINS. Production: Your OpenObserve instance. Browser monitoring is on only when the URL, org and client token are all set. Inlined at build time. See OpenObserve. |
NEXT_PUBLIC_OPENOBSERVE_ORG | Browser monitoring (RUM). The client token is a RUM token (Ingestion → RUM): write-only and meant to ship in the bundle — never the ingestion token above. The instance must list this site's origin in ZO_CORS_ALLOWED_ORIGINS. Production: The project's organization identifier. Where to get it: OpenObserve → organization settings. |
NEXT_PUBLIC_OPENOBSERVE_CLIENT_TOKEN | Browser monitoring (RUM). The client token is a RUM token (Ingestion → RUM): write-only and meant to ship in the bundle — never the ingestion token above. The instance must list this site's origin in ZO_CORS_ALLOWED_ORIGINS. Production: A RUM client token. Where to get it: OpenObserve → Ingestion → RUM. Write-only and meant to ship in the bundle. Never the server's ingestion token. The instance must list the site's origin inZO_CORS_ALLOWED_ORIGINS. |