New:Microsoft Teams Notifications Are Now Available in Socket.Learn more →
Get Started

routup

Package Overview
Dependencies
Maintainers
1
Versions
73
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

routup

Routup is a minimalistic http based routing framework.

Source
npmnpm
Version
5.1.0
Version published
Weekly downloads
613
-62.64%
Maintainers
1
Weekly downloads
 
Created
Source

Routup banner

Routup 🧙‍

npm version main codecov Known Vulnerabilities Conventional Commits

Routup is a minimalistic, runtime-agnostic HTTP routing framework for Node.js, Bun, Deno, and Cloudflare Workers. Handlers return values directly — routup converts them to Web Response objects automatically.

Table of Contents

Installation

npm install routup --save

Features

  • 🚀 Runtime agnostic — Node.js, Bun, Deno, Cloudflare Workers
  • 📝 Return-based handlers — return strings, objects, streams, or Response directly
  • ✨ Async middleware — onion model with event.next()
  • 📌 Lifecycle hooks — request, response, error for cross-cutting concerns
  • 🔌 Plugin system — extend with reusable, installable plugins
  • 🧰 Tree-shakeable helpers — import only what you use
  • 📁 Nestable routers — modular route composition
  • 👕 TypeScript first — fully typed API with generics
  • 🤏 Minimal footprint — small core, no bloat

Documentation

To read the docs, visit https://routup.net

Usage

Handlers

Handlers receive an event and return a value. Routup converts the return value to a Web Response automatically.

Shorthand

import { Router, defineCoreHandler, defineErrorHandler, serve } from 'routup';

const router = new Router();

router.get('/', defineCoreHandler(() => 'Hello, World!'));
router.get('/greet/:name', defineCoreHandler((event) => `Hello, ${event.params.name}!`));
router.use(defineErrorHandler((error) => ({ error: error.message })));

serve(router, { port: 3000 });

Verbose

import { Router, defineCoreHandler, serve } from 'routup';

const router = new Router();

router.use(defineCoreHandler({
    path: '/',
    method: 'GET',
    fn: () => 'Hello, World!',
}));

router.use(defineCoreHandler({
    path: '/greet/:name',
    method: 'GET',
    fn: (event) => `Hello, ${event.params.name}!`,
}));

serve(router, { port: 3000 });

Return Values

Return typeResponse
stringtext/plain
object / arrayapplication/json
ResponsePassed through as-is
ReadableStreamStreamed to client
BlobSent with blob's content type
nullEmpty response (status from event.response)

Middleware

Middleware calls event.next() to continue the pipeline:

router.use(defineCoreHandler(async (event) => {
    console.log(`${event.method} ${event.path}`);
    return event.next();
}));

Runtimes

Routup runs on Node.js, Bun, Deno, and Cloudflare Workers. In most cases, import from routup:

import { Router, defineCoreHandler, serve } from 'routup';

const router = new Router();
router.get('/', defineCoreHandler(() => 'Hello, World!'));
serve(router, { port: 3000 });

For runtime-specific APIs (e.g. toNodeHandler), use the corresponding entrypoint like routup/node.

Plugins

Routup is minimalistic by design. Plugins extend the framework with additional functionality.

NameDescription
assetsServe static files from a directory
basicBundle of body, cookie, and query plugins
bodyRead and parse the request body
cookieRead and parse request cookies
decoratorsClass, method, and parameter decorators
prometheusCollect and serve Prometheus metrics
queryParse URL query strings
rate-limitRate limit incoming requests
rate-limit-redisRedis adapter for rate-limit
swaggerServe Swagger/OpenAPI docs

Benchmarks

Note: These benchmarks were recorded with routup v4 (Node.js 18, Sep 2023). Updated v5 benchmarks will follow.

PackageRequests/sLatency (ms)Throughput/MB
http6106215.8710.89
fastify5967916.2610.70
koa4576321.358.16
routup4458821.919.02
hapi4137423.677.38
express1337674.182.39

To run benchmarks yourself, see the benchmarks repository.

Contributing

Before starting to work on a pull request, it is important to review the guidelines for contributing and the code of conduct. These guidelines will help to ensure that contributions are made effectively and are accepted.

License

Made with 💚

Published under MIT License.

Keywords

api

FAQs

Package last updated on 08 May 2026

Related posts