Agent SaaS Starter

Configuration

Environment variables and safe production defaults.

Copy .env.example to .env. The main settings are:

VariablePurpose
APP_URLBrowser application origin
DOCS_URLDocumentation origin
API_INTERNAL_URLPrivate API origin used by the BFF and MCP; share this configuration with the API host guard
API_PUBLIC_URLPublic API origin and upstream OIDC callback base
AUTH_ISSUERExact OAuth/OIDC issuer
MCP_PUBLIC_URLMCP service origin
MCP_RESOURCEExact protected MCP URL, including /mcp
DATABASE_URLPostgreSQL connection string
AUTH_PRIVATE_KEY_PATH / AUTH_PUBLIC_KEY_PATHRS256 keypair
OIDC_PROVIDERS_JSONUpstream social OIDC providers keyed by route slug
CIMD_ALLOWED_ORIGINSComma-separated HTTPS origins allowed for metadata fetches; defaults cover ChatGPT and Claude
DCR_ENABLEDEnables public dynamic client registration
NEXT_PUBLIC_GITHUB_URLOptional repository URL used by documentation source links

Each upstream entry in OIDC_PROVIDERS_JSON must request openid and email; the issuer must return a verified email before the starter links or creates an account.

Production checklist

  • Set APP_ENV=production; HTTP issuer/resource URLs are rejected.
  • Generate and protect a production signing key outside the repository.
  • Serve the app, API, and MCP behind HTTPS with stable public origins.
  • Set one stable, base64-encoded NEXT_SERVER_ACTIONS_ENCRYPTION_KEY across all app instances.
  • Rate-limit password and dynamic-registration endpoints at your trusted edge; deployment infrastructure is intentionally out of scope for this starter.
  • Limit CIMD_ALLOWED_ORIGINS to clients you intend to support.
  • Use a dedicated PostgreSQL role and encrypted backups.
  • Set NEXT_PUBLIC_GITHUB_URL if you want source links in the documentation.

Keep values containing spaces quoted in .env. Bind private services to loopback or a trusted private network. The production host guard accepts only the configured public and internal API hosts; this check does not replace authentication.

On this page