A production-ready Angular application configured for deployment on Convox.
Angular is Google's powerful TypeScript-based framework for building dynamic, scalable web applications. This example demonstrates how to deploy a modern Angular 18+ application on Convox with automatic SSL, load balancing, and zero-downtime deployments.
Deploy to Convox Cloud for a fully-managed platform experience, or to your own Convox Rack for complete control over your infrastructure. Either way, you'll get automatic SSL, load balancing, and zero-downtime deployments out of the box.
- Modern Angular Framework - Built with Angular 18 and standalone components for optimal performance
- TypeScript First - Full type safety with TypeScript 5.9 for maintainable code
- Production Optimized - Ahead-of-Time compilation, tree-shaking, and minification
- Container-Ready - Multi-stage Docker build for minimal production images
- Static Asset Serving - Efficient serving with the lightweight serve package
- Health Monitoring - Built-in health check endpoint for reliability
- Auto-Scaling Ready - Configured for horizontal scaling based on load
- Developer Experience - Hot module replacement and Angular DevTools support
-
Create a Cloud Machine at console.convox.com
-
Create the app:
convox cloud apps create angular-app -i your-machine-name- Deploy the app:
convox cloud deploy -a angular-app -i your-machine-name- View your app:
convox cloud services -a angular-app -i your-machine-nameVisit your URL to see the Angular app running!
- Create the app:
convox apps create angular-app- Deploy the app:
convox deploy -a angular-app- View your app:
convox services -a angular-appVisit your URL to see the Angular app running!
The example Angular application includes:
- Welcome Component - Interactive landing page with Angular branding
- Resource Links - Quick access to documentation and learning resources
- Responsive Design - Mobile-first design with modern CSS
- Signal-Based State - Leverages Angular's new signals API for reactive state management
- Standalone Components - Modern Angular architecture without NgModules
# Get the service URL
convox services -a angular-app
# Test the application
curl https://web.angular-app.cloud.convox.com/
# Check static asset serving
curl https://web.angular-app.cloud.convox.com/favicon.ico
# Verify the Angular build
curl -I https://web.angular-app.cloud.convox.com/main.jsConfigure your application using environment variables:
# Convox Cloud
convox cloud env set \
NODE_ENV=production \
API_URL=https://api.example.com \
-a angular-app -i your-machine-name
# Convox Rack
convox env set \
NODE_ENV=production \
API_URL=https://api.example.com \
-a angular-appAdjust the number of running processes and resources:
# Cloud
convox cloud scale web --count 3 --cpu 256 --memory 512 -a angular-app -i your-machine-name
# Rack
convox scale web --count 3 --cpu 256 --memory 512 -a angular-appOr configure autoscaling in your convox.yml:
services:
web:
build: .
port: 3000
scale:
count: 1-5
cpu: 250
memory: 512
targets:
cpu: 70
memory: 80- Install dependencies:
npm install- Run development server:
ng serve
# or
npm startThe app will be available at http://localhost:4200 with automatic reload on changes.
- Build for production:
ng build
# or
npm run buildThe build artifacts will be stored in dist/Angular/browser/.
- Run tests:
# Unit tests
ng test
# End-to-end tests (if configured)
ng e2eUse Convox to run the application locally with Docker:
convox startThis will build and run the application in a local Docker environment that mimics production.
.
├── src/
│ ├── app/
│ │ ├── app.ts # Root component (standalone)
│ │ ├── app.html # Component template
│ │ ├── app.scss # Component styles
│ │ ├── app.spec.ts # Component tests
│ │ ├── app.config.ts # Application configuration
│ │ └── app.routes.ts # Route definitions
│ ├── index.html # Main HTML file
│ ├── main.ts # Bootstrap file
│ └── styles.scss # Global styles
├── angular.json # Angular CLI configuration
├── tsconfig.json # TypeScript configuration
├── Dockerfile # Multi-stage Docker build
├── convox.yml # Convox deployment configuration
└── package.json # Dependencies and scripts
The application uses an optimized multi-stage Docker build:
- Build Stage: Node.js 22 Alpine compiles the Angular application
- Production Stage: Lightweight Alpine image serves static files with
serve
This approach results in:
- Small production images (~50MB)
- Fast deployment times
- Reduced attack surface
- Efficient resource usage
The production build includes:
- Ahead-of-Time (AOT) compilation for faster rendering
- Tree-shaking to remove unused code
- Minification and uglification
- Differential loading for modern vs. legacy browsers
- Budget guards to prevent bundle size regression
Angular distinguishes between development and production builds:
// Access environment in your components
import { environment } from '../environments/environment';
if (environment.production) {
// Production-specific code
}The example is configured with:
- Lazy loading ready (just add routes)
- OnPush change detection strategy compatible
- Minimal initial bundle size
- Optimized for Core Web Vitals
Cloud:
convox cloud logs -a angular-app -i your-machine-nameRack:
convox logs -a angular-appThe application serves static files and responds to health checks:
curl https://your-angular-app-url/Check build details:
# Cloud
convox cloud builds -a angular-app -i your-machine-name
# Rack
convox builds -a angular-app- Use Environment Variables: Configure API endpoints through environment variables
- Enable Production Mode: Always build with
--configuration productionfor deployments - Optimize Images: Keep Docker images small with multi-stage builds
- Set Resource Limits: Configure appropriate CPU and memory for your app size
- Use CDN: Consider CDN for static assets in high-traffic scenarios
- Enable Compression: Gzip/Brotli compression is handled by the serve package
- Monitor Bundle Size: Use
ng build --stats-jsonto analyze bundle composition
Ensure you're building for production:
convox logs -a angular-app --filter "Angular is running"If you see development mode, rebuild with production configuration.
Check that the serve command is pointing to the correct directory:
convox logs -a angular-app --filter "serve"The build output should be in dist/Angular/browser/.
If the build fails, check the build logs:
# Cloud
convox cloud builds logs BUILD_ID -a angular-app -i your-machine-name
# Rack
convox builds logs BUILD_ID -a angular-appCommon issues:
- Insufficient memory during build (increase Docker build memory)
- Missing dependencies in package.json
- TypeScript compilation errors
Monitor resource usage:
# Cloud
convox cloud ps -a angular-app -i your-machine-name
# Rack
convox ps -a angular-appFor Angular apps, most performance issues are client-side:
- Check bundle sizes with
ng build --stats-json - Enable source maps to debug production issues
- Use Angular DevTools in Chrome/Edge
Add your custom domain:
# View current services to get the router domain
convox services -a angular-app
# Create a CNAME record pointing to the router domainFor backend API integration, use Angular's HttpClient with environment configuration:
// In your service
constructor(private http: HttpClient) {
this.apiUrl = environment.apiUrl;
}
getData() {
return this.http.get(`${this.apiUrl}/data`);
}Set the API URL via environment variable:
convox env set API_URL=https://api.yourdomain.com -a angular-appTo add Angular Universal for SSR:
- Add Angular Universal to your project:
ng add @angular/ssr- Update Dockerfile to use the SSR server:
CMD ["node", "dist/Angular/server/main.js"]- Update convox.yml port to match SSR server (typically 4000)
To make your Angular app a PWA:
ng add @angular/pwaThis adds service worker support, manifest file, and offline capabilities.
- Ensure your app builds successfully:
ng build --configuration production- Add the Dockerfile from this example
- Add convox.yml configuration
- Deploy to Convox
- Export any environment variables from your current platform
- Update API endpoints to use environment variables
- Ensure your build output matches the Dockerfile's expectations
- Test locally with
convox start - Deploy to Convox
- Angular Documentation
- Angular CLI
- Angular DevTools
- Angular Performance Guide
- Convox Documentation
- Convox Cloud Guide
- Angular Community: Discord | GitHub Discussions
- Convox Support: cloud-support@convox.com
- GitHub Issues: Create an issue