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

mahameru

v0.0.41

Published

Mahameru is a minimal and fast Node.js framework for building HTTP servers

Readme

MahameruJS

npm version License: MIT

⚠️ IMPORTANT NOTICE: This package is currently under active development and is not yet ready for production use.


🚧 Work in Progress

mahameru is still in its early stages. APIs, features, and configurations are subject to drastic changes without prior notice.

  • Current Status: Experimental / Alpha
  • Production Ready: No

Installing for testing

If you want to experiment with it or contribute, you can install it via npm:

Go to your favorite directory projects and run:

npm create mahameru@latest

or

npx create-mahameru@latest

and follow the prompts.

That's it!

Module conventions

Mahameru discovers modules from the directory configured as modulesPath, typically:

  • src/modules/<name>/service.ts
  • src/modules/<name>/controller.ts

During production runtime, the same convention is resolved from build output in dist/ as:

  • dist/modules/<name>/service.js
  • dist/modules/<name>/controller.js

Each module folder may contain:

  • service.ts for container-registered services
  • controller.ts for container-registered controllers

If both files exist, Mahameru registers the service first and injects it into the controller constructor. If only controller.ts exists, the controller is still registered without service injection.

Breaking change: The legacy naming convention <name>.service.ts and <name>.controller.ts is no longer supported.

Global middleware

Mahameru supports a convention-based global middleware:

  • src/middleware.ts
  • fallback src/middleware.js

The file must export a default middleware function with the signature below:

import type { MahameruMiddleware } from 'mahameru';

const middleware: MahameruMiddleware = async (_context, _isProtectedRoute, next) => {
    try {
        // Middleware logic...

        return await next();
    } catch (error) {
        throw error;
    }
};

export default middleware;

Example with route-specific conditions:

import type { MahameruMiddleware, ProtectedRoute } from 'mahameru';
import { authValidation } from './helpers/auth-middleware';

export const protectedRoutes: ProtectedRoute<MahameruGeneratedRoutes> = [
    '/user',
    '/me'
];

const middleware: MahameruMiddleware = async (context, isProtectedRoute, next) => {
    try {
        const { request, container } = context;

        // Example login using query
        // http://localhost:3000/user?auth={"username":"bintan","secret":"1234"}
        if (isProtectedRoute)
            await authValidation(request, container);

        // Other middleware logic...

        return await next();
    } catch (error) {
        throw error;
    }
};

export default middleware;

Because this middleware is global, filtering for specific routes should be done inside the middleware itself with if conditions using path and method.

Error handler

Mahameru supports a convention-based global error handler:

  • src/error.ts
  • fallback src/error.js

The file must export a default function:

import { type MahameruErrorHandler, MahameruResponse } from "mahameru";
import { NotFoundError, UnauthorizedError } from "./common/error";

const errorHandler: MahameruErrorHandler = async ({ error }) => {
    if (error instanceof UnauthorizedError || error instanceof NotFoundError)
        return MahameruResponse.json({
            success: false,
            error: error.code,
            message: error.message
        }, { status: error.statusCode });

    console.error(error);

    return MahameruResponse.json({
        success: false,
        error: 'Internal Server Error'
    }, { status: 500 });
}

export default errorHandler

The handler receives the request context plus error, and may either return a custom response directly or call next() to use Mahameru's fallback internal server response.

Not found handler

Mahameru supports a convention-based custom not-found handler:

  • src/routes/not-found.ts
  • fallback src/routes/not-found.js

This file follows the same route-style method exports as other route files:

import { MahameruResponse, type RouteHandler } from 'mahameru'

export const GET: RouteHandler = (request) => {
    return MahameruResponse.json({
        success: false,
        error: 'NOT_FOUND',
        message: 'Route not found',
        path: request.path
    }, { status: 404 });
}

The not-found handler is only used when no route matches the incoming request. For v1, it does not run through the global middleware pipeline.

Note: The mahameru package is still in its early stages and is not yet ready for production use. Please use it at your own risk and be aware of the limitations and potential issues.