ConsensusHealth is a Vite frontend + Node/Express backend service with Postgres and X OAuth.
Install dependencies:
npm installRun frontend + backend:
npm run dev- Frontend (Vite):
http://localhost:5173 - API server:
http://localhost:8787
Build frontend and compiled server output:
npm run buildThis generates:
- Frontend:
dist/ - Server JS:
server/dist/
Start as one Node service:
npm run startThe server will:
- serve API routes (
/api/*,/auth/*,/dev/*) - serve static frontend files from
dist/ - return
dist/index.htmlfor non-API SPA routes
Use server/env.example as the template for local and deploy env config.
Required/important variables:
DATABASE_URL- Postgres connection string (with password)PORT- server listen port (Render sets this automatically)APP_URL- canonical public base URL used for OAuth redirect URI generation- local:
http://localhost:8787 - Render/prod:
https://consensus.health
- local:
APP_ORIGIN- allowed CORS origin (dev default:http://localhost:5173)FRONTEND_BASE_URL- OAuth post-login redirect base- dev:
http://localhost:5173 - same-origin production: set to your site origin (or leave unset to use
APP_ORIGIN)
- dev:
SESSION_SECRET- signed cookie secretX_CLIENT_ID,X_CLIENT_SECRET,X_REDIRECT_URI- X OAuth settings
Typical Render settings:
- Build command:
npm install && npm run build - Start command:
npm run start - Add env vars from
server/env.example(except local-only defaults) - Ensure
APP_URLis set (for example:https://consensus.health)
After deploy, opening the service URL should load the frontend app, and API routes remain available under the same origin.