| name | vercel-sdk-patterns |
| description | Production-ready Vercel REST API patterns with typed fetch wrappers and error handling.
Use when integrating with the Vercel API programmatically, building deployment tools,
or establishing team coding standards for Vercel API calls.
Trigger with phrases like "vercel SDK patterns", "vercel API wrapper",
"vercel REST API client", "vercel best practices", "idiomatic vercel API".
|
| allowed-tools | Read, Write, Edit |
| version | 1.18.0 |
| license | MIT |
| author | Jeremy Longshore <jeremy@intentsolutions.io> |
| tags | ["saas","vercel","api","typescript","patterns"] |
| compatibility | Designed for Claude Code, also compatible with Codex and OpenClaw |
Vercel SDK Patterns
Overview
Build a typed, production-ready wrapper around the Vercel REST API (api.vercel.com). Covers authentication, pagination, error handling, retry logic, and common endpoint patterns for deployments, projects, and environment variables.
Prerequisites
- Completed
vercel-install-auth setup
- TypeScript project with
strict mode enabled
- Vercel access token with appropriate scope
Instructions
Step 1: Create Typed API Client
interface VercelClientConfig {
token: string;
teamId?: string;
baseUrl?: string;
}
interface VercelError {
error: { code: string; message: string };
}
class VercelClient {
private token: string;
private teamId?: string;
private baseUrl: string;
constructor(config: VercelClientConfig) {
this.token = config.token;
this.teamId = config.teamId;
this.baseUrl = config.baseUrl ?? 'https://api.vercel.com';
}
request<T>(
: ,
: ,
?:
): <T> {
url = (path, .);
(.) url..(, .);
res = (url.(), {
method,
: {
: ,
: ,
},
: body ? .(body) : ,
});
(!res.) {
: = res.();
(res., err.., err..);
}
(res. === ) T;
res.() <T>;
}
() {
.<{ : [] }>(
,
);
}
() {
.<>(, );
}
() {
params = ({ : (limit) });
(projectId) params.(, projectId);
.<{ : [] }>(
,
);
}
() {
.<>(
,
);
}
() {
.<{ : [] }>(
,
);
}
() {
.<>(
, , envVar
);
}
() {
.<{ : [] }>(
,
);
}
() {
.<>(
, , { : domain }
);
}
}