totally. here’s the clean mental model + the exact steps so you don’t lose the thread.
You have two good modes:
Use this when you’re iterating on UI/logic.
-
Terminal 1 (backend):
cd apps/backend python -m venv .venv && source .venv/bin/activate # first time only pip install -r requirements.txt # make sure your app listens on localhost:8000 and CORS allows http://localhost:3003 uvicorn main:app --host 0.0.0.0 --port 8000 --reload
-
Terminal 2 (frontend):
cd apps/ui npm install # or pnpm install # .env.local (frontend): # NEXT_PUBLIC_BACKEND_URL=http://localhost:8000 npm run dev -- -p 3003 # open http://localhost:3003
Notes:
- No Docker here. Faster boot; easier debugging.
- You don’t need
BACKEND_INTERNAL_URLlocally unless some SSR code uses it; if it does, set it to the same URL:http://localhost:8000.
Use this to test the exact container setup you’ll deploy.
make fresh
# frontend → http://localhost:3003
# backend → http://localhost:5000 (host), health at /healthNotes:
- Compose wires the UI to the backend container name internally; you already have healthchecks and ports set.
- Slightly slower to rebuild but matches deployment closer.
👉 For day-to-day speed, go with Mode A. Flip to Mode B before pushing / debugging infra issues.
You’ll create two services on Render, both pointing at your GitHub repo (monorepo-aware):
- Backend: FastAPI → Render “Web Service” (Python)
- Frontend: Next.js → Render “Web Service” (Node) (Use Web Service, not Static Site, because you’ve got SSR/env vars.)
-
Ensure your backend binds to Render’s port:
# Start command (Render): uvicorn main:app --host 0.0.0.0 --port $PORT
-
Ensure your frontend production start uses
$PORTand0.0.0.0:// apps/ui/package.json { "scripts": { "build": "next build", "start": "next start -H 0.0.0.0 -p ${PORT:-3000}" } }
(Dev script doesn’t matter for Render.)
-
In Render dashboard → New → Web Service → pick your repo.
-
Root Directory:
apps/backend -
Runtime: Python
-
Build Command:
pip install -r requirements.txt -
Start Command:
uvicorn main:app --host 0.0.0.0 --port $PORT -
Environment: set these (you can tweak later):
FRONTEND_ORIGINS→ set to your frontend URL (temporarily leave blank; we’ll fill after frontend URL exists)CORS_ALLOW_METHODS→GET,POST,PUT,PATCH,DELETE,OPTIONS
-
(Optional) Health Check Path:
/health(so Render knows it’s healthy) -
Click Create Web Service. Note the URL:
https://your-backend.onrender.com.
-
New → Web Service
-
Root Directory:
apps/ui -
Runtime: Node
-
Build Command:
npm ci && npm run build -
Start Command:
npm run start -
Environment:
NODE_ENV=productionNEXT_PUBLIC_BACKEND_URL=https://your-backend.onrender.com- (If SSR/server code uses it)
BACKEND_INTERNAL_URL=https://your-backend.onrender.com
-
Create it. Note the URL:
https://your-frontend.onrender.com.
Update backend env:
FRONTEND_ORIGINS=https://your-frontend.onrender.com- Redeploy backend from Render dashboard.
- If you use WS from the browser, your
NEXT_PUBLIC_BACKEND_URLmust be paired withwss://for WS endpoints (or derive WS URL in code). - Render free supports WS; just be sure you’re using
wss://your-backend.onrender.com/wsin prod.
- Sleep after ~15 minutes of inactivity; requests “cold start” your services.
- Monthly free time is capped; watch quotas.
- Build time also counts toward free quota.
- Custom domains work (you add in Settings), but keep using the onrender.com URL in env until DNS is set.
-
Render’s “Root Directory” must point to
apps/backendandapps/uirespectively. -
If you use pnpm locally, Render’s Node builder defaults to
npm. Either keep usingnpmor add:// apps/ui/package.json "packageManager": "pnpm@9"
and set Build Command to
pnpm i --frozen-lockfile && pnpm build. (Sticking tonpmis simpler on free.) -
Make sure your Next build doesn’t rely on dev-only packages or
process.envvalues missing in Render. -
Don’t forget to set any NEXT_PUBLIC_ vars (only those will be exposed to the browser).
Local (plain):
# backend
cd apps/backend && uvicorn main:app --host 0.0.0.0 --port 8000 --reload
# frontend
cd apps/ui && npm install && echo NEXT_PUBLIC_BACKEND_URL=http://localhost:8000 > .env.local
npm run dev -- -p 3003Local (docker):
make freshRender:
-
Backend Web Service → root
apps/backend, startuvicorn ... --port $PORT -
Frontend Web Service → root
apps/ui, buildnpm ci && npm run build, startnpm run start -
Env:
- Frontend:
NEXT_PUBLIC_BACKEND_URL=https://<backend>.onrender.com - Backend:
FRONTEND_ORIGINS=https://<frontend>.onrender.com
- Frontend:
-
Redeploy backend after frontend URL is known.
If you want, paste your apps/ui/package.json scripts, and I’ll give you the exact strings for Render (build/start) tailored to your setup.