bun-server-best-practices
Installation
SKILL.md
Bun Server Best Practices Workflow
Use this skill as an instruction set. Follow the workflow in order unless the user explicitly asks for a different order.
Core Principles
- Decorator-driven architecture: Use decorators (
@Injectable,@Controller,@Module) as the primary configuration mechanism. - Explicit dependency injection: Keep DI contracts clear with Symbol+Interface pattern when needed.
- Modular organization: Split by feature domain, one module per business boundary.
- Convention over configuration: Follow established patterns for project structure and module setup.
- Type safety: Leverage TypeScript decorators and typed contracts throughout.
- Platform portability: Use
IWebSocket<T>andIServerHandle(not Bun-specific types) to keep code runnable on both Bun and Node.js 22+.
1) Confirm architecture before coding (required)
- Default stack: Bun Runtime +
@dangao/bun-server+ TypeScript with decorators enabled. - Current stable reference version:
@dangao/bun-serverv3.0.5(update docs/examples based on this line unless user pins another version). - Verify
tsconfig.jsonhasexperimentalDecorators: trueandemitDecoratorMetadata: true.