npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

turbyoot

v0.2.10

Published

A modern, intuitive Node.js web framework that makes building APIs simple and enjoyable.

Readme

Turbyoot

npm version GitHub Actions License: MIT Node.js Version

A modern, simple and intuitive Node.js web framework that makes building APIs simple and enjoyable.

Turbyoot is a zero-runtime dependency framework that combines Koa's middleware pattern with Express's routing API, enhanced with modern features like fluent APIs and resource routing. Built with TypeScript, it provides a clean, chainable syntax for defining routes and comes with essential middleware for security, validation, and performance.

Note: Turbyoot is currently just hobby project with occasional development and is not production ready. The API may change, and there may be bugs or rough edges on parts where I didn't pay enough attention. Use at your own risk (or curiosity).

Installation

This is a Node.js module available through the npm registry.

Before installing, download and install Node.js. Node.js 20 or higher is required.

Installation is done using the npm install command:

npm install turbyoot

Quick Start

The quickest way to get started with Turbyoot:

import { Turbyoot } from 'turbyoot';

const app = new Turbyoot();

app.get('/', (ctx) => {
  ctx.ok({ message: 'Hello World' });
});

app.listen(3000, () => {
  console.log('Server is running on http://localhost:3000');
});

Features

  • Zero Dependencies - Lightweight framework with no external runtime dependencies
  • Fluent API - Chainable, intuitive syntax for clean and readable code
  • Resource Routing - Automatic CRUD routes with custom handlers and filtering
  • Grouped Routes - Organize routes with prefixes and shared middleware
  • Plugin System - Extend functionality with a clean plugin architecture
  • Security - Built-in security headers, CORS, and rate limiting
  • Performance - Request caching, compression, and timeout handling
  • Validation - Request validation and sanitization
  • Auth Infrastructure - Flexible authentication and authorization middleware
  • TypeScript Support - Built with TypeScript, full type safety out of the box

Basic Usage

Traditional Routing

import { Turbyoot } from 'turbyoot';

const app = new Turbyoot();

app.get('/users', (ctx) => {
  ctx.ok({ users: [] });
});

app.post('/users', (ctx) => {
  ctx.created({ user: ctx.body });
});

app.listen(3000);

Fluent API

app.route()
  .use(authMiddleware)
  .get('/api/users', (ctx) => {
    ctx.ok({ users: [] });
  })
  .post('/api/users', (ctx) => {
    ctx.created({ user: ctx.body });
  });

Resource Routing

app.resource('posts', {
  prefix: '/api',
  handlers: {
    index: (ctx) => ctx.ok({ posts: [] }),
    show: (ctx) => ctx.ok({ post: { id: ctx.params.id } }),
    create: (ctx) => ctx.created({ post: ctx.body }),
    update: (ctx) => ctx.ok({ post: { id: ctx.params.id, ...ctx.body } }),
    destroy: (ctx) => ctx.noContent()
  }
});

Grouped Routes

app.group('/api/v1', (router) => {
  router
    .get('/users', (ctx) => ctx.ok({ users: [] }))
    .post('/users', (ctx) => ctx.created({ user: ctx.body }))
    .get('/posts', (ctx) => ctx.ok({ posts: [] }));
});

Middleware

import { cors, helmet, rateLimit, validate } from 'turbyoot/middleware';

app.use(helmet());
app.use(cors({ 
  origin: 'https://example.com',
  credentials: true,
  preflightCacheControl: true
}));
app.use(rateLimit({ windowMs: 15 * 60 * 1000, max: 100 }));

app.post('/users', validate({
  schema: {
    body: {
      name: { required: true, type: 'string' },
      email: { required: true, type: 'string' }
    }
  }
}), (ctx) => {
  ctx.created({ user: ctx.body });
});

Enhanced Context

The context object provides intuitive response methods:

app.get('/users/:id', (ctx) => {
  ctx.ok({ user: userData });           // 200 OK
  ctx.created({ user: newUser });       // 201 Created
  ctx.badRequest('Invalid data');       // 400 Bad Request
  ctx.unauthorized('Login required');    // 401 Unauthorized
  ctx.notFound('User not found');       // 404 Not Found
  ctx.internalServerError('Error');     // 500 Internal Server Error
});

Idea

Turbyoot is a hybrid framework that brings together the best of both worlds:

  • Koa-style middleware pattern - Async/await middleware with context-based request handling
  • Express-style routing API - Familiar routing methods (app.get(), app.post(), etc.)
  • Modern enhancements - Fluent API, resource routing, and enhanced context methods

The framework is designed with zero dependencies, providing a lightweight foundation for building web APIs. It combines the simplicity of traditional routing with powerful features like fluent APIs and resource routing, making it easy to build both simple and complex applications. Or simply - Koa's middleware pattern meets Express's routing, with modern enhancements.

Examples

To view the examples, clone the Turbyoot repository:

git clone https://github.com/SamirHodzic/turbyoot.git && cd turbyoot

Then install the dependencies:

npm install

Then run whichever example you want:

node examples/hello-world

Available examples:

See the examples directory for more.

Contributing

The Turbyoot project welcomes all constructive contributions. Contributions take many forms, from code for bug fixes and enhancements, to additions and fixes to documentation, additional tests, triaging incoming pull requests and issues, and more!

Running Tests

To run the test suite, first install the dev dependencies:

npm install

Then run npm test:

npm test

License

MIT