Introducing a revolutionary backend framework for Node.js: zero dependencies and full control. Designed for flexibility and built on HTTP/2, it empowers developers to harness native APIs without barriers. Scale your application seamlessly while effortlessly managing configurations and errors. Build and iterate quickly, focusing on delivering value.
nodes.js is a cutting-edge Node.js procedural backend framework that comes equipped with a robust Cluster API based on HTTP/2. Designed with simplicity in mind, this framework boasts zero dependencies, enabling developers to dive right into coding without the burden of additional libraries. Whether you're a seasoned developer or just starting out, nodes.js allows you to quickly build and customize your web applications with ease!
Key Features
- Zero Dependencies: Build your web application without relying on external libraries, enhancing performance and reducing complexity.
- Native Node.js APIs: Directly access Node.js APIs without additional layers of abstraction.
- Flexibility and Modifiability: Easily access the folder structure to modify your framework as needed for rapid adjustments.
- Zero Downtime Updates: Update your application's logic seamlessly by simply sending a signal, ensuring uninterrupted service.
- Built-in Clustering: Utilize Node.js' Cluster API to scale your application efficiently at low costs, without the need for third-party orchestration tools.
- HTTP/2 Support: Enjoy the benefits of the latest web protocol with HTTP/2 as the default.
- Error Handling: Handle 500-series user errors effectively to maintain application robustness.
- Easy Configuration: Out-of-the-box configurations for primary and worker processes, making setup straightforward.
- Simple Secrets Management: Effortlessly manage secrets with a built-in secrets reader.
- Logging: Write logs to an output file for better tracking and debugging.
- Composable API: Enjoy a clean and clear code structure by utilizing a composable API, avoiding middleware that can obscure logic.
- URL Parameter and Query Access: Gain control over request parameters and queries without the hassle.
- Custom Dependency Management: Access external dependencies such as database clients with ease, without the complexity of large frameworks.
- Static File Handling: Configure your static
.html
and other resource files without additional effort.
Getting Started
Once you've cloned the repository, set up your application by creating an app
directory next to the nodes
folder. A sample main.js
file can be implemented for initializing the Cluster API:
const cluster = require('./../nodes/cluster');
process.env.ENV = process.env.ENV || 'local';
const config = JSON.parse(
fs.readFileSync(`./example/env/${process.env.ENV}.json`)
);
cluster('example/primary.js', 'example/worker.js')({ config });
Example Usage
To illustrate how simple it is to utilize nodes.js for handling requests, consider the following endpoint definition:
const api = [
endpoint('/', 'GET', ({ stream }) => {
stream.respond({
status: 200,
'content-type': 'text/plain',
});
stream.end('This index page.');
}),
];
server(app({ api }))();
With nodes.js, developers can build, modify, and scale their applications swiftly and effectively, all while maintaining clarity in their codebase. Join our community and start creating your next innovative web application!