Introducing Velocy: A Zero-Dependency Node.js Framework Building Momentum
In the ever-evolving landscape of web development, performance and simplicity remain paramount. Over the past two years, I embarked on a journey to develop Velocy, a modern Node.js framework built entirely from scratch without any external dependencies. What began as a curiosity project has matured into a robust tool that balances speed, flexibility, and educational value. Today, I am excited to share insights into Velocyโs capabilities, development philosophy, and future prospects.
A Always Improving Benchmark
One of the most compelling aspects of Velocy is its impressive performance. Conducting basic plaintext benchmarks on Node.js v20.x LTS with 128 concurrent connections revealed the following:
- Requests per second: Velocy astonishingly handled over 91,000 req/s compared to Expressโs approximately 16,400 req/s.
- Average latency: Velocy maintained around 1.40ms latency, whereas Express averaged about 7.78ms.
- Data transfer speed: Velocy achieved roughly 16 MB/s versus Expressโs 3.76 MB/s.
While real-world applications will vary based on numerous factors, these benchmarks underscore Velocyโs lightweight design and efficiency, making it highly suitable for performance-critical scenarios.
Educational Roots and Practical Utility
Velocy is not just a framework; itโs also an educational platform. It powers a side project titled Learn Node.js the Hard Way, designed to teach core Node.js concepts through building real components. The frameworkโs transparent architecture allows learners to understand internal mechanics intimately while producing production-ready code. Each step involves exploring design decisions and implementation details, fostering a deeper comprehension of backend development.
Core Features Breakdown
Velocyโs design emphasizes flexibility and modularity. Hereโs a quick overview of its key features:
Routing System
- Supports three router implementations tailored to different needs:
FastRouter
: minimal overhead for high-speed applicationsSimpleRouter
: straightforward routing for small or uncomplicated apps-
Router
: feature-rich, suitable for complex scenarios -
Uses a trie-based matching algorithm, optimizing route lookup speed based on path length rather than route volume.
- Features dynamic parameters (
/users/:id
), wildcards (*.pdf
,**
), nested routers (app.nest()
), HTTP verb support, and an LRU cache for frequently accessed routes.
Middleware Architecture