ops: /api/v1/health does not check MongoDB or Redis

Open
#56 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
45/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Active
Tech stack
express, javascript, mongodb, node.js, redis

Research direction

Start at the /api/v1/health route and check the Render health check configuration, MongoDB connection setup, Redis client, and graceful shutdown handling. Readiness should ping MongoDB and Redis with short timeouts, report Redis as degraded when unavailable, and return 503 for MongoDB failure or shutdown; verify the existing liveness route remains cheap.

Written by the indexing model from the issue text.

Description

enhancement

GET /api/v1/health always answers { success: true, message: "StudyNotion server is running." }, even when MongoDB or Redis is unreachable. Render's health check and the uptime pings therefore report the service as healthy while requests fail.

Suggested fix

  • Keep a cheap liveness route, and add a readiness route that runs mongoose.connection.db.admin().ping() (and a Redis PING) with short timeouts, returning 503 when MongoDB is down and reporting Redis as degraded because the app can run without it.
  • Point Render's health check path at the readiness route, and flip it to 503 at the start of graceful shutdown so in-flight requests drain.

Found while reviewing StudyNotion with Claude Code.

Dominant language
JavaScript
Stars
23
Forks
8
Avg merge
11m
Merged PRs (30d)
4

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from khemssharma/StudyNotion

All issues in khemssharma/StudyNotion

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.