@vertz/server is the backend layer of the Vertz stack. You define entities with schemas, access rules, and hooks — the framework generates typed CRUD routes, validates inputs, enforces access control, and produces a typed client SDK. No boilerplate controllers, no manual route wiring.
How it works
1
Define your entity
Declare the data model, who can do what, and any side effects (hooks). One object, one place.
2
Framework generates routes
CRUD endpoints are auto-generated with validation, access enforcement, and error handling built
in.
3
SDK is generated
A fully typed client SDK is produced from your entity definitions — used by the UI layer with
query() and form().What’s included
Quick example
API prefix
By default, all routes are mounted under/api/. You can change this with the apiPrefix option:
/v1/ instead:
Defaults and normalization
Trailing slashes are stripped automatically. A bare
'/' is treated as an empty prefix (root mount).
API-only apps
If your server has no UI layer, you can remove the prefix entirely:GET /tasks, POST /tasks, etc.
Auth routes
Auth routes automatically follow the prefix. IfapiPrefix is '/v1', auth routes are served at /v1/auth/* and session cookies are scoped to Path=/v1/auth/....
Cloudflare Workers
When deploying to Cloudflare,createHandler reads apiPrefix from your server automatically. You only need to set it explicitly if you want to override:
Core principles
Entity-driven
Entities are the central abstraction. A single entity definition covers the data model, validation, access control, lifecycle hooks, and custom actions. Everything flows from the entity.Deny-by-default
No access rule = no route generated. You explicitly declare who can perform each operation. There’s no “open by default” — you opt in to access, not out.Type-safe end-to-end
Types flow from your schema definition through the server, into the generated SDK, and down to the UI layer. If it compiles, the types are correct across the entire stack.Guides
Entities
Models, access rules, hooks, and custom actions.
Domains
Group entities and services into bounded contexts with route prefixing.
Fields, Relations & Filters
Control which fields, filters, and relations clients can query.
Authentication
Email/password, JWT sessions, refresh tokens, and session management.
OAuth Providers
Add Google, GitHub, or Discord sign-in.
Services
Standalone operations and cross-entity workflows.
Environment
Validate and type-check env variables with
createEnv().