-
Notifications
You must be signed in to change notification settings - Fork 0
Contributing
Tanzim Hossain edited this page Apr 28, 2026
·
3 revisions
Thank you for contributing to NextRush! This guide covers everything you need to get started.
| Requirement | Version |
|---|---|
| Node.js | ≥ 22.0.0 |
| pnpm | latest |
| Git | any recent version |
# Clone the repository
git clone https://github.com/0xTanzim/nextrush.git
cd nextrush
# Install dependencies
pnpm install
# Build all packages
pnpm build
# Run all tests
pnpm testpnpm install # Install all dependencies
pnpm build # Build all packages
pnpm test # Run all tests
pnpm typecheck # Type check all packages
pnpm lint # Lint all packages
pnpm clean # Clean build artifacts
# Scoped commands (single package)
pnpm --filter @nextrush/core build
pnpm --filter @nextrush/core test
pnpm --filter @nextrush/core test -- --coverage
pnpm --filter @nextrush/router typechecknextrush/
├── packages/
│ ├── types/ # @nextrush/types — shared types (no deps)
│ ├── errors/ # @nextrush/errors — HTTP errors
│ ├── core/ # @nextrush/core — Application, middleware
│ ├── router/ # @nextrush/router — Radix-tree routing
│ ├── di/ # @nextrush/di — Dependency injection
│ ├── decorators/ # @nextrush/decorators — Controller decorators
│ ├── runtime/ # @nextrush/runtime — Runtime detection
│ ├── nextrush/ # nextrush — Meta package
│ ├── adapters/ # Platform adapters
│ ├── middleware/ # Middleware packages
│ └── plugins/ # Plugin packages
├── apps/
│ ├── docs/ # Documentation site
│ ├── benchmark/ # Benchmark suite
│ └── playground/ # Testing playground
└── draft/ # Architecture docs & RFCs
Lower packages never import from higher packages. No circular dependencies.
types → errors → core → router → di → decorators → controllers → adapters → middleware
Use import type for all cross-package type-only imports.
-
Strict mode — zero
anyusage; useunknownat system boundaries -
ES2022 target with
NodeNextmodule resolution -
verbatimModuleSyntax: true— useimport typefor type-only imports - Generic types over type assertions
- No
as any, no@ts-ignorewithout a documented reason
| Scope | Convention |
|---|---|
| Variables and functions | camelCase |
| Types, interfaces, classes | PascalCase |
| Constants | SCREAMING_SNAKE_CASE |
| File names | kebab-case.ts |
| Test files | kebab-case.test.ts |
- Each package exports through a single
src/index.tsbarrel file - Implementation files live in
src/ - Tests live in
src/__tests__/ - No side effects at module scope (except
reflect-metadataimport in DI code) - No runtime-specific APIs (
process,Deno,Bun) in core packages
No external runtime dependencies in core, router, errors, types, adapters, or middleware packages. Approved exceptions:
-
reflect-metadata— required for DI decorators -
tsyringe— DI container (@nextrush/dionly) -
@clack/prompts— CLI scaffolder only
- Framework: Vitest
- Coverage target: 90%+ per package (enforced in CI)
- Test files:
src/__tests__/*.test.ts(co-located with source)
import { describe, it, expect, beforeEach } from 'vitest';
describe('feature name', () => {
it('should do expected thing', () => {
// arrange
// act
// assert
});
it('should handle edge case', () => {
// ...
});
});# All packages
pnpm test
# Single package
pnpm --filter @nextrush/core test
# With coverage
pnpm --filter @nextrush/core test -- --coverage
# Watch mode
pnpm --filter @nextrush/core test -- --watch- Every bug fix must include a regression test
- Every new public API must have usage tests
- Edge cases documented in architecture docs need corresponding tests
- No tests that depend on external services (mock them)
- Tests must be deterministic — no timing-dependent assertions
- Fork the repository on GitHub
-
Create a branch:
git checkout -b feat/my-feature - Make changes following the coding standards
- Add tests for new functionality
-
Run quality gates:
pnpm build && pnpm typecheck && pnpm lint && pnpm test
- Commit with a descriptive message (see Commit Messages below)
-
Open a Pull Request against
main
Format: type(scope): description
feat(core): add plugin lifecycle hooks
fix(helmet): correct CSP directive merging
test(csrf): add double-submit cookie edge cases
docs(router): update API reference
perf(router): add O(1) static route fast path
refactor(di): simplify circular dependency detection
chore(deps): update tsyringe to 4.9
Types: feat, fix, test, docs, refactor, perf, chore
Scopes: package name (e.g. core, router, helmet, di)
| 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 |
- Every new public API must have a documentation entry
- Code examples in docs must be copy-paste runnable
- Keep documentation in sync with implementation (code wins over outdated docs)
- No marketing language in technical docs
- Use GitHub Issues
- Include a minimal reproduction case
- Specify: Node.js version, runtime (Node / Bun / Deno), OS
By contributing, you agree that your contributions will be licensed under the MIT License.
NextRush · MIT License · Docs · Issues