Skip to content

Installation

← Documentation home · Next: Quickstart


Requirements

  • Node.js 18 or later
  • TypeScript 5.x recommended (the library is written in TypeScript; JavaScript works with JSDoc or loosened types)

Install the package

bash
npm install @siremzam/sentinel
bash
pnpm add @siremzam/sentinel
bash
yarn add @siremzam/sentinel

There are zero runtime dependencies. What you install is what runs.


Package exports

The main entry exposes the engine, policy builders, types, serialization, and audit helpers:

typescript
import {
  AccessEngine,
  createPolicyFactory,
  RoleHierarchy,
  toAuditEntry,
  exportRulesToJson,
  importRulesFromJson,
  ConditionRegistry,
} from "@siremzam/sentinel";

import type {
  SchemaDefinition,
  Subject,
  Decision,
} from "@siremzam/sentinel";

Optional subpath imports keep framework code out of your core bundle unless you need it:

Import pathPurpose
@siremzam/sentinel/middleware/expressExpress guard() middleware
@siremzam/sentinel/middleware/fastifyFastify preHandler
@siremzam/sentinel/middleware/honoHono middleware
@siremzam/sentinel/middleware/nestjsNestJS guard and decorator factories
@siremzam/sentinel/serverStandalone HTTP auth microservice

Each middleware module uses minimal inline request types — you do not need @types/express installed for Sentinel itself, though your app may already have them.


ESM and CommonJS

The package publishes ESM (import) and CommonJS (require) builds. Set "type": "module" in your package.json if you use native ESM.


Verify the install

Create a minimal script (or run the standalone example):

bash
npx tsx examples/standalone/main.ts

You should see audit lines for allow/deny decisions across tenants.


Next step

Quickstart — define a schema, add rules, and evaluate your first request.

Released under the MIT License.