SDKVite
SDK

Vite

Sites, single-page apps and full-stack apps built with Vite.

sh
npm install -D @zeroko-io/vite
js
// vite.config.js
import zeroko from "@zeroko-io/vite"
import { defineConfig } from "vite"

export default defineConfig({ plugins: [zeroko()] })

The client's build is the service's public files. After vite build, the plugin deploys it as the SDK says.

Single-page apps

On by default: a page request for a path that's no file gets index.html, so the app's own router answers /about and the rest. Requests for files that don't exist still get a 404.

Sites

For a site of pages, with a 404 for anything else:

js
zeroko({ spa: false })

An API beside the front end

A server entry takes every request the public files don't answer. Its default export is a service's: a Hono app, or anything with fetch(request, env, ctx), and job and message too if it has them.

js
zeroko({ server: "src/server.ts" })
ts
// src/server.ts
import type { Database } from "@zeroko-io/core"
import { Hono } from "hono"

const app = new Hono<{ Bindings: { DB: Database } }>().basePath("/api")

app.get("/notes", async (c) => c.json(await c.env.DB.query("SELECT * FROM notes")))

export default app

With a server and a single-page app, a page request the server answers 404 gets index.html.

Option
serverA module whose default export takes what the public files don't.
spaindex.html for page requests that match nothing: on by default.
service, bindings, crons, varsOver zeroko.json.
deployfalse to only write .zeroko/deployment.json.