Skip to content
Get started

API reference

@vega/sdk is the library your code imports. It is TypeScript-first, has zero runtime dependencies, and weighs 11 kB minified.

Terminal window
npm install @vega/sdk
ExportDescription
vega.app()Create an app — the unit you deploy
vega.router()A composable group of routes, mountable under a prefix
ContextType of the object passed to every handler
CacheType of ctx.cache — SWR reads, writes, purges
MiddlewareType 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';

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.

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.

  • vega.app() — app options, route methods, middleware, testing
  • Routing — path patterns, the request context, routers
  • Cacheswr, get, set, delete, purge, response headers