Skip to content
This repository was archived by the owner on Oct 24, 2025. It is now read-only.

Backend Client

Zoka-tech edited this page Mar 24, 2025 · 10 revisions

Overview

To simplify communication with our backend API, we use an automated generation process that creates a TypeScript-based backend client from the Swagger API definition. This requires Docker and can be executed for the API of the development environment or a local instance. When changes are made to the backend API, re-running the generation script ensures that the client is updated without requiring any manual code adjustments.

yarn generate # Generates a backend client from app.dev.green-ecolution.de  
yarn generate:local # Generates a backend client from localhost:3000  

Description

Our backend system enables the automatic generation of a backend client designed for seamless communication with our API. The API definition is provided via Swagger, also known as OpenAPI (see backend/swagger). OpenAPI offers a powerful code generator that converts API definitions into clients in various programming languages. For our project, its ability to generate TypeScript-based definitions is particularly valuable, as it ensures smooth integration into our TypeScript-based frontend projects.

Generating the Backend Client

A dedicated script is available for generating the backend client under backend-client/openapi-generator.sh. This process places the generated client in the same workspace folder. The client can be generated using the following commands:

yarn generate # Generates a backend client from app.dev.green-ecolution.de  
yarn generate:local # Generates a backend client from localhost:3000  

What does the script do?

The script downloads the Swagger API definition and generates a TypeScript-based backend client from it. This client is stored in a dedicated workspace and can be used directly in the frontend. Whenever the backend API undergoes changes or updates, simply re-running the script ensures that the client remains up to date—without any need for manual code adjustments.

For more information please refer to the OpenAPI Documentation.

Clone this wiki locally