Skip to content

Generate the API clients from OpenAPI instead of hand-maintaining two #2

Description

@dmytrotkk

frontend/src/lib/api.ts (2,450 lines) and apps/mobile/src/lib/api.ts (1,085 lines) are hand-maintained clients for the same FastAPI backend. They share 36 duplicated type names and 31 duplicated function names — and they already disagree about the shape of the same server response:

type web mobile
MmChannel has unread_mention_count has team_id
Org 10 fields 5 fields
MmFile 18 fields 15 fields
HumanUser has a token field

At least one of each pair is wrong about the server. Seven hand-written clients speak this API in total.

The backend is FastAPI, so an OpenAPI schema is free — it is already served at /openapi.json and is authoritative enough that we used it to verify route counts (100 human, 61 agentic). Generating both clients from it removes an entire class of drift.

Realistically post-launch, but it should be a named decision rather than an accident someone rediscovers.

Found during the pre-open-source audit.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions