Appearance
Packages
Znight is split into small packages, versioned together (all @znight/* packages share the same version; a mismatch is reported as ZNIGHT018). Install only what you use.
| Package | What it gives you | Install as | Status |
|---|---|---|---|
@znight/core | Container, application lifecycle, plugins, hooks, AOP, marker decorators | dependency | available |
@znight/compiler | Vite plugin, CLI/Bun integration: analysis, validation, code generation | devDependency | available |
@znight/http | Controllers, validation, guards, access decisions, files, cookies, SSE, CORS; node:http, Fastify, Express, Hono | dependency | available |
@znight/openapi | OpenAPI 3.1 documents generated at build time; Scalar or Swagger UI | dependency | available |
@znight/messaging | Consumers, retries, dead-letter queues; RabbitMQ, SQS, Kafka, in-memory | dependency | available |
@znight/schedule | Cron, interval and timeout jobs checked at build time; locks across instances | dependency | available |
@znight/config | Typed config classes from env, .env, JSON/YAML, Vault, AWS Secrets Manager | dependency | available |
@znight/observability | Pino logger, Prometheus metrics, OpenTelemetry tracing | dependency | available |
@znight/testing | TestBed with auto-mocks, TestApp for in-memory end-to-end tests | devDependency | available |
@znight/cli | znight new, generate, dev, build, start, openapi, code generators | devDependency | available |
Not a package (on purpose)
| You need... | In Znight |
|---|---|
| Security | Built into @znight/http: access decisions checked at build time and at boot, CORS, security headers, trusted proxies; recipes in the Security guide |
| A database, an ORM | The client of your choice, provided by a @Factory(); Drizzle recommended for SQL (Data access) |
| Caching | A method interceptor (recipe); @znight/cache is on the roadmap |
| WebSockets, GraphQL | Planned for v0.2 (roadmap); Server-Sent Events today |
How a feature package is built
Every feature package follows the same three-part shape, here @znight/http:
- The decorators are imported by your code. They do nothing at runtime and are stripped from the bundle.
- The compiler extension is discovered through the package's manifest (
package.json#znight) when the package is installed: no configuration needed. - The runtime plugin is added to
Application.create({ plugins }). It reads its section of the generated metadata and supplies the values it provides at runtime (HttpContext,Logger,MessageBroker...).
Third-party integrations (Fastify, amqplib, prom-client...) are optional peer dependencies: you install the ones you use, and adapters or drivers live in subpath exports so unused ones are never loaded.
Requirements
- Node.js 24+ or Bun 1.3+, ESM only.
- TypeScript with
experimentalDecoratorsenabled (for parameter decorators). - Vite 8 for the compiler's Vite plugin and the
znight dev/znight buildcommands (not needed when you only useznight generateor the Bun preload).