MangoJS is a lightweight Node.js framework for building secure, efficient microservices. Speak your architecture into existence with AI-driven development.
Built with developer experience in mind. Write less, ship more.
Describe your service in plain English. MangoJS comes with optimized prompts and patterns for AI-assisted development. Build entire microservices with natural language.
"Create a user authentication service with JWT tokens"
Optimized routing engine with sub-millisecond response times. Built for high-throughput microservices.
Full TypeScript support with strict typing. Catch errors at compile time, not runtime.
Clean, modular code with Inversify-powered DI. Easy testing and loose coupling built-in.
Built-in auth decorators, group permissions, and resource ownership validation.
Designed for distributed systems from day one. Scale horizontally with built-in patterns for service communication, queue systems, and scheduled tasks.
Use natural language to describe what you want to build. MangoJS templates guide AI to generate the right code.
The framework generates layered architecture: Database entities, Services with business logic, and Controllers with type-safe APIs.
Type-safe endpoints with Swagger docs, ready for deployment. Add features incrementally with the same workflow.
// Clean decorator-based routing
@Controller("/api/v1/users")
export class UserController {
@Get("/")
async getUsers(req: Request, res: Response) {
const users = await userService.getAll();
return res.status(200).json({ data: users });
}
@Post("/")
@HasGroups(["Admin"]) // Built-in auth
async createUser(req: Request, res: Response) {
const user = await userService.create(req.body);
return res.status(201).json({ data: user });
}
}
// Automatic transaction management
@injectable()
export class UserService {
@inject(INVERSITY_TYPES.PersistenceContext)
private _persistence: IPersistenceContext;
async create(data: UserPost): Promise<User> {
return await this._persistence.inTransaction(
async (em: EntityManager) => {
const user = em.create(User, data);
await em.save(user);
return user;
}
);
}
}
// Cron-based scheduled tasks
@Schedule('0 0 * * *', {
timezone: 'UTC',
runOnStart: false
})
@injectable()
export class CleanupTask extends ScheduledTask {
async run(): Promise<void> {
await this.performCleanup();
}
onComplete(): void {
console.log('Cleanup finished!');
}
onError(error: Error): void {
this.alertService.notify(error);
}
}
// Distributed job processing
@QueueWorker('email-queue', { concurrency: 5 })
@injectable()
export class EmailWorker implements IQueueWorkerHandler {
async process(job: Job<EmailData>): Promise<void> {
const { to, subject, body } = job.data;
await job.updateProgress(50);
await this.sendEmail(to, subject, body);
await job.updateProgress(100);
}
onFailed(job: Job, error: Error): void {
console.error(`Job failed: ${error.message}`);
}
}
Outer layers depend on inner layers, never the reverse
Switch databases without changing business logic
DI makes unit testing a breeze
npm install mangojs-core
"Start a MangoJS application using the quick-start template"