Skip to content

Deploy Astro

Stackpad auto-detects Astro applications and supports both static and server-rendered (SSR) deployments.

Quick deploy

  1. Push your Astro project to GitHub
  2. Create a new project on Stackpad and select your repo
  3. Stackpad detects astro in your dependencies
  4. Your app is live at your-project.your-org.stackpad.eu

Static vs. server-rendered

Static (default)

By default, Astro generates static HTML files. Stackpad builds your site and serves the static files with a lightweight web server.

No additional configuration is needed — just push and deploy.

Server-rendered (SSR)

To use server-side rendering, add the Node.js adapter:

Terminal window
npx astro add node

This updates your astro.config.mjs:

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

Stackpad detects the Node adapter and runs your Astro app as a server on port 4321.

Environment variables

Access environment variables in Astro:

---
// Server-side (in .astro files, API routes)
const apiKey = import.meta.env.API_KEY;
---

For client-side variables, use the PUBLIC_ prefix:

---
const publicUrl = import.meta.env.PUBLIC_API_URL;
---

Like Next.js NEXT_PUBLIC_*, Astro’s PUBLIC_* variables are embedded at build time and require a rebuild to change.

What’s next?