
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-middleware
Advanced tools
Middleware plugin for the Najm framework with decorator support.
@Middleware() and @Use()npm install najm-middleware
// Server auto-loads middleware plugin
new Server()
.load(MyController)
.listen(3000);
new Server()
.middleware(cors(), compress(), helmet())
.load(MyController)
.listen(3000);
@Middleware({ order: 20, path: '/api/*' })
class AuthMiddleware {
constructor(private auth: AuthService) {}
async use(ctx: Context, next: Next) {
const token = ctx.req.header('authorization');
if (!token) throw new HttpError(401, 'Unauthorized');
const user = await this.auth.verify(token);
ctx.set('user', user);
await next();
}
}
new Server()
.middleware(cors())
.load(MyController, AuthMiddleware)
.listen(3000);
@Service()
class MiddlewareConfig {
@Use({ order: 10 })
cors = cors({ origin: '*' });
@Use({ order: 15 })
compress = compress();
@Use({ order: 20, path: '/api/*' })
rateLimit = rateLimiter({ max: 100 });
}
new Server()
.load(MyController, MiddlewareConfig)
.listen(3000);
new Server()
.use(middleware({
debug: true,
requestIdHeader: 'x-trace-id',
exclude: ['/health', '/metrics'],
use: [cors(), helmet()],
}))
.load(MyController)
.listen(3000);
| Order | Source | Example |
|---|---|---|
| 1 | Core | context-storage |
| 2 | Core | request-context (ALS) |
| 10-49 | Reserved | Future core middleware |
| 50+ | .middleware() | cors, compress, helmet |
| 60+ | .use(middleware({ use: [...] })) | Config middleware |
| 100+ | @Middleware() | AuthMiddleware |
| 100+ | @Use() | Property middleware |
MIT
FAQs
middleware .
We found that najm-middleware 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.