Full-Stack Application Template
Get productive right away with auth, user management, and API-first architecture
Odma means "right away" in Dalmatian
Odma is a full-stack application starter that includes all the foundational components most modern applications need. Rather than starting from scratch, you get a working system that demonstrates best practices for building scalable web applications with proper architecture, security, testing, and deployment infrastructure.
The user management module serves as a practical showcase of how all the pieces work together - from database design and API endpoints to frontend interfaces and testing strategies.
- Basic Auth System - Local login/signup, JWT sessions, role-based access
- User Management Example - Full CRUD operations, user invitations, role management
- API-First Architecture - OpenAPI specification with auto-generated typed client
- Production Security - Input validation, rate limiting, secure headers, audit logging
- Comprehensive Testing - Backend API tests, E2E browser testing, visual regression, a11y
- Monitoring & Observability - Sentry error tracking, performance profiling, structured logging
- Infrastructure as Code - Docker containers, AWS deployment scripts, health monitoring
- Development Tools - Hot reload, type safety, automated API client generation, one-command setup
- NestJS - Node.js framework with dependency injection, decorators, and module system
- PostgreSQL - Primary database with full ACID compliance
- MikroORM - TypeScript ORM handling migrations, entities, and query building
- Passport.js - Authentication strategies for JWT tokens and local credentials
- Pino - JSON logging with request correlation IDs
- Swagger/OpenAPI - API specification generation from TypeScript decorators
- Sentry - Exception tracking, performance profiling, and alerting
- Nuxt - Vue.js meta-framework running in SPA mode
- Vue - Component framework with Composition API
- Vuetify - Material Design component library with theming
- Pinia - Client-side state management with TypeScript support
- VeeValidate - Form validation integrated with Yup schemas
- Axios - HTTP client with request/response interceptors
- Playwright - Browser automation for user workflow testing
- Jest - Backend API integration testing with database cleanup
- Percy - Visual diff testing for UI regression detection
- axe-core - Automated a11y compliance checking
- Docker - Containerization with multi-stage builds for optimized images
- Pulumi - TypeScript-based infrastructure provisioning for AWS
- PNPM - Package manager with workspace support and efficient storage
- ESLint + Prettier - Code linting and formatting
- Node.js 18+ and PNPM 8+
- Docker and Docker Compose
- PostgreSQL 16+ (or use Docker)
git clone <repository-url>
cd odma
pnpm setup:devThis script will:
- Install all dependencies across workspaces
- Generate environment configuration
- Start required services (PostgreSQL, Redis)
- Run database migrations and seeding
- Launch development servers
# Install dependencies
pnpm i
# Configure environment
cp .env.example .env
# Edit .env with your database credentials and API keys
# Start services
docker-compose -f docker-compose.dev.yaml up -d
# Setup database
pnpm --filter backend migration:up
pnpm --filter backend seeder:run
# Start development
pnpm dev- Frontend: http://localhost:8080
- Backend API: http://localhost:3000
- API Documentation: http://localhost:3000/api/docs
- Database: postgresql://dev:dev@localhost:5432/odma
- Local Auth - Email/password with JWT tokens
- Session Management - HTTP-only cookies with CSRF protection
- Role-Based Access Control - ADMIN and USER roles with guards
- Input Validation - Global validation pipes with class-validator
- Rate Limiting - 100 requests per minute throttling
- XSS Protection - Input sanitization and secure headers
- CORS Configuration
Admin: admin@example.com / admin123!
The backend automatically generates OpenAPI specifications from NestJS decorators, providing:
- Live Documentation at
/api/docswith Swagger UI - Type-safe API contracts from TypeScript DTOs
- Request/response validation at runtime
One of the key innovations is the custom-built API client generator (packages/api-client-generator) that:
- Reads OpenAPI specs from the backend and generates TypeScript clients
- Creates typed methods for every API endpoint with full parameter types
- Provides both standard and raw responses for flexibility
- Watches for changes in development for automatic regeneration
- Generates TypeScript interfaces for all DTOs and responses
// Auto-generated typed client with full IntelliSense
import { createApiClient } from 'app-api-client';
const api = await createApiClient({ axiosClient });
// Typed method calls with parameter validation
const user = await api.auth.login({
body: { email: 'user@example.com', password: 'password123' },
});
// Access raw Axios responses when needed
const response = await api.auth.login.raw({ body: credentials });
// Automatic error handling with typed errors
try {
await api.user.update({ path: { id: '123' }, body: updateData });
} catch (error) {
console.log(error.code, error.details); // Typed error properties
}# Generate API client from OpenAPI spec
pnpm api:client:generate
# Watch mode for development
pnpm api:client:watchThis project uses a multi-layered testing approach that validates functionality from the database layer up through complete user workflows in browsers.
The testing system is designed around two main areas:
- Backend integration testing (
/apps/backend/test) - Tests the API endpoints, business logic, and database interactions - E2E testing (
/tests) - Tests complete user workflows through browser automation
# Integration tests with database
pnpm --filter backend test:e2e
# Watch mode during development
pnpm --filter backend test:watch
# Coverage report
pnpm --filter backend test:covTest coverage includes:
- Authentication API - Login, JWT validation, password reset flows
- User management - CRUD operations, role assignments, soft deletion
- Access control - Role-based permissions and admin-only endpoints
- Data validation - Input sanitization and database constraints
- Email workflows - Password reset and invitation email sending
Test patterns:
- Each test gets a fresh database instance
- Test fixtures provide reusable authentication and user data
- API requests are made using supertest with cookie session handling
- Database state is validated alongside API responses
Browser tests validate complete user workflows across multiple browsers:
# Run all E2E tests
pnpm test:e2e
# Run specific test file
pnpm test:e2e tests/specs/file.tsTest coverage includes:
- Authentication flows - Login, logout, forgot password workflows
- Users domain - User management, role changes, user invitations
Additional test layers ensure UI consistency and compliance:
# Visual regression testing
pnpm test:visual
# Accessibility compliance
pnpm test:a11yVisual testing:
- Screenshots are captured during E2E tests
- Percy compares against baseline images
- Flags visual regressions across browsers and viewports
Accessibility testing:
- axe-core runs automated compliance checks
- Tests against WCAG 2.1 guidelines
- Validates keyboard navigation and screen reader support
Database management:
- Each backend test gets an isolated database
- Migrations run automatically before tests
- Database cleanup happens after each test suite
Email testing:
- Mailtrap catches all outbound emails during testing
- Email content and delivery are validated in tests
- No actual emails are sent during test runs
The test infrastructure supports:
- Parallel job execution for faster CI runs
- Database services in GitHub Actions
- Cross-browser testing with Playwright
- Test artifacts and reporting
# Start all development services
docker-compose -f docker-compose.dev.yaml up
# Services included:
# - PostgreSQL 16 (port 5432)
# - Redis 7.4 (port 6379)cd infrastructure
# Configure AWS credentials
aws configure
# Deploy infrastructure
pulumi up
# Outputs: VPC, RDS, Load Balancer, ECS Services- π VPC - Isolated network with public/private subnets
- ποΈ RDS PostgreSQL - Managed database with backups
- βοΈ Application Load Balancer - SSL termination and routing
- π ECS Fargate - Serverless container deployment
- π Security Groups - Network-level security
- π Development - Local Docker services
- π Staging/Production - AWS ECS with RDS
- π§ Configuration - Environment-specific variables
- ποΈ Secrets - AWS Systems Manager Parameter Store
- π Error Tracking - Real-time exception monitoring
- π Performance Monitoring - Request duration and database query tracking
- π Profiling - CPU profiling for performance bottlenecks
- π¨ Alerting - Email and Slack notifications
- β€οΈ Health Checks -
/api/health/liveand/api/health/ready - π Metrics - Application and infrastructure metrics
- π Request Tracing - Correlation IDs for debugging
# Start documentation server
pnpm docs:dev
# Build documentation
pnpm docs:buildodma/
βββ π± apps/
β βββ backend/ # NestJS API server
β βββ frontend/ # Nuxt 3 SPA client
βββ π¦ packages/ # Shared libraries
β βββ api-client-generator/ # Custom OpenAPI client generator
β βββ app-api-client/ # Generated API client
β βββ app-config/ # Environment configuration
β βββ app-interfaces/ # Shared TypeScript types
β βββ app-vue-components/ # Reusable Vue components
β βββ app-seed/ # Database seeding utilities
βββ π§ͺ tests/ # Playwright E2E tests
βββ ποΈ infrastructure/ # Pulumi AWS infrastructure
βββ π docs/ # VitePress documentation
βββ π οΈ scripts/ # Development automation
βββ π³ docker-compose.*.yaml # Development services
- π₯ Hot Reload - Backend and frontend auto-restart
- π Type Safety - End-to-end TypeScript
- π Auto-completion - Full IntelliSense support
- π« Pre-commit Hooks - Automated code quality checks
- π Bundle Analysis - Frontend build optimization
Copy .env.example to .env and configure:
Port already in use:
# Kill process on port 3000 or 3001
lsof -ti:3000 | xargs kill -9
lsof -ti:3001 | xargs kill -9Database connection errors:
# Ensure PostgreSQL is running
docker-compose -f docker-compose.dev.yaml up -d
# Reset database if corrupted
pnpm --filter backend schema:drop
pnpm --filter backend migration:up
pnpm --filter backend seeder:runAPI client out of sync:
# Regenerate API client after backend changes
pnpm api:client:generate
# Or run in watch mode during development
pnpm api:client:watchTypeScript errors after dependency updates:
# Clear all caches and reinstall
pnpm store prune
rm -rf node_modules pnpm-lock.yaml
pnpm installSentry not working:
- Check that
SENTRY_DSNis set in your.envfile - Verify the DSN is valid from your Sentry project settings
- In development, check logs for "Sentry instrumentation initialized"
Email not sending:
- Verify Mailtrap credentials in
.env - Check
MAIL_HOST,MAIL_USER, andMAIL_PASSWORDare correct - For production, configure your SMTP provider
This project is licensed under the MIT License - see the LICENSE file for details.
Built with β€οΈ using modern open-source technologies:
- NestJS for the robust backend framework
- Nuxt for the powerful frontend framework
- Vuetify for the beautiful Material Design components
- Playwright for reliable end-to-end testing
Happy coding! π
Get Started β’ Documentation β’ Backend Guide β’ Frontend Guide