How Do You Check Health in Your Node.js/TypeScript Apps?

0
6
Asked By CuriousCat123 On

Hey everyone! This is my first time posting here. I've been diving into the JavaScript/TypeScript world lately, coming from a Java/Kotlin background with Spring Boot. One thing I've really missed is the actuators that come with Spring.

So, I've been on the hunt for a lightweight package that's easy to configure and works across different frameworks and libraries, but I haven't found one that fits my needs yet. That's why I decided to create my own!

You can check it out here: https://www.npmjs.com/package/@actuatorjs/actuatorjs.

Currently, I've implemented the HealthCheck functionality. It's designed to be framework-agnostic and works with any Node.js compatible runtime (I personally use Bun, but you can use whatever you like). I've also provided a simple example using Express with PostgreSQL, and I plan to add more examples soon.

It has no dependencies, is completely written in TypeScript, and it's compiled to be usable with common JS, which is great for those with older codebases. I'm also looking to add small packages tailored to specific needs, such as a PostgreSQL health check using its client, and making it easy to add routes for various frameworks like Express, Hapi, Fastify, and Bun.

I'd love to hear how you all manage health checks for your Node.js apps in containerized environments like Kubernetes, especially around readiness and liveness probes, since I haven't found solid resources on that yet and might incorporate it into my actuators.

For those interested, here's what I'm using to develop it:
- Bun
- Husky for git hooks
- Commitlint
- Lint-staged
- Bun's test runner
- Biome for formatting and linting

The project is open source and copyleft, so feel free to star, fork, and contribute if you're interested: https://github.com/actuatorjs/actuatorjs

1 Answer

Answered By TechieGuru99 On

I use @nestjs/terminus for health checks in my NestJS apps. It's a solid solution specifically tailored for that framework. Very convenient!

SkepticalDev -

I’ve looked into it too, but it seemed a bit too bloated for what it offers, at least if you’re looking for simplicity.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.