Getting Started
Get a pracht app running in under a minute. This guide covers project creation, development, and your first production build.
Create a Project
The fastest way to start is with create-pracht. It scaffolds a working app with routing, a shell, an API route, and your choice of deployment adapter.
# pnpm
pnpm create pracht my-app
# npm
npm create pracht@latest my-app
# yarn
yarn create pracht my-app
# bun
bunx create-pracht my-appThe CLI will ask you to choose an adapter (Node.js, Cloudflare Workers, or Vercel), whether to use the explicit manifest router or the file-system pages router, whether to add Tailwind CSS, and whether to seed the agent tooling. Adapters can be changed later in vite.config.ts. Moving from pages routing to manifest routing is an explicit ejection step because named shells, route middleware, capabilities, constraints, and runtime agent configuration live in the manifest; see Pages Router.
For reproducible setup in CI, demos, or agents, pass the same choices as flags:
pnpm create pracht my-app --adapter=node --router=manifest --template=tailwind --yes
pnpm create pracht my-app --adapter=cf --router=pages --no-tailwind --no-agent-tools --yes
pnpm create pracht my-app --adapter=vercel --skip-install --yesUseful creation flags:
--adapter=node|cf|vercelchooses the deployment target.--router=manifest|pageschooses explicitsrc/routes.tsrouting or file-systemsrc/pages/routing.--template=minimal|tailwind,--tailwind, and--no-tailwindcontrol styling setup.--agent-toolsand--no-agent-toolscontrol.claude/skills/,.mcp.json, andAGENTS.md/CLAUDE.mdsetup.--skip-install,--no-git,--json, and--dry-runare handy for automation.
Project Structure
A manifest-router scaffold looks like this:
my-app/
src/
routes.ts # Route manifest (the central wiring file)
routes/home.tsx # First page component + loader
routes/not-found.tsx # Not-found page, wired from the manifest
shells/public.tsx # Layout wrapper
api/health.ts # Sample API endpoint
vite.config.ts # Vite + pracht plugin config
package.jsonA pages-router scaffold uses src/pages/ instead:
my-app/
src/
pages/_app.tsx # App shell
pages/index.tsx # First page component + loader
pages/404.tsx # Not-found page, wired automatically
api/health.ts # Sample API endpoint
vite.config.ts # Vite + pracht plugin config
package.jsonDepending on your choices, the starter can also include Tailwind's src/styles/global.css, adapter files such as wrangler.jsonc or Dockerfile, and agent files under .claude/skills/ plus .mcp.json.
Development
Start the dev server with HMR. Changes to routes, shells, and loaders are reflected instantly.
pnpm devOpen http://localhost:3000 to see your app. Edit src/routes/home.tsx and watch it update.
Build Output
# Production build (client + server bundles, SSG prerendering)
pnpm buildFor Node.js targets, run the generated server with:
node dist/server/server.jsFor Cloudflare and Vercel targets, deploy the generated output with the platform tooling.
Key Concepts
- Route manifest —
src/routes.tsdeclares all routes, their shells, middleware, and render modes. See Routing. - Render modes — each route can be SSR, SSG, ISG, or SPA. See Rendering Modes.
- Loaders & API routes — server-side data fetching and mutations. See Data Loading.
- Adapters — deploy to Node.js, Cloudflare, or Vercel. See Adapters.