Group
  • Deployment

    Add real health and readiness checks

    Give your host and monitors an honest signal for 'am I actually up and able to serve traffic'.

    • Improve quality
    • Plan & validate
    • Beginner
    • General

Free Prompt

Add health and readiness endpoints to my app. A lot of deploy platforms and monitors need these, and the naive '/health returns 200 OK always' version is worse than useless because it lies during outages. Implement two separate endpoints: 1. /health (liveness): a cheap check that confirms the process is running and responsive. This is what the platform uses to decide whether to restart the container. Don't touch the database here. If this endpoint hangs, the process gets killed, which is the point. 2. /ready (readiness): a real dependency check. Ping the database with a lightweight query, confirm the cache is reachable, and check any critical downstream services the app can't function without. Return 200 only if everything the app needs to serve requests is actually available. Return 503 with a JSON body listing which dependency failed if not. Also: 3. Set sensible timeouts (a second or two) so a slow database doesn't turn the readiness check into another slow endpoint. Cache the result briefly (a few seconds) so a monitoring stampede doesn't hammer the database. 4. Don't expose secrets or internal detail in the response body. 'database: unreachable' is fine; connection strings are not. 5. Point the platform's health check at /health and its readiness/traffic gate at /ready so instances are only sent traffic once they're actually ready. Don't make a single endpoint that does both jobs; they answer different questions and need different failure behavior. The deliverable is both endpoints, the platform config pointing at them, and a test that /ready returns 503 when the database is intentionally unreachable.

What This Does / How This Helps

This gives you two honest signals: /health for 'the process is alive' and /ready for 'I can actually serve users right now'. The platform uses the first to restart broken instances and the second to stop routing traffic to instances whose database or cache just went down. The common failure is a single /health endpoint that returns 200 no matter what. It makes the dashboard green while users get 500s, and outages take hours longer to notice because your own monitoring is lying to you. Splitting the two and doing a real dependency check on /ready costs nothing and stops that class of blind spot cold.

Want to skip doing this by hand?

Fortivibe audits your app for all of the areas these prompts cover (and more).

See What We Check

Related Prompts