The backend currently has no health-check endpoint. External monitoring (uptime checks, Render's own health probe, future load balancers) has to ping / or hit the FastAPI /docs page — both do more work than they should.
What to do
- Add
GET /api/health in backend/main.py (near the top, not inside any auth-protected group)
- Returns
200 with JSON: { \"status\": \"ok\", \"version\": \"1.0.0\", \"database\": \"connected\" }
- DB check should be a single
SELECT 1 — quick, no heavy queries
- If the DB is unreachable, return
503 with database: \"disconnected\"
Acceptance criteria
Pointers
- Existing endpoint patterns: search
main.py for @app.get near the top
- Database access:
db is the global instance imported at the top of the file
- Version: pull from
FastAPI(... version=\"1.0.0\") — line ~42 — or hardcode for now
Scope
Touches 1 file. Estimated time: 20-40 minutes.
Want to take this on? Comment below and I'll assign it to you.
The backend currently has no health-check endpoint. External monitoring (uptime checks, Render's own health probe, future load balancers) has to ping
/or hit the FastAPI/docspage — both do more work than they should.What to do
GET /api/healthinbackend/main.py(near the top, not inside any auth-protected group)200with JSON:{ \"status\": \"ok\", \"version\": \"1.0.0\", \"database\": \"connected\" }SELECT 1— quick, no heavy queries503withdatabase: \"disconnected\"Acceptance criteria
curl http://localhost:8000/api/healthreturns 200 with the expected JSON when DB is upmain.py/docspagePointers
main.pyfor@app.getnear the topdbis the global instance imported at the top of the fileFastAPI(... version=\"1.0.0\")— line ~42 — or hardcode for nowScope
Touches 1 file. Estimated time: 20-40 minutes.
Want to take this on? Comment below and I'll assign it to you.