Configuration
Accounts, environment values and optional providers.
Two independent kinds of commerce
Founding 50 buys a source license. The reference app’s Stripe checkout sells recurring workspace subscriptions to your application’s users. These use separate products and fulfillment. A Founding 50 payment must never set a Signal workspace to Pro or grant credits.
Required configuration
| Setting | Local development | Hosted production |
|---|---|---|
DATABASE_URL | Your empty local PostgreSQL database | Your Neon pooled PostgreSQL URL; TLS certificate verification |
BETTER_AUTH_SECRET | Generate at least 32 random characters | Separate stable secret per environment |
BETTER_AUTH_URL | Exact http://localhost:3000 origin | Exact HTTPS app origin, no path or query |
NEXT_PUBLIC_APP_NAME | Your product name | Your product name; rebuild after changing |
FOUNDRYLAYER_SITE_MODE | application for your product | application sends / to /app; rebuild after changing |
EMAIL_DELIVERY_MODE | capture | resend |
EMAIL_FROM | Valid sender label/address | Your verified Resend sender |
EMAIL_ENCRYPTION_KEY | Generate 32 bytes as 64 hex characters | Stable key for the encrypted outbox |
RESEND_API_KEY | Unused in capture mode | Your server-only key |
OPENROUTER_API_KEY | Needed for real AI | Your funded server-only key |
AI_DEFAULT_MODEL | openai/gpt-6-luna | One of the server allowlisted models |
CRON_SECRET | Optional while testing manually | Generate 32–256 bytes for recovery calls |
Root commands load .env before Turbo. Existing shell variables win over .env, so check which environment you are actually using. Direct apps/web commands need process variables or apps/web/.env.local instead.
FOUNDRYLAYER_CONTACT_EMAIL belongs to the optional FoundryLayer storefront. It only configures the email interest link and never enables payment. The official storefront uses drewsepeczi@gmail.com; purchasers using application mode should replace the public storefront/docs with their own content before launch.
AI models and budgets
The server registry currently allows openai/gpt-6-luna, openai/gpt-4o-mini, and openai/gpt-4.1-mini. Availability and provider pricing can change. User input does not select arbitrary models. Start with General and a direct prompt; Signal’s specialist graph needs larger application credit reservations.
Provider funds and application credits are independent. Free has zero included monthly credits. Use credits:grant for a verified development account, or your own Stripe subscription allowance. Do not remove reservation or ledger checks to make a demo run.
Platform administration
For organization credit adjustments and operational inspection, grant a verified account persisted admin access using the existing operator command. Obtain its UUID in your database:
SELECT id, email_verified FROM "user" WHERE email = 'you@example.com';
pnpm admin:operator grant YOUR_VERIFIED_USER_UUID "Initial operator assignment"
Sign in as that account and open /admin. Use a reason and an idempotency key for adjustments. Workspace ownership does not imply platform-admin authority. Revoke access with pnpm admin:operator revoke UUID "Operator access ended" when appropriate.
Optional workspace subscriptions
Create your own Stripe test-mode recurring flat-rate, quantity-one monthly and annual prices. Configure STRIPE_SECRET_KEY, STRIPE_WEBHOOK_SECRET, STRIPE_PRO_MONTHLY_PRICE_ID, and STRIPE_PRO_YEARLY_PRICE_ID with distinct price IDs. Configure the portal for supported interval changes, cancellation, and payment-method updates. Live credentials leave purchases closed by default. Set STRIPE_LIVE_CHECKOUT_ENABLED=true only after approving the exact deployed service terms/privacy, tax classification and registration scope, receipt settings and live webhook. Live Checkout requires terms consent, a billing address and automatic tax; the account must have its approved public Terms URL configured. Test-mode checkout remains available without live activation. Use a fresh billing database or reconcile every existing provider mapping before switching Stripe accounts or modes; do not delete production records to accomplish a switch.
The endpoint is /api/billing/webhook, with API version 2026-09-30.endive. Subscribe to subscription created/updated/deleted/paused/resumed; invoice paid/payment_failed/payment_action_required/finalization_failed/voided/marked_uncollectible; checkout.session completed/async_payment_succeeded/async_payment_failed.
Use Stripe CLI forwarding locally. Only verified workspace owners can start checkout. Access comes from signed webhook reconciliation of current paid subscription state, not a checkout return. Test before replacing test credentials with live credentials. Seats, coupons, and metered Stripe billing are outside the current product contract.
Until the required Stripe values validate, Usage & billing still shows credits and usage but does not offer subscription checkout/portal controls. This is application configuration availability, not a replacement for server authorization or webhook reconciliation.
Optional connected tools
Create managed OAuth auth configurations in your Composio project for Gmail, Google Calendar, and GitHub. Set COMPOSIO_API_KEY and each enabled service’s COMPOSIO_*_AUTH_CONFIG_ID. Use the normal Connect flow in Integrations and the application callback /api/integrations/callback. Test callback origin, account/workspace ownership, and disconnect/reconnect on your deployed domain.
Connections and provider account IDs are deployment-specific. They cannot be shipped in an archive. Composio owns OAuth credential storage; no purchaser receives the founder’s connected accounts. Deferred identity-verifier project configuration is unsupported. OAuth availability/consent limits remain your provider responsibility.
Set TAVILY_API_KEY for public-web search/extraction. Treat retrieved content as untrusted. Missing optional providers should leave those capabilities unavailable; do not hide missing coverage in AI answers.
Email and recovery
Auth requests commit encrypted messages to an outbox. Request follow-up delivery helps, but a scheduled drain is required during idle periods. Keep the encryption key stable until pending messages expire; key rotation requires a reviewed drain/requeue process. Capture mode fails closed in production.
Schedule the existing bounded AI, integration, and email recovery endpoints with the bearer secret. The GitHub workflow needs RECOVERY_ORIGIN and RECOVERY_CRON_SECRET in your repository. Successful configuration is not evidence of execution: inspect /admin/operations and an actual schedule-triggered job. Never automatically replay uncertain external mutations.
FoundryLayer