Framework recomendations for jobs running with NodeJS

Hey everyone! I want to write a Node backend. It's not going to be a REST API but more like a couple of services that run as jobs on certain intervals and update database tables. I initially thought about using Express since it's the goto for Node but I'm now considering fastify. Do you think it would be a good option for my case ? I've never written code similar to this (I normally do FullStack with NextJS) so I'm not sure even if I need a framework on top of node given that I'm not making a REST API but rather running some jobs on intervals. To make things more clear, here's the functionality I'm looking to implement: A couple of jobs running on set intervals. Perhaps they interact with eachother so they run one after the other. Authentication Logging Could be more but that's what I got for now. Definitely no REST APIs used by clients
9 Replies
cje
cje11mo ago
Those are quite simple requirements. Fastify would do it fine. You might want to deploy to a long running server unless you want a separate cron service.
Mr Volcano
Mr Volcano11mo ago
Im thinking about EC2 + each service should run on its own docker. How should they communicate ? What would fastify bring ? Would not using a framework be smart ?
Keef
Keef11mo ago
either request-reply (http, grpc) or async (message queues) for inter service communcations. Http is simplest ofc fastify is just a backend framework. It'll just make it easier to do common things like extracting params, query state etc You can raw dog nodejs if you want it doesn't really matter too much if you use a framework or not. I would probably just use fastify just so I can have a api I can hit an endpoint for health checks to query service statuses
0x6d6178
0x6d617811mo ago
If you are going to be doing a bunch of event driven job stuff I like https://www.inngest.com/
Inngest - Effortless serverless queues, background jobs, and workflows
Easily develop serverless workflows in your current codebase, without any new infrastructure. Using Inngest, your entire team can ship reliable products.
0x6d6178
0x6d617811mo ago
Otherwise Express.js will be fine for what you are trying todo. Though if you want to get a bit more exotic and experimental there is https://elysiajs.com/. If you wanna stick to node then I also like https://adonisjs.com/ which can make some things a good bit easier than express.js. But there is a lot more docs for express.js so that might be the easiset thing todo.
Elysia - Fast, and friendly Bun web frameworks
Elysia.js is a fast and friendly bun web framework with end-to-end type safety and great developer experience. Elysia is familiar, fast, and first class TypeScript support with well-thought integration between service whether it's tRPC, Swagger or WebSocket. Elysia got you cover, start building next generation TypeScript web server today.
cje
cje11mo ago
the main reason not to use express is its borderline unmaintained, most of the key maintainers have moved onto fastify or koa
Sybatron
Sybatron11mo ago
So to choose fastify or nest nowadays?
Mr Volcano
Mr Volcano11mo ago
I see, there's plenty of different recommendations but I'd rather stick with Node due to the support while at the same time avoiding express since as you've said it's borderline unmaintaned.
I will probably go with fastify for the health checks as keef said Thank you to everyone for the time and help
cje
cje11mo ago
Depends on if you want to pretend that you’re using Spring Boot or not