Skip to content

Static sites and SPAs

Deploy a Astro site on Enzonic

Astro builds a static site unless you add a server adapter. Deploy serves dist as files, and when @astrojs/node is installed it starts dist/server/entry.mjs as a Node.js server on port 4321 for on-demand rendered pages and API endpoints.

At a glance

What Enzonic Deploy does with a Astro project when you connect it. You can override any of it in the project settings.

Language
JavaScript / TypeScript
Detected from
astro in dependencies; @astrojs/node switches to server mode
Build command
astro build
Output
dist
Runs as
Static or Server

Dependencies install with the package manager your lockfile names: npm ci, pnpm install --frozen-lockfile, yarn install --immutable (Berry) or --frozen-lockfile, or bun install --frozen-lockfile. Node.js 18, 20, 22 and 24 are available. Deploy reads engines.node in package.json, then .nvmrc or .node-version, and uses Node.js 22 when nothing pins a version.

How it runs

  • Static

    The default output: dist is served from the edge.

  • Server

    With @astrojs/node in standalone mode: dist/server/entry.mjs runs as a server, dist/client holds the assets.

Deploy Astro step by step

  1. 1For a static site, nothing to configure: connect the repository and deploy.
  2. 2For server rendering, run npx astro add node, keep mode: 'standalone', and deploy.
astro.config.mjs
import { defineConfig } from 'astro/config';
import node from '@astrojs/node';

export default defineConfig({
  output: 'server',
  adapter: node({ mode: 'standalone' }),
});
Only needed for server output. A static Astro site needs no adapter.

Connect a database to Astro

Create a database on Enzonic Databases (or from the project's settings) and its connection string is added to the project's environment variables. This example uses PostgreSQL.

src/pages/api/posts.json.ts
import postgres from 'postgres';

const sql = postgres(import.meta.env.DATABASE_URL ?? process.env.DATABASE_URL);
export const prerender = false;

export async function GET() {
  const posts = await sql`select id, title from posts limit 20`;
  return new Response(JSON.stringify(posts), { headers: { 'content-type': 'application/json' } });
}
On a static Astro site, put the same handler in an api/ folder at the project root instead: Deploy runs it as a function next to the static files.

Postgres projects get two variables: DATABASE_URL through the connection pooler for the app, and DATABASE_URL_UNPOOLED for migrations.

PostgreSQL on Enzonic DatabasesEvery database engine

Things to know

  • The node adapter in middleware mode does not start a server by itself; use standalone mode.
  • A custom outDir is respected when it is set in the project's build settings.

Plan limits that matter here

From the live plan data. Every plan includes previews for each branch, instant rollback, environment variables and logs.

Plan limits that matter for Astro
LimitFreePro
Build minutes3,000/mo, 1 concurrent10,000/mo, 3 concurrent
Servers1 instance, 512 MB, sleeps after 15 min idle3 always-on, 2 GB
Function memory / timeout1 GB / 300 s4 GB / 1800 s
Function invocations2 M/mo20 M/mo
Bandwidth150 GB/mo2 TB/mo

Compare every plan

Related guides

Ship your Astro project tonight

Connect the repository and the build settings fill themselves in. Free plan, no card.

Start free