DEV Community

Alex Spinov
Alex Spinov

Posted on

tinyhttp Has a Free Express-Compatible API That Is 2x Faster

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
Enter fullscreen mode Exit fullscreen mode
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'));
Enter fullscreen mode Exit fullscreen mode

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());
Enter fullscreen mode Exit fullscreen mode

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 }));
Enter fullscreen mode Exit fullscreen mode

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)