Skip to content

DX: Automate Frontend API Client SDK Code Generation from OpenAPI #429

Description

@EDOHWARES

Description

Automate the generation of typescript API client SDKs from backend swagger schemas.

Current Problem

Changes to backend endpoints require manual duplicate updates to frontend client files, introducing risks of type mismatches and out-of-sync APIs.

Proposed Solution

Integrate OpenAPI specification generators and configure build tasks to generate client libraries automatically.

Technical Tasks

  • Set up swagger-jsdoc export tasks to generate an OpenAPI JSON spec file from backend controllers
  • Install client generators (like `openapi-generator-cli` or `ts-openapi`) in the frontend
  • Create a shell script to automate compilation, spec generation, and client output
  • Link generation steps to frontend dev and build tasks

Acceptance Criteria

  • Running build or dev scripts exports schemas and compiles client codes automatically
  • Frontend API calls use the generated client library rather than manual Axios configurations
  • Typing is preserved for API request bodies and responses

Testing Requirements

  • Add a dummy backend route and verify the generated client includes the new method

Metadata

  • Priority: Medium
  • Difficulty: Low

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions