Prerequisites
Install Node.js
The frontend requires Node.js (version 18 or higher recommended). Verify your installation:You should see Node.js v18 or higher.
Backend API running
Ensure the backend API is deployed and accessible. See the backend deployment guide for details.
Install dependencies
Navigate to the frontend directory and install the required npm packages:package.json, including:
- Angular 21.1.0 - Core framework
- RxJS 7.8.0 - Reactive programming library
- Tailwind CSS 4.1.12 - Utility-first CSS framework
- Angular CLI 21.1.1 - Build and development tools
The project is configured to use npm as the package manager. This is specified in
angular.json.Environment configuration
Configure the API endpoint for your backend. The frontend needs to know where to send API requests.Recommended approach
Create environment configuration files:Runtime configuration
For runtime configuration (without rebuilding), you can use a configuration file loaded at startup:public/config.json
Development server
Run the development server for local testing:- Compile the Angular application
- Start a development server at
http://localhost:4200 - Watch for file changes and auto-reload
- Source maps for debugging
- Unminified code
- Hot module replacement
The development server is not suitable for production. Always use production builds for deployment.
Build for production
Create an optimized production build:ng build with production configuration, which:
- Optimizes the bundle - Minifies JavaScript and CSS
- Tree-shakes unused code - Removes dead code
- Generates hashed filenames - Enables cache busting
- Applies build budgets - Warns if bundles exceed size limits
dist/brautcloud-frontend/browser directory.
Build budgets
The project enforces bundle size limits:| Bundle Type | Warning | Error |
|---|---|---|
| Initial bundle | 500kB | 1MB |
| Component styles | 4kB | 8kB |
Build output
After building, thedist/ directory contains:
Deployment options
- Static hosting
- Nginx
- Docker
Deploy the
dist/brautcloud-frontend/browser directory to any static hosting service:Configure routing
Angular uses client-side routing. Configure your web server to redirect all requests toindex.html:
Performance optimization
Security considerations
- HTTPS only: Serve the application over HTTPS
- Content Security Policy: Configure CSP headers to prevent XSS attacks
- CORS configuration: Ensure backend CORS settings match your frontend domain
- Environment variables: Never commit sensitive data to version control
Security headers
Troubleshooting
Build fails
If the build fails:- Clear node modules and reinstall:
rm -rf node_modules && npm install - Clear Angular cache:
rm -rf .angular/cache - Check Node.js version compatibility
- Review error messages for missing dependencies
API calls fail
If API requests don’t work:- Verify the backend URL is correct
- Check CORS configuration on the backend
- Ensure the backend is accessible from the frontend domain
- Check browser console for network errors
Routing doesn’t work after refresh
If routes return 404 errors:- Configure web server to redirect all requests to
index.html - Verify the base href in
index.htmlis correct - Check that hash routing isn’t required for your hosting setup
Next steps
Backend deployment
Deploy the Spring Boot backend API
Database setup
Configure PostgreSQL database and schema