Skip to content

microscaler/bff-generator

Repository files navigation

BFF Generator

Backend for Frontend (BFF) OpenAPI spec generator for BRRTRouter microservices

License

Overview

BFF Generator is a tool for generating Backend for Frontend (BFF) OpenAPI specifications by aggregating microservice OpenAPI specs into unified API gateway specs. It supports multi-suite architectures where each suite has its own BFF.

Status: 🏗️ In Development

Features

  • Multi-Suite Support: Generate BFF specs for multiple independent suites
  • Automatic Discovery: Discovers OpenAPI specs from directory structure
  • Idempotent Generation: Deterministic, sorted output for consistent diffs
  • Schema Conflict Resolution: Automatic prefixing to avoid schema name conflicts
  • BRRTRouter Integration: Works seamlessly with BRRTRouter-generated services

Installation

From Source

git clone https://github.com/microscaler/bff-generator.git
cd bff-generator
pip install -e .

From PyPI (when published)

pip install bff-generator

Package Managers

  • Debian/Ubuntu: apt install bff-generator (deb package)
  • Red Hat/CentOS: yum install bff-generator (rpm package)
  • macOS: brew install bff-generator (Homebrew)
  • Windows (WSL2): Use Debian/Ubuntu package or pip

Quick Start

# Generate BFF spec for a suite
bff-generator generate-spec \
  --suite example-suite \
  --openapi-dir openapi/example-suite \
  --output openapi/example-suite/openapi_bff.yaml \
  --config openapi/example-suite/bff-config.yaml

Usage

See USAGE.md for detailed usage instructions.

Architecture Support

BFF Generator supports multi-suite architectures where each suite has its own BFF. Examples:

  • Example Suite 1: Multiple services → openapi/example-suite/openapi_bff.yaml
  • Example Suite 2: Multiple services → openapi/example-suite-2/openapi_bff.yaml
  • Example Suite N: Multiple services → openapi/example-suite-n/openapi_bff.yaml

Each suite can be deployed independently (e.g., in separate Kubernetes namespaces) and has its own BFF that aggregates the microservices within that suite.

Development

# Install development dependencies
pip install -e ".[dev]"

# Run tests
pytest

# Format code
black src/ tests/

# Lint code
ruff check src/ tests/

# Type check
mypy src/

License

Licensed under the PolyForm Shield License 1.0.0. See LICENSE for details.

Repository

GitHub: https://github.com/microscaler/bff-generator


Status: In Development
Version: 0.1.0

About

No description, website, or topics provided.

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors