Skip to content

project structure

github-actions[bot] edited this page Mar 13, 2026 · 4 revisions

Project Structure

Workspace Root

  • Cargo.toml: workspace members and shared dependencies
  • README.md: project overview
  • docs/: markdown docs synced to wiki
  • crates/: framework crates
  • examples/: runnable example apps
  • tests/: automation scripts

Framework Crates

  • crates/nestforge: public entry crate and re-exports
  • crates/nestforge-core: DI container, module graph, routing helpers, validation, resource service
  • crates/nestforge-http: app bootstrap (NestForgeFactory)
  • crates/nestforge-macros: proc macros for modules/controllers/routes
  • crates/nestforge-cli: CLI scaffolding and generators
  • crates/nestforge-config: env/config loading and validation schema
  • crates/nestforge-db: SQL-oriented DB wrapper and transaction APIs
  • crates/nestforge-orm: ORM abstractions for relational data
  • crates/nestforge-data: common patterns for non-relational adapters
  • crates/nestforge-openapi: OpenAPI support surface
  • crates/nestforge-graphql: GraphQL support surface
  • crates/nestforge-grpc: gRPC transport support surface
  • crates/nestforge-websockets: WebSocket gateway support surface
  • crates/nestforge-testing: testing module factory and provider overrides

Example App

examples/hello-nestforge shows current best-practice structure:

  • root app files plus barrel exports (lib.rs, main.rs, app_module.rs, app_controller.rs, health_controller.rs)
  • feature modules (users/, settings/, versioning/)
  • global guards/interceptors
  • versioned routes and global /api prefix

examples/hello-nestforge-graphql shows a GraphQL-first structure:

  • minimal module bootstrap with config
  • async-graphql schema wiring through NestForgeFactory
  • GraphQL endpoint at /graphql
  • GraphiQL mounted at /

examples/hello-nestforge-grpc shows a gRPC-first structure:

  • minimal module bootstrap with config
  • root barrel re-exports for app-level imports
  • tonic code generation from proto/
  • a transport-focused build.rs
  • provider resolution inside a tonic service via GrpcContext

examples/hello-nestforge-websockets shows a WebSocket-first structure:

  • minimal module bootstrap with config
  • root barrel re-exports for app-level imports
  • gateway mounting through NestForgeFactoryWebSocketExt
  • WebSocket route at /ws
  • provider resolution inside a gateway via WebSocketContext

Prelude and Root Barrels

New NestForge apps now use two layers of import cleanup:

  • nestforge::prelude::* for common framework factories, macros, and helper types
  • a root app src/lib.rs barrel for re-exporting your own app symbols like AppModule and AppConfig

This keeps bootstrap code flatter and avoids repetitive mod ...; declarations in main.rs.

Clone this wiki locally