API reference
@vega/sdk is the library your code imports. It is TypeScript-first, has zero runtime dependencies, and weighs 11 kB minified.
npm install @vega/sdkExports
Section titled “Exports”| Export | Description |
|---|---|
vega.app() | Create an app — the unit you deploy |
vega.router() | A composable group of routes, mountable under a prefix |
Context | Type of the object passed to every handler |
Cache | Type of ctx.cache — SWR reads, writes, purges |
Middleware | Type of functions accepted by app.use() |
Everything hangs off the vega namespace or is a type:
import { vega, type Context, type Middleware } from '@vega/sdk';Runtime support
Section titled “Runtime support”Apps run on Vega’s edge runtime in production and under Node.js 22+ with vega dev locally. Handlers use web-standard primitives — Request, Response, URL, fetch — so there is no Vega-specific response type to learn.
Versioning
Section titled “Versioning”The SDK follows semver. The current line is 2.x; breaking changes ship only in major versions, and deprecated APIs keep working for at least one major release with a console warning in vega dev. The CLI (@vega/cli) is versioned independently and any 3.x CLI works with any 2.x SDK.
Reference pages
Section titled “Reference pages”vega.app()— app options, route methods, middleware, testing- Routing — path patterns, the request context, routers
- Cache —
swr,get,set,delete,purge, response headers