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 🙏

© 2026 – Pkg Stats / Ryan Hefner

tinny-backend

v1.0.6

Published

A lightweight and flexible backend framework built on Node.js.

Readme

tinny-backend

A lightweight routing system for Node.js with built-in file serving, JWT authentication, and monitoring capabilities.

Features

  • HTTP routing with support for GET, POST, PUT, DELETE methods
  • Dynamic route parameters (e.g., /users/:id)
  • Middleware chain support
  • Static file serving with automatic MIME type detection
  • Cookie management
  • JWT authentication and session management
  • Built-in admin monitoring dashboard
  • TypeScript support with full type definitions
  • Session tracking and rate limiting

Installation

npm install tinny-backend

Quick Start

import Server from 'tinny-backend';

const server = new Server({
  port: 3000,
  hostname: 'localhost',
  ServerName: 'MyApp'
});

// Basic route
server.add({
  method: 'GET',
  path: '/',
  handler: (req, res) => {
    res.send(200, { message: 'Hello World!' });
  }
});

// Route with parameters
server.add({
  method: 'GET',
  path: '/users/:id',
  handler: (req, res) => {
    const userId = req.params.id;
    res.send(200, { userId });
  }
});

// Route with middleware
server.add({
  method: 'POST',
  path: '/api/data',
  middelWares: [authMiddleware],
  handler: (req, res) => {
    res.send(200, { received: req.body });
  }
});

// Serve static files
server.servDir('./public', 'static');

server.listen();

API Reference

Server Constructor

new Server(options: ServerOptions)

Options:

| Option | Type | Default | Description | |--------|------|---------|-------------| | port | number | 3000 | Server port | | hostname | string | 'localhost' | Server hostname | | ServerName | string | 'Server' | Server display name | | DefaultHandler | HandlerFun | 404 handler | Default route handler |

Adding Routes

server.add({
  method: 'GET' | 'POST' | 'PUT' | 'DELETE',
  path: string,
  handler: HandlerFun,
  middelWares?: HandlerFun[],
  next?: HandlerFun
})

Request Object (ServerReq)

| Property | Type | Description | |----------|------|-------------| | ReqUrl | URL | Parsed request URL | | Query | URLSearchParams | Query parameters | | queries | object | Query parameters as object | | body | any | Request body (parsed JSON) | | ip | string | Client IP address | | params | Record<string, string> | Route parameters | | server | Server | Server instance |

Response Object (ServerRes)

| Method | Description | |--------|-------------| | send(status, data?, headers?) | Send JSON response | | sendFile(status, contentType, data, headers?) | Send file response | | addCookie(name, value) | Add cookie | | getCookie(name) | Get cookie | | setCookie(name, value) | Update cookie | | getAllCookies() | Get all cookies |

File Serving

// Serve a directory
server.servDir('./public', 'static');

// Read directory contents
const files = await server.readDir('./public', 'static');

Monitoring

The server includes a built-in monitoring system that provides an admin dashboard with real-time metrics.

Enable monitoring:

server.listen(true); // Enables monitoring

Environment Variables Required:

ADMIN_USERNAME=admin
ADMIN_PASSWORD=secure_password
ADMIN_KEY=your_jwt_secret_key

Monitoring Routes:

  • / - Admin dashboard
  • /api/login - Login endpoint
  • /api/logout - Logout endpoint
  • /admin/status - Server status and metrics
  • /messages - Server logs

Examples

Authentication Middleware

const authMiddleware = (req: ServerReq, res: ServerRes) => {
  const token = res.getCookie('token');
  if (!token) {
    res.send(401, { error: 'Unauthorized' });
    return;
  }
  // Verify token logic
};

File Upload Handling

server.add({
  method: 'POST',
  path: '/upload',
  handler: async (req, res) => {
    // Handle file upload
    const fileData = req.body;
    res.send(200, { success: true });
  }
});

Configuration

Create a .env file for monitoring configuration:

ADMIN_USERNAME=admin
ADMIN_PASSWORD=your_password
ADMIN_KEY=your_jwt_secret

License

MIT

Author

Yassine Ajagrou

Links