Open-Source Wikis

/

Supabase

/

Packages

/

api-types

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.json

How regeneration works

cd packages/api-types
pnpm run codegen
# or, from the repo root:
pnpm api:codegen

Internally:

  1. Redocly fetches the platform's OpenAPI spec.
  2. Types are emitted into types/ and re-exported from index.ts.
  3. Studio picks up the new types automatically since apps/studio declares api-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/docs when 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>/, calling api.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.

api-types – Supabase wiki | Factory