Skip to content

Crate Architecture

A crate-by-crate map of the NestForge workspace and the role each crate plays.

This is the user-facing crate most applications depend on. Its main job is to re-export stable public APIs from the internal crates and feature crates.

Owns:

  • container and provider model
  • module graph and lifecycle
  • request extractors
  • validation
  • response helpers
  • route documentation structures
  • guard and interceptor pipeline abstractions

Owns:

  • NestForgeFactory
  • HTTP bootstrap and router composition
  • request context middleware
  • request ID handling
  • auth resolver integration
  • middleware consumer execution

Owns:

  • module macro
  • controller and route macros
  • route metadata macros
  • DTO-related derive and helper macros

Typed configuration loading and validation.

Testing runtime, provider overrides, and transport-friendly test helpers.

OpenAPI document generation and docs router helpers.

GraphQL routing and resolver integration.

gRPC factory, context, and bridge helpers for microservices.

Gateway routing and WebSocket context support.

Transport-neutral message and event registry plus in-process client.

Scheduling registry and runtime hooks.

Cache policies and cache interceptor support.

These currently include:

  • nestforge-db
  • nestforge-orm
  • nestforge-data
  • nestforge-mongo
  • nestforge-redis

Treat them as layered support crates, not interchangeable duplicates. When contributing, keep their responsibilities narrow and avoid leaking backend-specific concerns into the public facade without a clear API reason.