Skip to Content
Getting StartedEnvironment Setup

Environment Setup

Copy .env.example to .env in the project root, then set the variables below. The app validates env at build and runtime via src/env.ts; invalid or missing required vars will cause errors.

For Docker or CI builds where not all vars are available at build time, set SKIP_ENV_VALIDATION=1 to skip validation.

Payload & database

VariableRequiredDescription
PAYLOAD_SECRETYesSecret used for signing; must be set and kept private
DATABASE_PUBLIC_URIYesMongoDB (or DB) connection string for general use
DATABASE_PRIVATE_URIYesPrivate / server-side connection string
DATABASE_NAMENoDatabase name (Payload can use default if omitted)
PREVIEW_SECRETNoOptional secret for draft preview

Auth (Better Auth)

VariableRequiredDescription
BETTER_AUTH_URLNoBase URL of your app (e.g. https://yoursite.com)
GOOGLE_CLIENT_IDNoGoogle OAuth client ID
GOOGLE_CLIENT_SECRETNoGoogle OAuth client secret

Stripe

VariableRequiredDescription
STRIPE_SECRET_KEYYesStripe secret key (when Stripe plugin is enabled)
STRIPE_WEBHOOKS_ENDPOINT_SECRETYesWebhook signing secret for your Stripe endpoint

S3 (optional)

When all of these are set, the S3 storage adapter is used for media uploads.

VariableRequiredDescription
S3_BUCKETNoS3 bucket name
S3_ACCESS_KEY_IDNoAccess key
S3_SECRET_ACCESS_KEYNoSecret key
S3_REGIONNoAWS region
S3_PREFIX_ROOTFOLDERNoOptional path prefix in the bucket

Email

VariableRequiredDescription
EMAIL_ADAPTERYesresend (Resend REST API) or smtp (Nodemailer). Use resend on Railway (no SMTP egress).
RESEND_API_KEYWhen resendRequired if EMAIL_ADAPTER=resend. Optional for smtp (used as SMTP password with Resend SMTP).
EMAIL_FROMNoDefault “from” address
EMAIL_FROM_NAMENoDefault “from” name
EMAIL_SMTP_HOSTNoSMTP host (default: smtp.resend.com) — only for smtp
EMAIL_SMTP_PORTNoSMTP port (default: 465) — only for smtp
EMAIL_SMTP_USERNoSMTP user (default: resend) — only for smtp
EMAIL_SMTP_PASSNoSMTP password — only for smtp

See Email for full setup (Resend API vs SMTP, Railway).

Client-side (optional)

These are exposed to the browser; only set what you need.

VariableRequiredDescription
NEXT_PUBLIC_SERVER_URLNoPublic URL of the server
NEXT_PUBLIC_BETTER_AUTH_URLNoAuth base URL for the client
NEXT_PUBLIC_GOOGLE_CLIENT_IDNoGoogle client ID for OAuth
NEXT_PUBLIC_GA_IDNoGoogle Analytics ID

Ingest & jobs

VariableRequiredDescription
IMPORT_MAX_FILE_SIZE_MBNoCap on import upload/URL fetch size. Default 100. Peak memory ≈ 2–3× file size — confirm box RAM before raising.
PAYLOAD_JOB_AUTORUN_CRONNoCron expression for the in-process job runner (long-lived Node, e.g. Railway).
CRON_SECRETNoBearer token expected by Authorization on the jobs run API. Required for serverless cron (Vercel).

AI generation (optional)

VariableRequiredDescription
REPLICATE_API_TOKENWhen using generateAIReplicate API token for the generation pipeline. See Features → AI Generation.

CLI (operator machine)

The shipmore CLI reads these from the operator’s environment, not the deployed box:

VariableRequiredDescription
SHIPMORE_API_URLYesBase URL of the deployed ShipMore box (e.g. https://your-box.com). Falls back to ~/.shipmore/config baked by the installer.
SHIPMORE_API_KEYYesA Payload user API key (Admin → Users → API Key). Read from env only — never written to disk.