Examples
Working code examples for common NextRush patterns and use cases.
Each example is self-contained and verified against current NextRush APIs. Pick one to get started.
Hello World
Your first NextRush application in under 10 lines.
REST API
CRUD operations with validation and error handling.
Class-Based API
Decorators, dependency injection, and controllers.
Authentication
JWT authentication with guards and protected routes.
Database Integration
Database connection patterns for production applications.
WebSocket Chat
Real-time chat with rooms, broadcasts, and connection lifecycle.
File Upload
Handle file uploads with type validation and size limits.
Functional or Class-Based?
NextRush supports both functional and class-based styles. The Hello World and REST API examples use the functional style. The Class-Based API example rebuilds the same REST API with decorators and dependency injection.
Start with functional if you're unsure — you can adopt class-based patterns incrementally.