Static sites and SPAs
Deploy a Vite site on Enzonic
A Vite app without a full-stack framework is a static single-page app. Deploy detects the flavour (React, Vue, Svelte, Solid, Preact or Lit), runs vite build and serves dist. Add an api/ folder for server code and it runs as functions on the same domain.
At a glance
What Enzonic Deploy does with a Vite project when you connect it. You can override any of it in the project settings.
- Language
- JavaScript / TypeScript
- Detected from
- vite in dependencies, with no full-stack framework; The UI library sets the variant: React, Vue, Svelte, Solid, Preact or Lit
- Build command
- vite build
- Output
- dist
- 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, plus functions for any files in api/.
Deploy Vite step by step
- 1Connect the repository; Vite and its variant are detected.
- 2Add a rewrite to index.html in enzonic.json if your router uses browser history paths.
- 3Deploy.
{
"rewrites": [{ "source": "/(.*)", "destination": "/index.html" }]
}Connect a database to Vite
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 postgres from 'postgres';
const sql = postgres(process.env.DATABASE_URL!);
export async function GET() {
return Response.json(await sql`select id, body from notes order by id desc limit 50`);
}
export async function POST(request: Request) {
const { body } = await request.json();
const [note] = await sql`insert into notes (body) values (${body}) returning id, body`;
return Response.json(note, { status: 201 });
}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
- Only variables prefixed VITE_ reach the browser bundle, and they are fixed at build time. Secrets belong in api/ functions.
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 Create React App siteExisting Create React App projects, served from build.
- Deploy a React Router appReact Router 7 framework mode with SSR, or SPA mode with ssr: false.
- Deploy a Angular siteAngular apps as a static SPA, or server-rendered with @angular/ssr.
Ship your Vite project tonight
Connect the repository and the build settings fill themselves in. Free plan, no card.