DEV Community

Vsevolod Rodionov
Vsevolod Rodionov

Posted on

I decided to create my own Node.js router/http-server, performance and devops-aimed. What should I consider?

I decided to create yet another "express-killer" (work already in progress) pet project.
Of course, not NIH syndrome: I'm going to make it Express middleware-compatible.
Target is to make it fast as hell in its core and modern tooling integration-aimed without losing friendliness and already known experience.
What should I consider?

What I already keep in mind:

  • blazing-fast generic router package, which can be mounted over both Koa and Express. Better than common trie solutions - I've inspected popular ones and I know parts of code that can be done in a more efficient way by adding the "compile" step. I'm also going to try WASM router implementation, but unsure whether interop will degrade the performance. Routes will be path-to-regexp-compatible (like Express), with the ability to define regex paths with the lowest priority order.
  • separation of endpoints and middlewares, while keeping in mind that endpoints can end the request (like "if not authorized, redirect to home"), and integration with documentation extractors like Swagger (or any other generic solution).
  • simple integration possibility with modern APMs like New Relic, Prometheus, and other popular ones. Not full integration at the first step, but the ability to extract nice metrics (like per-path) in the core.
  • built-in forever or other Cluster and auto-reload package; also, support of sticky-session
  • СSP declarative configuration and tracing ID out-of-the-box (middleware call-style, but working differently inside)
  • profiling-friendly - middlewares will be not in a stack, instead, they will have a flat call structure and this will allow a profiler to show separate calls instead of call stacks.
  • some kind of Dependency Injection solution - still thinking on it, not a lot of ideas, however.
  • Node 14-tuned - if something is improving performance on 14, but breaks or degrades 10 or 12, this is good. Not expecting to release before 14 go to LTS.

Just to clear things out - I'm team-/tech-lead/architect working on frontends and backends-for-frontends in large scale projects (~10k pages per second served on a current one) with 8+ years of experience, this is not a newbie post - I'm really struggling to hear pains in modern solutions.

Top comments (2)

manylov profile image
Maxim Manylov

Have you started it yet? Would like to follow at least, or contribute.

jabher profile image
Vsevolod Rodionov

Already started, mostly done with router proof-of-concept for now; will publish it as soon as it will work as a baseline