Quick start

Scaffold a project

npm create zn

Or pnpm create zn, yarn create zn, bun create zn — whichever package manager you already use.

The installer asks what you’re building, picks relevant questions and skips everything that can’t change the answer. After a short conversation you have a running project with frontend, backend, and a complete development environment.

Run it

npm run dev      # Astro on :4321, Nitro on :3000, /api proxied
npm run build    # astro build, then vite build
npm run preview  # the real thing: one server, both halves

Open http://localhost:4321 in development — that is the origin the browser should see. The API is reachable at /api/* from there, so there is no CORS and no API base URL to configure.

Try the built-in routes

A scaffolded project ships working examples, not empty folders:

  • /api/hello — cached, reads runtime config
  • /api/posts/hello-zenness — a validated dynamic route
  • /api/upstream — an outbound call, with the failure translated
  • /old-page — a 302 redirect to /new-page

/ belongs to Astro; everything under /api belongs to Nitro. How the two halves share one origin is covered in Development workflow.