Deploy Angular on Your Own Server

Deploy Angular applications as static SPAs or with server-side rendering via Angular Universal. Temps builds with the Angular CLI and serves the output with zero configuration.


Quickstart

From your project root, deploy with your preferred package manager:

npx @temps-sdk/cli up

Temps detects your angular.json, runs ng build --configuration production, and serves the dist/ output.


Static SPA

FeatureHow Temps handles it
Buildng build --configuration production
OutputServes dist/<project-name>/browser/
SPA routing404 → index.html fallback
CacheHashed assets get long-lived cache headers
HTTPSLet's Encrypt, auto-renewed
Service workersSupported — ngsw-config.json respected

Angular Universal (SSR)

For SSR, Temps runs the server bundle as a Node.js process:

# Start command detected automatically:
node dist/<project-name>/server/main.js

Environment-Specific Builds

Angular's environment.ts files work as-is. For runtime configuration, inject values via environment variables and read them from window.__env or a config endpoint.


Environment Variables

npx @temps-sdk/cli environments vars set API_URL "https://api.example.com" -e production

SPA routing

Single-page applications use client-side routing — paths like /about or /dashboard/settings do not correspond to files on disk. The Temps proxy handles this automatically.

When a request arrives for a path that:

  • Has no file extension (e.g. /about, not /about.css)
  • Does not match any file on disk

…the proxy serves index.html instead, and your client-side router (React Router, Vue Router, etc.) takes over. This works out of the box — you do not need _redirects, vercel.json, or any rewrite rules.

Compression & caching

The Temps proxy applies performance optimizations to all static file responses automatically:

  • Gzip compression for text-based files over 1 KB (HTML, CSS, JavaScript, JSON, XML, SVG) when the browser supports it.
  • ETags based on each file's content hash, so unchanged files return 304 Not Modified.

Cache-Control headers are set based on the file path:

PatternCache-ControlUse case
/assets/*, /static/*, /_next/static/*, .chunk.*, .hash.*public, max-age=31536000, immutableHashed assets that never change
Everything elsepublic, max-age=0, must-revalidateHTML files and non-hashed resources

Your hashed JS and CSS bundles are cached for a year, while index.html is always revalidated so new deployments are picked up immediately.


Next Steps

Was this page helpful?