-
Notifications
You must be signed in to change notification settings - Fork 0
Architecture
NextRush v3 is built as a modular monorepo. Every feature lives in its own package; the nextrush meta package re-exports the essentials for convenience.
nextrush/
├── packages/
│ ├── types/ # @nextrush/types — shared TypeScript types
│ ├── errors/ # @nextrush/errors — HTTP error classes
│ ├── core/ # @nextrush/core — Application, middleware
│ ├── router/ # @nextrush/router — Radix-tree routing
│ ├── di/ # @nextrush/di — Dependency injection
│ ├── decorators/ # @nextrush/decorators — @Controller, @Get, @Body …
│ ├── runtime/ # @nextrush/runtime — Runtime detection
│ ├── nextrush/ # nextrush — Meta package
│ ├── adapters/
│ │ ├── node/ # @nextrush/adapter-node
│ │ ├── bun/ # @nextrush/adapter-bun
│ │ ├── deno/ # @nextrush/adapter-deno
│ │ └── edge/ # @nextrush/adapter-edge
│ ├── middleware/
│ │ ├── body-parser/ # @nextrush/body-parser
│ │ ├── cors/ # @nextrush/cors
│ │ ├── helmet/ # @nextrush/helmet
│ │ ├── csrf/ # @nextrush/csrf
│ │ ├── rate-limit/ # @nextrush/rate-limit
│ │ ├── cookies/ # @nextrush/cookies
│ │ ├── compression/ # @nextrush/compression
│ │ ├── multipart/ # @nextrush/multipart
│ │ ├── request-id/ # @nextrush/request-id
│ │ └── timer/ # @nextrush/timer
│ └── plugins/
│ ├── controllers/ # @nextrush/controllers
│ ├── events/ # @nextrush/events
│ ├── logger/ # @nextrush/logger
│ ├── static/ # @nextrush/static
│ ├── template/ # @nextrush/template
│ └── websocket/ # @nextrush/websocket
├── apps/
│ ├── docs/ # Documentation site
│ ├── benchmark/ # Benchmark suite
│ └── playground/ # Testing playground
└── draft/ # Architecture docs & RFCs
Dependencies flow strictly downward. Lower packages never import from higher packages.
@nextrush/types
↓
@nextrush/errors
↓
@nextrush/core
↓
@nextrush/router
↓
@nextrush/di
↓
@nextrush/decorators
↓
@nextrush/controllers
↓
@nextrush/adapter-*
↓
@nextrush/middleware/*
↓
nextrush (meta package)
Cross-package imports use only published interfaces. Internal implementation details are never imported directly across package boundaries.
The core is under 3,000 lines of code. Application setup, middleware composition, and plugin installation are the only responsibilities of @nextrush/core.
No external runtime dependencies in core, router, errors, types, adapters, or middleware packages. The only approved exceptions are:
-
reflect-metadata— required for decorator metadata (DI) -
tsyringe— DI container implementation (@nextrush/dionly) -
@clack/prompts— interactive CLI (create-nextrushscaffolder only)
Full TypeScript strict mode. No any. unknown is used at system boundaries. All exported types are documented.
Functional routes and class-based controllers are first-class citizens:
-
Functional —
createRouter()+ route handlers → zero setup overhead, great for scripts and microservices -
Class-based —
@Controller+@Service+controllersPlugin→ DI, testability, large codebases
The @nextrush/core package does not use any runtime-specific APIs (process, Deno, Bun). Platform coupling is isolated to adapter packages.
Every optional capability (logging, static files, WebSocket, controllers) is a plugin that implements the Plugin interface. Plugins have access to lifecycle hooks: onRequest, onResponse, onError, and extendContext.
| Package | Max LOC |
|---|---|
@nextrush/types |
500 |
@nextrush/errors |
600 |
@nextrush/core |
1,500 |
@nextrush/router |
1,000 |
@nextrush/di |
400 |
@nextrush/decorators |
800 |
@nextrush/controllers |
800 |
@nextrush/adapter-* |
500 |
@nextrush/middleware/* |
300 |
@nextrush/plugin/* |
600 |
| Tool | Purpose |
|---|---|
| Turborepo | Monorepo build orchestration |
| pnpm | Package manager |
| TypeScript 5.x | Language |
| tsup | Package bundling |
| Vitest | Testing |
| ESLint | Linting |
| Prettier | Formatting |
| Changesets | Release management |
NextRush · MIT License · Docs · Issues