SDK distribution (pull)
When you run generate, the client SDK is bundled into the server output and served over HTTP, so
client apps can pull it directly from your running API.
On the server
Section titled “On the server”The generator embeds the SDK as sdk-bundle.ts and exposes:
GET /_psdk/sdk/manifest— lists files and metadataGET /_psdk/sdk/download— the complete bundleGET /_psdk/sdk/files/:path— individual filesGET /_psdk/contract.md— the API contract as MarkdownGET /_psdk/contract.json— the API contract as JSON
The contract.md / contract.json endpoints are handy for agents that want the live schema
contract straight from a running API.
Protect these endpoints by setting pullToken (use the
env: form). If unset, they’re public.
On the client
Section titled “On the client”Pull with flags:
bunx postgresdk@latest pull --from=https://api.myapp.com --output=./src/sdkOr, recommended, configure pull in postgresdk.config.ts and run pull with no args:
// postgresdk.config.ts in the client appexport default { pull: { from: "https://api.myapp.com", output: "./src/sdk", pullToken: "env:POSTGRESDK_PULL_TOKEN", // if the server sets one },};bunx postgresdk@latest pullThen use it like any generated SDK:
import { SDK } from "./src/sdk";const sdk = new SDK({ baseUrl: "https://api.myapp.com" });See PullConfig for all options.
Stale-file cleanup
Section titled “Stale-file cleanup”Both generate and pull remove files no longer part of the SDK. Interactive terminals prompt
per deletion; pass --force (or -y) to skip prompts. In CI (non-interactive), stale files are
skipped with a warning unless --force is given.