Deployment

Build output, production env vars, and webhook URLs.

Build output (TanStack Start + Nitro)

The starter builds to a Nitro output folder:

bun run build

This generates .output/ and prints a preview command:

bun run .output/server/index.mjs

Deploy anywhere that can run a Bun/Node server process and expose an HTTP port.

Production environment variables

At minimum (plus whatever optional modules you enable):

NODE_ENV=production

APP_URL=https://yourdomain.com
VITE_APP_URL=https://yourdomain.com
BETTER_AUTH_URL=https://yourdomain.com

DATABASE_URL=postgresql://...
BETTER_AUTH_SECRET=...

RESEND_API_KEY=...
RESEND_FROM_ADDRESS="Your App <noreply@yourdomain.com>"

If you enable:

  • Stripe: set STRIPE_SECRET_KEY, STRIPE_WEBHOOK_SECRET, and VITE_STRIPE_PRICE_*
  • Polar: set POLAR_ACCESS_TOKEN, POLAR_WEBHOOK_SECRET, POLAR_MODE
  • Supabase Storage: set VITE_SUPABASE_URL, VITE_SUPABASE_ANON_KEY
  • OpenAI: set OPENAI_API_KEY

Webhooks

Use your production domain for webhook URLs:

  • Stripe: https://yourdomain.com/api/webhooks/stripe
  • Polar: https://yourdomain.com/api/webhooks/polar

Local webhook testing

Use a tunneling tool (eg. ngrok) so Stripe/Polar can reach your dev machine, then point webhooks at the tunnel URL:

  • https://<your-tunnel>.ngrok-free.app/api/webhooks/stripe
  • https://<your-tunnel>.ngrok-free.app/api/webhooks/polar

The dev server in this repo already allows *.ngrok-free.app as an allowedHost in tanstarter/vite.config.ts.