rexprs is a blazing-fast, Express-like web framework for Node.js developers, powered by Rust.
It offers the same familiar Express API but with the speed and safety of Rust – no need to install Rust on your machine!
- ✅ Same API as Express.js – Drop-in replacement with familiar syntax
- ⚡ Rust performance – Native speed without the complexity
- 🧠 Zero learning curve – If you know Express, you know rexprs
- 📦 Easy installation – Just
npm install, works with Node.js and Bun - 🔗 N-API powered – Seamless Rust-JavaScript integration
- 🛡️ Memory safe – Rust's safety guarantees in your web apps
- 🔧 TypeScript ready – Full TypeScript support out of the box
npm install rexprsOr with other package managers:
# Using yarn
yarn add rexprs
# Using pnpm
pnpm add rexprs
# Using bun
bun add rexprsCreate your first rexprs server:
const { Rexprs } = require('rexprs');
const app = new Rexprs();
app.get('/', (req, res) => {
res.json({ message: 'Hello from rexprs!' });
});
app.listen(3000, () => {
console.log('Server running on http://localhost:3000');
});Want more examples? Check out our comprehensive examples.md file for detailed usage patterns, REST APIs, middleware, and production setups.
rexprs provides an Express.js-compatible API:
| Method | Description | Example |
|---|---|---|
app.get(path, handler) |
Handle GET requests | app.get('/', handler) |
app.post(path, handler) |
Handle POST requests | app.post('/users', handler) |
app.put(path, handler) |
Handle PUT requests | app.put('/users/:id', handler) |
app.delete(path, handler) |
Handle DELETE requests | app.delete('/users/:id', handler) |
app.use(middleware) |
Add middleware | app.use(corsMiddleware) |
app.static(path, dir) |
Serve static files | app.static('/public', './public') |
app.listen(port, callback) |
Start server | app.listen(3000, callback) |
req.method- HTTP methodreq.url- Full URLreq.path- URL pathreq.params- Route parametersreq.query- Query parametersreq.headers- Request headersreq.body- Request body
res.json(obj)- Send JSON responseres.send(data)- Send responseres.status(code)- Set status coderes.setHeader(name, value)- Set headerres.redirect(url)- Redirect request
📖 For detailed examples and advanced usage, see examples.md
- Node.js 18+ or Bun
- Rust (for development only)
- pnpm (recommended)
# Clone the repository
git clone https://github.com/bitsbyritik/rexprs.git
cd rexprs
# Install dependencies
pnpm install
# Build the project
pnpm build
# Run tests
pnpm testcrates/rexprs-core/- Core Rust librarycrates/rexprs-js/- N-API bindings for Node.jscli/- CLI tools and utilitiesexamples.md- Comprehensive usage examples
rexprs leverages Rust's performance characteristics to deliver exceptional speed:
- Zero-cost abstractions – Pay only for what you use
- Memory safety – No garbage collection overhead
- Async runtime – Powered by Tokio for high concurrency
- Native compilation – Direct machine code execution
| Framework | Requests/sec | Latency (ms) |
|---|---|---|
| Express.js | ~15,000 | 6.7 |
| rexprs | ~45,000 | 2.2 |
| Fastify | ~25,000 | 4.0 |
Benchmarks run on MacBook Pro M2, Node.js 20.x
We welcome contributions! Please see our Contributing Guide for details.
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Make your changes
- Run tests:
pnpm test - Run linting:
pnpm lint - Commit your changes:
git commit -m 'Add amazing feature' - Push to the branch:
git push origin feature/amazing-feature - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE.md file for details.
- Inspired by Express.js and the Node.js ecosystem
- Built with N-API and napi-rs
- Powered by Tokio and Hyper
Made with ❤️ and 🦀 by Ritik Singh