Skip to content

Deploy Astro to Quant

Astro is a modern web framework for building fast, content-focused websites. This guide covers deploying Astro sites to Quant, including both static and server-rendered options.

For most Astro sites, static output is the best choice — you get the fastest possible performance with global CDN delivery.

  • An Astro project (create one with npm create astro@latest)
  • A Quant account
  • Node.js 20 or later

Ensure your astro.config.mjs uses static output (this is the default):

import { defineConfig } from 'astro/config';
export default defineConfig({
output: 'static',
// Quant handles trailing slashes, but you can configure:
trailingSlash: 'ignore',
});
Terminal window
npm run build

This creates a dist/ folder with your static site.

Install the Quant CLI and deploy:

Terminal window
npm install -g @quantcdn/quant-cli
# Initialise (first time only)
quant init
# Enter your credentials when prompted
# Set directory to: dist
# Deploy
quant deploy

Create .github/workflows/deploy.yml:

name: Deploy Astro to Quant
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Restore revision log
uses: actions/cache@v5
with:
path: .quant-revision
key: quant-revision-${{ github.ref }}-${{ github.run_id }}
restore-keys: |
quant-revision-${{ github.ref }}-
- name: Build Astro
run: npm run build
- name: Deploy to Quant
uses: quantcdn/deploy-action@v6
with:
customer: ${{ secrets.QUANT_CUSTOMER }}
project: ${{ secrets.QUANT_PROJECT }}
token: ${{ secrets.QUANT_TOKEN }}
dir: dist
revision-log: .quant-revision
skip-purge: true
- name: Purge cache
uses: quantcdn/purge-action@v6
with:
customer: ${{ secrets.QUANT_CUSTOMER }}
project: ${{ secrets.QUANT_PROJECT }}
token: ${{ secrets.QUANT_TOKEN }}
url_pattern: "/*"

For Astro sites that need server-side rendering (SSR), API routes, or dynamic content, deploy to Quant Cloud.

Update your astro.config.mjs:

import { defineConfig } from 'astro/config';
import node from '@astrojs/node';
export default defineConfig({
output: 'server', // or 'hybrid' for mixed static/SSR
adapter: node({
mode: 'standalone',
}),
});

Install the Node adapter:

Terminal window
npm install @astrojs/node

Create a Dockerfile in your project root:

FROM node:20-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build
FROM node:20-alpine AS runner
WORKDIR /app
ENV NODE_ENV=production
ENV HOST=0.0.0.0
ENV PORT=4321
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/package.json ./
EXPOSE 4321
CMD ["node", "./dist/server/entry.mjs"]
  1. Go to the Quant Dashboard
  2. Navigate to Cloud ApplicationsNew Application
  3. Enter your application name
  4. Configure your environment

Create .github/workflows/deploy-cloud.yml:

name: Deploy Astro SSR to Quant Cloud
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Initialise Quant Cloud
uses: quantcdn/quant-cloud-init-action@v1
id: init
with:
quant_organization: ${{ secrets.QUANT_ORGANIZATION }}
quant_api_key: ${{ secrets.QUANT_API_KEY }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push image
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/arm64
push: true
tags: ${{ steps.init.outputs.stripped_endpoint }}/${{ secrets.QUANT_ORGANIZATION }}/my-astro-app:web${{ steps.init.outputs.image_suffix }}
- name: Deploy environment
uses: quantcdn/quant-cloud-environment-action@v1
with:
quant_organization: ${{ secrets.QUANT_ORGANIZATION }}
quant_api_key: ${{ secrets.QUANT_API_KEY }}
application: my-astro-app
environment: production
operation: update

Astro’s hybrid mode lets you choose static or server rendering per-page:

astro.config.mjs
export default defineConfig({
output: 'hybrid', // Default to static, opt-in to SSR
adapter: node({ mode: 'standalone' }),
});

Mark pages that need SSR:

src/pages/api/search.astro
---
export const prerender = false; // This page is server-rendered
---

For hybrid sites:

  • Deploy static pages to Quant’s static edge for best performance
  • Deploy the SSR application to Quant Cloud
  • Use Page Rules to route dynamic paths to your Cloud app

Set environment variables in your CI workflow:

- name: Build Astro
run: npm run build
env:
PUBLIC_API_URL: https://api.example.com
SITE_URL: https://www.example.com

Configure environment variables in the dashboard under your environment settings, or use the Environment Variables Action.

Common integrations that work well with Quant:

IntegrationNotes
@astrojs/sitemapGenerated sitemap is deployed automatically
@astrojs/imageOptimised images are deployed as static assets
@astrojs/mdxWorks perfectly with static output
@astrojs/tailwindCSS is bundled and deployed
  1. Use static output when possible — Static pages are served from edge cache in under 50ms
  2. Enable image optimisation — In the Quant dashboard, enable image optimisation for automatic WebP/AVIF conversion
  3. Leverage revision tracking — Use --revision-log to speed up deployments
  4. Pre-render where possible — Even with SSR adapter, pre-render pages that don’t need dynamic data

Ensure trailing slash handling matches between Astro and your expectations:

astro.config.mjs
export default defineConfig({
trailingSlash: 'always', // or 'never' or 'ignore'
});

Check that asset paths are relative or use the correct base URL:

astro.config.mjs
export default defineConfig({
site: 'https://www.example.com',
base: '/', // or '/subpath' if deploying to a subdirectory
});

For Quant Cloud deployments:

  • Check your application logs in the dashboard
  • Verify the PORT environment variable matches your Dockerfile
  • Ensure the health check endpoint responds correctly