tinyhttp is a modern, zero-dependency Express alternative that runs 2x faster while keeping the same middleware API. Drop-in replacement for most Express apps.
Getting Started
npm install @tinyhttp/app
import { App } from '@tinyhttp/app';
const app = new App();
app.get('/', (req, res) => {
res.json({ message: 'Hello from tinyhttp!' });
});
app.get('/users/:id', (req, res) => {
res.json({ userId: req.params.id });
});
app.post('/api/data', (req, res) => {
res.status(201).json({ received: req.body });
});
app.listen(3000, () => console.log('Running on :3000'));
Express Middleware Compatibility
Most Express middleware works unchanged:
import { App } from '@tinyhttp/app';
import { cors } from '@tinyhttp/cors';
import { logger } from '@tinyhttp/logger';
import { json } from 'milliparsec';
const app = new App();
app.use(cors());
app.use(logger());
app.use(json());
Built-in Packages
tinyhttp provides tiny alternatives to common Express middleware:
import { App } from '@tinyhttp/app';
import { rateLimit } from '@tinyhttp/rate-limit';
import { unless } from '@tinyhttp/unless';
app.use('/api', rateLimit({ max: 100, windowMs: 15 * 60 * 1000 }));
Why tinyhttp Over Express
| Feature | Express | tinyhttp |
|---|---|---|
| Dependencies | 30+ | 0 |
| Request/sec | ~15K | ~30K |
| ESM support | Partial | Native |
| TypeScript | @types needed | Built-in |
| Bundle size | ~200KB | ~50KB |
Why This Matters
- Zero dependencies: No supply chain risk
- 2x throughput: Better for high-traffic APIs
- Native ESM/TS: No build step for modern Node.js
- Express compatible: Migrate incrementally
Need custom API development or backend optimization? I build developer tools and data pipelines. Check out my web scraping actors on Apify or reach out at spinov001@gmail.com for custom solutions.
Top comments (0)