supabase/supabase
api-types
Auto-generated TypeScript types for the Supabase platform / management API. The contract that Studio (and any other internal tool) uses to talk to the hosted backend.
Purpose
Studio's data layer uses openapi-fetch against types from this package, so request and response shapes are guaranteed at compile time and stay in sync with the backend's OpenAPI spec.
Directory layout
packages/api-types/
├── index.ts
├── types/ # Generated TypeScript output
├── redocly.yaml # Redocly config used during generation
└── package.jsonHow regeneration works
cd packages/api-types
pnpm run codegen
# or, from the repo root:
pnpm api:codegenInternally:
- Redocly fetches the platform's OpenAPI spec.
- Types are emitted into
types/and re-exported fromindex.ts. - Studio picks up the new types automatically since
apps/studiodeclaresapi-types: workspace:*as a devDependency.
A scheduled CI job docs-mgmt-api-update.yml keeps the spec fresh.
How it is consumed
In Studio:
import type { paths } from 'api-types';
import createClient from 'openapi-fetch';
export const api = createClient<paths>({ baseUrl: '/api/platform' });The wrappers in apps/studio/data/fetchers.ts use this client to make typed requests. Each data/<domain>/*-query.ts then calls api.GET('/v1/...') with full type-safety on parameters and responses.
Integration points
- Consumed by
apps/studio. - Consumed by
apps/docswhen generating reference pages from the OpenAPI portion of the spec.
Entry points for modification
- Refresh types → run
pnpm api:codegen. - Add Studio-side wrapper for a new endpoint → add a query / mutation file in
apps/studio/data/<domain>/, callingapi.GET(...)/api.POST(...)with the new path. - Pin to a specific spec revision → adjust
redocly.yaml.
Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.