Deploying

The Velz server is written against the Web Fetch API, so the same build runs on every runtime that speaks it. There is no adapter to configure.

Cloudflare Workers

worker.ts
import { handler } from './dist/server/index.js'

export default {
  fetch: (request, env, ctx) => handler(request),
}

Point the worker at dist/server and the assets binding at dist/client. The static assets are served first, the handler answers everything else.

Vercel and other Node hosts

server.ts
import { handler } from './dist/server/index.js'
import { startNodeServer } from '@veyra-labs/velz/adapters/node'

startNodeServer(handler, { port: process.env.PORT ?? 3000 })

Static hosting

A site with no API routes and no dynamic data can be prerendered. Point your host at dist/client and every route is a file.

What the build produces

  • dist/client holds the browser bundle, the CSS and any static assets.
  • dist/server holds the request handler as a single module with no runtime dependencies.
  • dist/velz-assets.json maps the two together, so the server knows which script and stylesheet to reference.