A production-ready Angular 20 template with modern best practices, comprehensive tooling, and enterprise-grade features.
- β Angular 20.3 with standalone components
- β Server-Side Rendering (SSR) with hydration
- β TypeScript Strict Mode for maximum type safety
- β Signals for reactive state management
- β OnPush Change Detection for optimal performance
- π¨ PrimeNG 20.2 with Aura theme
- π¨ Tailwind CSS for utility-first styling
- π Dark Mode support with theme service
- π± Responsive Design with mobile-first approach
- π HttpOnly Cookie Authentication with XSRF protection
- π‘οΈ Role-Based Access Control (RBAC)
- π Route Guards (auth & role guards)
- π HTTP Interceptors (auth, error, loading)
- π‘οΈ Security Headers (CSP, HSTS, X-Frame-Options)
- π§ͺ Testing Suite with Jasmine/Karma (example tests included)
- π ESLint & Prettier with pre-commit hooks via Husky
- π Conventional Commits with commitlint
- π¦ Path Aliases (@core, @shared, @features, @environments)
- π― Feature Flags for environment-specific behavior
- π Comprehensive Documentation
- β‘ Lazy Loading for all routes
- β‘ @defer examples for component lazy loading
- β‘ PreloadAllModules strategy
- β‘ OnPush change detection everywhere
- β‘ Bundle optimization with strict budgets
- ποΈ Main App Layout with header/sidebar/footer
- ποΈ Reusable Components (empty states, error boundaries, form errors)
- ποΈ Base API Service with retry logic
- ποΈ Meta Service for SEO optimization
- ποΈ Utility Functions for common tasks
- Node.js 20.18.1 or higher (check
.nvmrc) - npm 10+ or yarn
# Install dependencies
npm install
# Start development server
npm start
# Open browser
# Navigate to http://localhost:4200Admin Account:
- Email:
admin@angular.com - Password:
Angular2025!
User Account:
- Email:
user@angular.com - Password:
Angular2025!
npm start # Start development server
npm run build # Build for production
npm run test # Run unit tests
npm run lint # Lint code
npm run format # Format code with Prettier
npm run format:check # Check code formattingsrc/
βββ app/
β βββ core/ # Singleton services, guards, interceptors
β β βββ guards/ # Auth & role guards
β β βββ interceptors/ # HTTP interceptors
β β βββ models/ # Core data models
β β βββ services/ # Core services
β β βββ api.service.ts # Base HTTP service with retry
β β βββ auth.ts # Authentication service
β β βββ error-handler.ts # Global error handler
β β βββ loading.ts # Loading state service
β β βββ meta.service.ts # SEO meta tags
β β βββ theme.ts # Theme/dark mode service
β βββ features/ # Feature modules
β β βββ admin/ # Admin panel
β β βββ auth/ # Login/Register
β β βββ dashboard/ # Dashboard
β β βββ examples/ # Example components (@defer, virtual scroll)
β β βββ profile/ # User profile
β βββ shared/ # Shared components, pipes, utilities
β β βββ components/
β β β βββ app-layout.ts # Main app layout
β β β βββ auth-layout.ts # Auth pages layout
β β β βββ empty-state.ts # Empty state component
β β β βββ error-boundary.ts # Error display component
β β β βββ form-error.ts # Form validation errors
β β βββ pipes/ # Custom pipes
β β βββ utils/ # Utility functions
β βββ app.config.ts # App configuration
β βββ app.routes.ts # Route definitions
βββ environments/ # Environment configurations
β βββ environment.ts # Production
β βββ environment.development.ts # Development
β βββ environment.staging.ts # Staging
βββ assets/ # Static assets
The template includes three environments with feature flags:
- Debug tools enabled
- Longer token expiry
- Verbose console logging
- API:
http://localhost:3000
- Debug tools enabled for testing
- Error reporting enabled
- API:
https://api-staging.example.com
- Debug tools disabled
- Analytics enabled
- Minimal logging
- API:
https://api.example.com
Control features per environment in src/environments/environment.ts:
features: {
enableDebugTools: false, // Debug buttons in auth layout
enableRegistration: true, // Allow new user registration
enableSocialLogin: false, // Social auth providers
enableDarkMode: true, // Theme switching
enableAnalytics: true, // Analytics tracking
enableErrorReporting: true, // Error reporting service
}Main application layout with:
- Responsive header with user menu
- Collapsible sidebar navigation
- Theme toggle
- Footer
Display friendly empty states:
<app-empty-state
icon="pi pi-inbox"
title="No items found"
message="Create your first item to get started"
actionLabel="Create Item"
(action)="createItem()"
/>Handle errors gracefully:
<app-error-boundary
title="Something went wrong"
[message]="errorMessage"
[showRetry]="true"
(retry)="retryOperation()"
/>Display form validation errors:
<input formControlName="email" /> <app-form-error [control]="form.controls.email" />Base HTTP service with built-in:
- Retry logic with exponential backoff
- Error transformation
- Request timeout handling
- Environment-based configuration
@Injectable({ providedIn: 'root' })
export class UserService extends ApiService {
getUsers() {
return this.get<User[]>('/users');
}
createUser(user: User) {
return this.post<User>('/users', user);
}
}Example tests are included for:
- Services -
src/app/core/services/auth.spec.ts - Guards -
src/app/core/guards/auth-guard.spec.ts - Interceptors -
src/app/core/interceptors/auth-interceptor.spec.ts - Components -
src/app/features/dashboard/dashboard.spec.ts
Run tests:
npm test- Architecture -
docs/ARCHITECTURE.md - Changelog -
CHANGELOG.md - Code Guide -
.claude/CLAUDE.md
- Replace demo auth with real backend
- Use HttpOnly cookies for tokens (not sessionStorage)
- Implement server-side token validation
- Update CSP headers in
src/server.ts - Enable HTTPS only
- Set up proper CORS configuration
- Implement rate limiting
- Add input sanitization
- Enable audit logging
The template includes production-ready security headers:
- Content Security Policy (CSP)
- X-Frame-Options (clickjacking protection)
- X-Content-Type-Options (MIME sniffing protection)
- Strict-Transport-Security (HTTPS enforcement)
- Referrer-Policy
- Permissions-Policy
- Chrome (latest)
- Firefox (latest)
- Safari (latest)
- Edge (latest)
- Follow the existing code structure
- Write tests for new features
- Run linting before committing
- Use conventional commits
- Update documentation
MIT
Built with β€οΈ using Angular 20