Skip to main content
The Angular application builder writes your app to dist/<project>/browser, where <project> is the name in angular.json.

Configure Angular

The Bunny CLI deploys dist for Angular by default. Point it at the browser folder in bunny.jsonc at your project root:
bunny.jsonc

Deploy your site

bunny sites is in Public Preview and available only in the Bunny CLI. It’s in active development, so commands, flags, and behaviour may change. Share feedback on Discord. The storage zone and pull zone behind each site appear in the dashboard under Storage and CDN.
1

Install the Bunny CLI and log in

See Installation for npm and other options.
2

Create a site

From your project root, run:
Replace my-site with a name for your site. The CLI creates a storage zone for your files and a pull zone to serve them, then links this directory to the new site. The site is served at a b-cdn.net address, and the CLI prints the URL.
3

Build and deploy

The CLI runs the build command, uploads the output directory from the table above, and publishes it. Every deploy is kept, so you can roll back with bunny sites deployments publish --previous.
4

Deploy on every push (optional)

This writes a GitHub Actions workflow to .github/workflows/bunny-sites.yml that deploys the site on every push to main. Add your API key to the repository as a BUNNYNET_API_KEY secret. The CLI offers to run gh secret set BUNNYNET_API_KEY for you.

Resize images with Bunny Optimizer

NgOptimizedImage builds a srcset from a custom image loader. Point the loader at Bunny Optimizer, and the edge resizes each width.
1

Turn on Optimizer

bunny sites create leaves query strings and Optimizer off, so open the site’s pull zone under CDN → Pull Zones:
  • Turn on URL Query String vary, so each ?width= gets its own cache entry.
  • Enable Bunny Optimizer, then turn on the Dynamic Image API and automatic WebP under Optimizer → Settings. Your build has already minified CSS and JavaScript, so turn Optimizer’s minification off.
2

Provide the loader

Add an IMAGE_LOADER provider to your app config:
src/app/app.config.ts
3

Add images

Import NgOptimizedImage in your component, then use ngSrc:
With sizes, Angular writes a srcset with URLs such as /images/photo.jpg?width=828. Without it, you get 1x and 2x entries.

Client-side routing

Single-page apps handle routing in the browser, so a direct visit to a path like /settings needs to load index.html. The Bunny CLI turns this on for you when it detects a single-page app, unless your build includes a 404.html. To change it, set "spa" in the sites block of bunny.jsonc, or pass --spa or --no-spa to bunny sites deploy. For a manual deploy, open your storage zone’s Error handling page, set 404 File path to /index.html, and check Rewrite 404 to 200 status code. See Storage zone settings for details.

Add a custom domain

With the Bunny CLI, add the domain to your site:
The CLI prints the CNAME record to create with your DNS provider. Once the record resolves, issue a free certificate with bunny sites domains ssl example.com. For a manual deploy, add the hostname to your pull zone by following Custom hostnames.
Last modified on October 15, 2026