---
title: "Configuration & secrets"
description: "Environment variables and Worker secrets used by EdgeCart."
---

> Documentation Index
> Fetch the complete documentation index at: https://edgecart.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Configuration & secrets

EdgeCart reads local configuration from `apps/edgecart/.dev.vars` and production
configuration from Worker secrets and vars. Never commit real secrets.

## Core

| Variable | Required | Purpose |
|---|---|---|
| `BETTER_AUTH_SECRET` | Yes | Signs Better Auth sessions. Generate with `openssl rand -base64 32`. |
| `BETTER_AUTH_URL` | Yes | The origin Better Auth uses for links and callbacks. Locally `http://localhost:3000`. |
| `TRUSTED_ORIGINS` | Yes | Comma-separated browser origins allowed to call the API with credentials and complete auth flows. |
| `STOREFRONT_URL` | No | Origin used for order links in email; falls back to the store domain. |

## Payments

| Variable | Required | Purpose |
|---|---|---|
| `STRIPE_SECRET_KEY` | For Stripe checkout | Server-side Stripe key. |
| `STRIPE_PUBLISHABLE_KEY` | For Stripe checkout | Browser Stripe key; must belong to the same Stripe account. |
| `STRIPE_WEBHOOK_SECRET` | For Stripe webhooks | Verifies Stripe webhook signatures. |
| `PAYMENT_WEBHOOK_SECRET` | For the manual provider | Verifies `POST /api/payments/webhooks/:provider` for the manual provider. |

## Email

| Variable | Required | Purpose |
|---|---|---|
| `SMTP_HOST` | No | SMTP host. Empty in local development skips auth email instead of failing sign-up. |
| `SMTP_PORT` | No | SMTP port; example uses `465`. |
| `SMTP_USER` / `SMTP_PASS` | No | SMTP credentials. |
| `SMTP_SECURE` | No | Whether SMTP uses TLS. |
| `EMAIL_FROM` | For order email | Sender address used by the outbox worker. |

The outbox worker reads its own copy of the SMTP secrets when deployed; the main
app's `SMTP_*` secrets are not shared automatically.

## Plugins

| Variable | Required | Purpose |
|---|---|---|
| `PLUGIN_ASSETS_ORIGIN` | For storefront plugin iframes | Origin used to resolve relative plugin asset URLs. |
| `PLUGIN_ENCRYPTION_KEY` | Recommended | Encrypts plugin secret settings at rest. Falls back to `TOKEN_SECRET` when unset. |
| `PLATFORM_ADMIN_EMAILS` | For the plugin registry | Comma-separated Better Auth emails allowed to manage publishers, reviews, yanks, and reinstates. Unset fails the registry API closed. |

## Social login variables

`GITHUB_CLIENT_ID`, `GITHUB_CLIENT_SECRET`, `GOOGLE_CLIENT_ID`, and
`GOOGLE_CLIENT_SECRET` appear in the example file, but social login is not wired
into the runtime. Email/password auth is the supported flow.

## Local setup

```sh
cp apps/edgecart/.dev.vars.example apps/edgecart/.dev.vars
```

Set `BETTER_AUTH_SECRET` and keep the local defaults for `BETTER_AUTH_URL` and
`TRUSTED_ORIGINS`. Leave `SMTP_HOST` empty to log auth email instead of sending
it.

## Production secrets

Set secrets with Wrangler from the app directory:

```sh
cd apps/edgecart
pnpm exec wrangler secret put BETTER_AUTH_SECRET
pnpm exec wrangler secret put STRIPE_SECRET_KEY
pnpm exec wrangler secret put STRIPE_PUBLISHABLE_KEY
pnpm exec wrangler secret put STRIPE_WEBHOOK_SECRET
```

Set the same values in the outbox Worker's environment where it needs them
(for example, `EMAIL_FROM` and SMTP credentials). `TRUSTED_ORIGINS` must include
your storefront and admin origins in production.

## Related

- [Local development](https://edgecart.dev/developers/local-development)
- [Deployment](https://edgecart.dev/developers/deployment)
- [Current limitations](https://edgecart.dev/reference/limitations)

Source: https://edgecart.dev/developers/configuration/index.mdx
