Static sites and SPAs
Deploy a Gatsby site on Enzonic
Deploy runs gatsby build and serves the public folder as a static site; installed dependencies are cached per lockfile, so repeat builds skip most of the install. Server-side features of Gatsby (SSR and DSG pages, Gatsby Functions) are not run; put API code in an api/ folder instead.
At a glance
What Enzonic Deploy does with a Gatsby project when you connect it. You can override any of it in the project settings.
- Language
- JavaScript / TypeScript
- Detected from
- gatsby in dependencies
- Build command
- gatsby build
- Output
- public
- Runs as
- Static
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
Always: the public folder is served from the edge.
Deploy Gatsby step by step
- 1Connect the repository; Gatsby is detected from package.json.
- 2Add build-time variables (GATSBY_ prefix for the browser) and deploy.
Connect a database to Gatsby
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.
import pg from 'pg';
const pool = new pg.Pool({ connectionString: process.env.DATABASE_URL });
export async function POST(request) {
const { email } = await request.json();
await pool.query('insert into subscribers (email) values ($1) on conflict do nothing', [email]);
return Response.json({ ok: true });
}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 engineThings to know
- Pages using getServerData or DSG need a Gatsby server, which Deploy does not run: they must be static.
Plan limits that matter here
From the live plan data. Every plan includes previews for each branch, instant rollback, environment variables and logs.
| Limit | Free | Pro |
|---|---|---|
| Build minutes | 3,000/mo, 1 concurrent | 10,000/mo, 3 concurrent |
| Function memory / timeout | 1 GB / 300 s | 4 GB / 1800 s |
| Function invocations | 2 M/mo | 20 M/mo |
| Bandwidth | 150 GB/mo | 2 TB/mo |
Related guides
- Deploy a Astro siteStatic Astro sites by default, server output with @astrojs/node.
- Deploy a Docusaurus siteDocumentation sites from docusaurus build, with previews for every docs branch.
- Deploy a Hugo siteHugo sites built with hugo --gc --minify, Hugo extended included.
Ship your Gatsby project tonight
Connect the repository and the build settings fill themselves in. Free plan, no card.