Skip to content

MukundaKatta/APIForge

Repository files navigation

APIForge

CI Python 3.10+ License: MIT

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.

How It Works

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]
Loading

Quickstart

Install

pip install -e .

Generate a project

# 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_service

Inspect endpoints

apiforge inspect petstore.json

What gets generated

my-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

Example

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 pets

APIForge generates a ready-to-run FastAPI app with typed route handlers and query parameters.

Development

# Install dev dependencies
make install

# Run tests
make test

# Lint
make lint

Project Structure

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

License

MIT — see LICENSE.


Built by Officethree Technologies | Made with ❤️ and AI

About

API scaffold generator — generate FastAPI projects from OpenAPI specs with models, routes, and config

Topics

Resources

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors