Skip to main content
Every environment variable Artifacts reads, grouped by area. During local development these come from the monorepo .env file; in production, provide the same variables through your platform’s secret store.
Copy .env.example to .env to start from working local defaults — see the quickstart.

Core URLs

VariableUsed byPurpose
PUBLIC_APP_URLAPI, webBrowser-visible app origin
NEXT_PUBLIC_APP_URLWebOptional public app URL exposed to browser code
NEXT_PUBLIC_DOCS_URLWebBrowser-visible docs URL; defaults to https://docs.hostartifacts.dev
MINTLIFY_DOCS_URLWebMintlify origin that Next.js proxies from /docs
INTERNAL_API_URLWebHono API origin used by Next.js rewrites
BETTER_AUTH_URLAuthCanonical auth base URL
BETTER_AUTH_TRUSTED_ORIGINSAuthExtra comma-separated auth origins
Local defaults:
PUBLIC_APP_URL="http://localhost:3000"
NEXT_PUBLIC_APP_URL="http://localhost:3000"
NEXT_PUBLIC_DOCS_URL="https://docs.hostartifacts.dev"
MINTLIFY_DOCS_URL="http://127.0.0.1:3002"
BETTER_AUTH_URL="http://localhost:3000"
INTERNAL_API_URL="http://127.0.0.1:3001"

Database

VariablePurpose
DATABASE_URLPostgres connection string for Drizzle and Better Auth
Run migrations with:
bun run db:migrate
Generate migrations after schema changes:
bun run db:generate

Authentication

VariablePurpose
BETTER_AUTH_SECRETBetter Auth signing secret
GOOGLE_CLIENT_IDGoogle OAuth client ID
GOOGLE_CLIENT_SECRETGoogle OAuth client secret
For MCP OAuth, BETTER_AUTH_URL and PUBLIC_APP_URL should match the origin MCP clients can open in a browser.

Storage

Artifacts uses S3-compatible storage.
VariablePurpose
S3_ENDPOINTS3-compatible endpoint, such as R2
S3_BUCKETBucket name
S3_REGIONStorage region
S3_ACCESS_KEY_IDAccess key
S3_SECRET_ACCESS_KEYSecret key
Source objects use keys shaped like:
users/{ownerUserId}/artifacts/{artifactId}/versions/{versionNumber}/source-{attemptId}

Billing

Billing uses Dodo Payments.
VariablePurpose
DODO_PAYMENTS_API_KEYDodo API key
DODO_PAYMENTS_WEBHOOK_SECRETWebhook signature secret
DODO_BUILDER_PRODUCT_IDProduct ID for the Pro plan
DODO_STUDIO_PRODUCT_IDProduct ID for the Team plan
ENABLE_BILLING_CRONSet to true on one API instance to record daily storage usage
BILLING_CRON_INTERVAL_MSOptional scheduler interval override for dev/test
BILLING_CRON_SECRETBearer secret for internal storage snapshot route
Billing meters:
MeterUnit
artifact.storage_gb_daysGB-days
artifact.delivery_gbGB
artifact.version_writewrites

CLI

VariablePurpose
AGENT_ARTIFACTS_BASE_URLAPI base URL
AGENT_ARTIFACTS_WEB_URLWeb URL for browser login
AGENT_ARTIFACTS_TOKENBearer token
AGENT_ARTIFACTS_FORMATjson or text
AGENT_ARTIFACTS_NO_INPUTSet to 1 for non-interactive mode
AGENT_ARTIFACTS_DEBUGSet to 1 for stack traces
Credentials from browser login are stored at:
~/.config/agent-artifacts/credentials.json

Observability

VariableUsed byPurpose
BETTER_STACK_SOURCE_TOKENAPIServer-side API logs
BETTER_STACK_INGESTING_URLAPIAPI log ingest host
BETTER_STACK_WEB_SOURCE_TOKENWeb serverNext.js server-side logs
NEXT_PUBLIC_BETTER_STACK_SOURCE_TOKENWeb browserBrowser logs through proxy
NEXT_PUBLIC_BETTER_STACK_INGESTING_URLWeb browserBrowser ingest host and CSP connect source
LOG_IP_SALTAPISalt for hashed client IPs
TRUST_PROXYAPIEnable trusted proxy client IP extraction

Production Notes

  • Set TRUST_PROXY=true only behind a trusted reverse proxy.
  • Configure exactly one API instance or external scheduler to record billing storage snapshots.
  • Keep auth, Dodo, S3, and API key secrets out of source control.
  • Ensure PUBLIC_APP_URL, BETTER_AUTH_URL, and OAuth redirect URLs all agree.