Production build¶
This starter kit uses one Express process in production. That process serves the built React app and its /api routes from
the same origin. Build from the repository root, then point your HTTPS proxy or
platform at that process.
Build¶
This builds the client into apps/client/dist and compiles the server into
apps/server/dist. The client build also generates
the TanStack Router route types it needs.
Configure for production¶
Set these values in the root .env or in your hosting platform's environment settings:
NODE_ENV=production
PORT=3001
MONGODB_URI=mongodb+srv://...
APP_URL=https://app.example.com
BETTER_AUTH_URL=https://app.example.com
BETTER_AUTH_SECRET=replace-with-a-random-secret-at-least-32-characters-long
RESEND_API_KEY=re_example
Generate the secret once with the Node.js command in Development workflow. APP_URL and
BETTER_AUTH_URL must be the identical public HTTPS origin. RESEND_API_KEY
is required in production because email is sent through Resend. The host may
inject these values directly; a deployed .env file is not required. See
Development workflow for the full reference.
Run¶
pnpm start runs the compiled server. It listens on port 3001 unless PORT is set,
serves apps/client/dist, and falls back to the SPA for browser routes. Your public
URL must reach this server directly or through a reverse proxy.
Verify¶
After MongoDB connects, the health endpoint returns HTTP 200 and ok:
If it returns 503, check the MongoDB URL, network access, and database credentials.