Skip to content

Add /api/health endpoint for uptime monitoring #3

@KonstantinMB

Description

@KonstantinMB

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

  • curl http://localhost:8000/api/health returns 200 with the expected JSON when DB is up
  • Returns 503 when DB is unreachable
  • Endpoint is not rate-limited (monitoring tools poll frequently)
  • No new imports beyond what's already in main.py
  • Endpoint shows up in the auto-generated /docs page

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions