Building Your Application
Build a feature in the Cloudflare kit: create a page, load data, submit a form, authenticate the user, and test the result.
Start here after Installation. This guide explains how to build application features with the conventions this kit actually uses: Void Pages, React, self-managed Better Auth, and Drizzle on Postgres.
What Do You Want to Build?
| I want to… | Start with |
|---|---|
| Add a page and put it in the sidebar | Pages, Routes and Layouts |
| Fetch data for a page | Fetching Data |
| Save a form or run a mutation | Mutations and Forms |
| Get the signed-in user or check permissions | Users, Sessions and Permissions |
| Add a JSON endpoint or call it from React | API Routes |
| Add a table, write a query, or apply migrations | Database and Services |
| Add an application email | Custom Emails |
| Test a feature and debug failures | Testing and Debugging |
For daily commands, see Command Reference. For ongoing work, see Kit Updates and Building with Coding Agents.
How a Feature Fits Together
A page normally needs two files: its React component and a companion .server.ts file. The server file loads data and accepts mutations. Put database operations and business rules in named service functions, then call them from those handlers.
Loaders and actions run on the server. React page components render on the server initially and hydrate in the browser. A component's import type of its loader props is erased from the browser bundle; importing a server function into a component is a different operation and must be avoided.
Follow One Small Feature
The first three guides build an account summary at /account-summary:
- Generate the page and add its labels and navigation entry.
- Read the current user's profile with a scoped database query.
- Add a validated display-name form using the kit's existing account service.
The page and query are new examples you add to your app. The mutation reuses the real updateOwnName function, so the kit's name validation, hooks, and rate limits continue to apply. You do not need to invent a projects table to follow these examples.
Where to Put Things
| Code | Location |
|---|---|
| Signed-in pages | apps/web/pages/(app)/ |
| Public pages | apps/web/pages/, outside (app)/ and auth/ |
| Page loaders and actions | Beside the page, with the same name and .server.ts |
| API endpoints | apps/web/routes/api/ |
| App services and validators | apps/web/lib/*.service.ts and *.schema.ts |
| Your database tables | apps/web/db/schema.ts |
| App labels | apps/web/messages/en/app.json, or your own namespace |
| Sidebar items | apps/web/config/navigation.config.tsx |
| Reusable packages | packages/<name>/src/, with separate client and server entries |
For specialized work, continue to background jobs, file storage, billing, translations, and configuration.
Next: Create a Page →