Overview
Validation happens on the server; the interface only helps people get it right the first time.
Server-rendered pages keep first load fast; interactive parts hydrate where they are needed.
Trade-offs
- Client vs server state
- Keep the source of truth on the server and cache it on the client with explicit invalidation.
- Optimistic updates
- Feel instant, but need a clear rollback path when the server disagrees.
Architecture
Integration layer
Moves data between systems reliably. Every message is queued, retried on failure and deduplicated so nothing posts twice.
- REST & webhook adapters
- Queue with retries
- Idempotency keys
- Schema mapping
Illustrative diagram. For the end-to-end view, see the architecture on the Developers home.
Workflow
Contract
Agree request and response shapes.
What we design for
- Duplicated validation drifting apart
- Slow first loads on mobile
- Inaccessible custom controls
Validate at the boundary
const Input = z.object({ sku: z.string().min(1), qty: z.number().int().positive() });
export const addLine = createServerFn({ method: "POST" })
.validator((d) => Input.parse(d))
.handler(async ({ data }) => saveLine(data));