
Research
/Security News
Miasma Mini Shai-Hulud Hits ImmobiliareLabs npm Packages
Miasma Mini Shai-Hulud hits @immobiliarelabs Backstage plugins, targeting GitLab and LDAP auth packages on npm.
najm-api is the convenience/meta package for the Najm framework. It re-exports najm-core plus the commonly used Najm backend plugins from one stable package.
A modern, modular TypeScript framework for building scalable APIs with decorators, dependency injection, and plugin architecture.
Najm is built on Hono.js and uses diject for dependency injection. It provides a powerful decorator-driven development experience with first-class support for transactions, events, guards, i18n, and more.
bun add najm-api
najm-api depends on the common backend packages for you, so application code can use one import source for the framework, core plugins, auth, validation, database, events, MCP, storage, email, cookies, CORS, cache, i18n, and rate limiting.
{
"compilerOptions": {
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"target": "ES2020",
"module": "ESNext"
}
}
import 'reflect-metadata';
import 'reflect-metadata';
import { Server, Service, Controller, Get, Post, Body, Params } from 'najm-api';
@Service()
class UserService {
getUsers() {
return [{ id: 1, name: 'Alice' }, { id: 2, name: 'Bob' }];
}
}
@Controller('/users')
class UserController {
constructor(private users: UserService) {}
@Get('/')
list() {
return this.users.getUsers();
}
@Get('/:id')
get(@Params('id') id: string) {
return { id, name: 'User ' + id };
}
@Post('/')
create(@Body() data: any) {
return { created: true, ...data };
}
}
await new Server()
.load(UserController, UserService)
.listen(3000);
import { Server, guards, database, events, cors, cookies, i18n } from 'najm-api';
await new Server()
.use(cors({ origin: '*' }))
.use(database({ default: myDb }))
.use(i18n({ translations: { en, fr } }))
.use(guards())
.use(events())
.base('/api')
.scan('./src/features')
.listen(3000);
Use the root entry for common APIs, or feature subpaths when you want a smaller, explicit import surface:
import { Server, Controller, Get, Validate, auth, database } from 'najm-api';
import { authSchema } from 'najm-api/auth';
import { Transaction } from 'najm-api/database';
import { McpTool } from 'najm-api/mcp';
Available subpaths:
najm-api/auth
najm-api/cache
najm-api/cookies
najm-api/cors
najm-api/database
najm-api/email
najm-api/event
najm-api/guard
najm-api/i18n
najm-api/mcp
najm-api/rate
najm-api/storage
najm-api/validation
Najm works as an API backend inside Next.js App Router using a catch-all route.
1. Configure next.config.ts:
const nextConfig = {
serverExternalPackages: ['reflect-metadata', 'better-sqlite3'],
};
export default nextConfig;
2. Create a shared server instance:
Use .load() with barrel imports instead of .scan() — bundlers can't resolve dynamic filesystem imports.
// src/server.ts
import 'reflect-metadata';
import { Server, database } from 'najm-api';
import * as features from './features';
export const server = new Server()
.use(database({ default: db }))
.base('/api')
.load(features);
3. Create the catch-all API route:
// app/api/[...route]/route.ts
import { handle } from 'najm-api';
import { server } from '@/server';
export const GET = handle(server);
export const POST = handle(server);
export const PUT = handle(server);
export const PATCH = handle(server);
export const DELETE = handle(server);
handle() wraps server.fetch for Next.js route handlers.
MIT
FAQs
Modern TypeScript decorator-based web framework built on Hono.js
The npm package najm-api receives a total of 107 weekly downloads. As such, najm-api popularity was classified as not popular.
We found that najm-api demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
/Security News
Miasma Mini Shai-Hulud hits @immobiliarelabs Backstage plugins, targeting GitLab and LDAP auth packages on npm.

Security News
Rolldown paused Rust React Compiler integration after a 5MB binary size increase raised concerns about shipping React-specific code to all Vite users.

Security News
/Research
Mini Shai-Hulud expands into the Go ecosystem after hitting LeoPlatform npm packages and targeting GitHub Actions workflows.