This sample application demonstrates how to create a Node.js HTTP server using Node-Boot with Supabase as the persistence layer.
- Native HTTP Server: Uses Node.js built-in HTTP module
- Supabase Integration: PostgreSQL database via Supabase
- Dependency Injection: Full DI support using TypeDI
- Type Safety: Complete TypeScript support
- Auto-configuration: Automatic component scanning and configuration loading
- OpenAPI/Swagger: Built-in API documentation
- Validation: Request/response validation with class-validator
- Logging: Structured logging with Winston
- Authentication & Authorization: JWT-based auth with role-based access control
- Node.js 18+
- pnpm (or npm)
- A Supabase project with credentials
Create or update app-config.local.yaml with your Supabase credentials:
integrations:
supabase:
url: "https://your-project.supabase.co"
serviceRoleKey: "your-service-role-key"Or set environment variables:
export SUPABASE_URL="https://your-project.supabase.co"
export SUPABASE_SERVICE_ROLE_KEY="your-service-role-key"Follow the instructions in SUPABASE_SETUP.md to create the required database schema.
pnpm installpnpm run devThe server will start at http://localhost:3000
pnpm run start:prodsrc/
├── app.ts # Main application class
├── server.ts # Server entry point
├── auth/ # Authentication & authorization resolvers
├── controllers/ # HTTP controllers
├── services/ # Business logic layer
├── models/ # Data models & DTOs
└── config/ # Configuration classes
GET /users- List all users (authenticated)GET /users/:id- Get user by ID (authenticated)POST /users- Create a new userPUT /users/:id- Update a user (authenticated)DELETE /users/:id- Delete a user (authenticated)
GET /swagger- API documentationGET /actuator/health- Health check
- Server-Side: Use
serviceRoleKeyfor server-side operations - Authentication: JWT tokens via Supabase Auth
- Authorization: Role-based access control (RBAC)
- RLS Policies: Implement Row Level Security in Supabase
- Secrets: Store sensitive keys in environment variables
pnpm run dev- Start development server with hot reloadpnpm run start- Build and start the serverpnpm run start:prod- Build and start in production modepnpm run build- Build the projectpnpm run clean:build- Clean and rebuildpnpm run lint- Run ESLintpnpm run format- Check code formattingpnpm run test- Run unit tests
Configuration is loaded from app-config.yaml with environment variable overrides. Local overrides can be placed in app-config.local.yaml.
MIT License - Copyright (c) 2024 NodeBoot