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

mahmud-bhai-er-server

v1.0.1

Published

A super fast, lightweight web framework.

Downloads

4

Readme

Mahmud Bhai Er Server 🚀

The Fast, Flexible, and Type-Safe Framework for Modern Web Development.

npm version License: MIT

🌟 Introduction

Mahmud Bhai Er Server is a lightweight web framework built on standard Web APIs (Request, Response). It is designed to be:

  • Fast: Minimal overhead, using a Radix Tree router.
  • Simple: Easy to learn API, similar to Express or Hono.
  • Flexible: Runs on Node.js, Bun, Deno, or Cloudflare Workers.
  • Type-Safe: Built with TypeScript in mind.

📦 Installation

npm install mahmud-bhai-er-server

🚀 Quick Start

Create a file named index.ts:

import { MahmudServer } from 'mahmud-bhai-er-server';

const app = new MahmudServer();

app.get('/', (c) => c.text('Hello World!'));

app.listen(3000);

Run it:

npx tsx index.ts

📚 Documentation

1. Routing & Path Parameters 🛣️

We support standard HTTP methods: get, post, put, delete, patch.

New Feature: Auto-completion for Path Parameters!

app.get('/users/:id', (c) => {
  // TypeScript knows 'id' exists!
  const id = c.param('id');
  return c.json({ userId: id });
});

app.get('/posts/:postId/comments/:commentId', (c) => {
  // TypeScript suggests 'postId' and 'commentId'
  const postId = c.param('postId');
  const commentId = c.param('commentId');
  return c.text(`Post: ${postId}, Comment: ${commentId}`);
});

2. Context (c)

The Context object is passed to every handler. It wraps the standard Request and provides helpers.

  • c.req: The raw Request object.
  • c.body(): Parse JSON body.
  • c.text(string): Return a text response.
  • c.json(object): Return a JSON response.
  • c.param(key): Get a path parameter (Type-Safe!).
  • c.set(key, value): Set a variable.
  • c.get(key): Get a variable.

3. Middleware

Middleware allows you to intercept requests. We use the "Onion Model" (like Koa).

// Global Middleware
app.use(async (c, next) => {
  console.log(`Incoming: ${c.req.method} ${c.req.url}`);
  await next(); // Call the next handler
  console.log('Response sent!');
});

Built-in Middleware

We provide some common middleware out of the box:

import { logger, bearerAuth } from 'mahmud-bhai-er-server';

app.use(logger());
app.use(bearerAuth('my-secret-token'));

4. Type Safety 🛡️

You can define your own environment variables (like User, RequestID) and get full type safety and auto-completion!

import { MahmudServer } from 'mahmud-bhai-er-server';

// 1. Define your types
type Env = {
  user: {
    id: string;
    name: string;
  };
  requestId: string;
};

// 2. Pass it to the server
const app = new MahmudServer<Env>();

app.use(async (c, next) => {
  // TypeScript knows 'requestId' is a string!
  c.set('requestId', '123');
  await next();
});

app.get('/', (c) => {
  // TypeScript knows 'user' is { id: string, name: string }
  // You get auto-completion here!
  const user = c.get('user');
  return c.json({ user });
});

5. Interoperability (Using Hono, etc.)

"What if I need a feature that isn't available?"

Because MahmudServer uses standard Web APIs, you can mount any other framework (like Hono, Itty Router, etc.) inside it!

We even re-export Hono for you as MahmudHono!

import { MahmudServer, MahmudHono } from 'mahmud-bhai-er-server';

const app = new MahmudServer();
const hono = new MahmudHono();

hono.get('/cool', (c) => c.text('Hono is handling this!'));

// Mount Hono at /hono
app.router.add('ALL', '/hono/:path', (c) => {
  // Rewrite URL to strip prefix if needed
  const url = new URL(c.req.url);
  const newUrl = new URL(url.pathname.replace('/hono', ''), url.origin);
  const newReq = new Request(newUrl.toString(), c.req);

  return hono.fetch(newReq);
});

app.listen(3000);

This gives you the best of both worlds: Simplicity by default, power when you need it.

🤝 Contributing

We welcome contributions! Please open an issue or submit a PR.

📄 License

MIT