Skip to main content

Getting Started

Welcome to Muzu - a high-performance TypeScript HTTP framework for Node.js!

What is Muzu?

Muzu is a blazingly fast, zero-dependency TypeScript HTTP framework built with performance in mind. It uses decorator-based routing, build-time compilation, and aggressive optimizations to deliver exceptional request handling speed.

Key Features

  • 🚀 Ultra Fast - Radix tree routing with O(k) lookup complexity
  • 🎯 Zero Dependencies - Only reflect-metadata required for decorators
  • 🏗️ Build-Time Compilation - Validators and middleware compiled at startup
  • 🎨 Decorator-Based - Clean, intuitive API using TypeScript decorators
  • Built-in Validation - Fast, compile-time validated request schemas
  • 🛡️ Type-Safe - Full TypeScript support with excellent IDE integration
  • 🔌 Middleware Support - Composable middleware with zero runtime overhead
  • 📚 OpenAPI/Swagger - Auto-generated API documentation from decorators
  • 📦 Lightweight - Minimal footprint, maximum performance

Installation

Install Muzu using npm:

npm install muzu

TypeScript Configuration

Muzu requires TypeScript decorators to be enabled. Add the following to your tsconfig.json:

{
"compilerOptions": {
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"target": "ES2022",
"module": "commonjs"
}
}

Quick Start

Here's a simple example to get you started:

import { MuzuServer, Controller, Get, Post, Request, Response } from 'muzu';

@Controller('/api')
class UserController {
@Get('/users')
getUsers(req: Request, res: Response) {
return {
users: [
{ id: 1, name: 'Alice' },
{ id: 2, name: 'Bob' }
]
};
}

@Post('/users')
createUser(req: Request, res: Response) {
const { name, email } = req.body;

return {
id: 3,
name,
email
};
}
}

const app = new MuzuServer();
app.listen(3000);

console.log('🚀 Server running on http://localhost:3000');

That's it! Your server is now running and ready to handle requests.

Next Steps

Performance

Muzu is designed for maximum performance:

  • Radix Tree Routing: O(k) lookup complexity where k is the number of path segments
  • Build-Time Compilation: Validators and middleware compiled at startup
  • Zero Runtime Overhead: No function call overhead for validation
  • Optimized Path Parsing: Pre-compiled parsers for each route

Ready to dive in? Let's start with Routing!