Generate production-ready FastAPI projects from OpenAPI specs in seconds.
APIForge reads your OpenAPI 3.0 specification and scaffolds a complete FastAPI project — route handlers, Pydantic models, configuration, and project structure — so you can skip the boilerplate and start building.
graph LR
A[OpenAPI Spec<br/>JSON / YAML] --> B[SpecParser]
B --> C[Internal Model<br/>Endpoints + Schemas]
C --> D[CodeGenerator]
D --> E[FastAPI Project]
E --> F[main.py]
E --> G[routes/]
E --> H[models/]
E --> I[config.py]
pip install -e .# From a JSON spec
apiforge generate petstore.json --output ./my-api --name pet_service
# From a YAML spec
apiforge generate api.yaml -o ./out -n my_serviceapiforge inspect petstore.jsonmy-api/
├── main.py # FastAPI app with router includes
├── config.py # Pydantic BaseSettings
├── models/
│ └── __init__.py # Pydantic models from component schemas
└── routes/
├── __init__.py
└── pets.py # Route handlers grouped by tag
Given this minimal spec:
openapi: "3.0.0"
info:
title: Pet Store
version: "1.0.0"
paths:
/pets:
get:
operationId: listPets
summary: List all pets
tags: [pets]
parameters:
- name: limit
in: query
schema:
type: integer
responses:
"200":
description: A list of petsAPIForge generates a ready-to-run FastAPI app with typed route handlers and query parameters.
# Install dev dependencies
make install
# Run tests
make test
# Lint
make lint| Path | Description |
|---|---|
src/apiforge/core.py |
Spec parser and code generator |
src/apiforge/config.py |
Generation configuration |
src/apiforge/utils.py |
Type mapping and name conversion utilities |
src/apiforge/__main__.py |
CLI entry point |
tests/test_core.py |
Test suite |
MIT — see LICENSE.
Built by Officethree Technologies | Made with ❤️ and AI