Skip to content

WELD

The contract between your backend and frontend, enforced automatically — at compile time and at runtime.

E2E Type Safety

Your backend router type flows into every request. Wrong paths and wrong bodies break at compile time. Zero bundle cost.

Runtime Validation

Zod schemas at the network boundary. API drift gets caught before it reaches your UI.

Offline-First

GET requests fall back to IndexedDB cache. Mutations queue locally and sync automatically.

Request Deduplication

Concurrent requests for the same resource share one in-flight Promise. Zero duplicate server hits.

Terminal window
npm install @weldjs/http zod
Terminal window
npm install @weldjs/react zod # + React components
import { Weld } from '@weldjs/http'
import { z } from 'zod'
type AppRouter = {
'v1/products': {
GET: { response: { id: string; name: string; price: number }[] }
POST: { body: { name: string; price: number }; response: { id: string } }
}
}
const api = new Weld<AppRouter>('https://api.example.com')
const ProductSchema = z.object({
id: z.string(),
name: z.string(),
price: z.number(),
})
// Type-safe · Validated · Offline-resilient · Deduplicated
const { signal, promise } = api.get('v1/products', z.array(ProductSchema))