Generate a complete, runnable FastAPI backend from a JSON schema — in one command.
Stop writing the same FastAPI setup over and over.
Define your models in JSON → get a fully working backend instantly.
Every new FastAPI project starts the same way — setting up folders, writing SQLAlchemy models, wiring CRUD routes, configuring the database, writing main.py... It's tedious, repetitive, and eats time you could spend building actual features.
One JSON file. One command. A complete, runnable FastAPI backend.
python -m generator.cli myapp --json schema.json --db --install --runYour API is live at http://127.0.0.1:8000/docs. Done.
- CLI-based — one command scaffolds an entire project
- JSON → SQLAlchemy models — no manual ORM writing
- Auto CRUD routes — GET, POST, PUT, DELETE for every model, zero boilerplate
- Database auto-setup — SQLite configured and initialized out of the box
- Dependency installation —
--installflag handlespip installautomatically - One-command server start —
--rungets you to live interactive docs immediately - Clean project structure — ready to extend, not a mess to untangle
- Python 3.8+
- pip
git clone https://github.com/CrestXcode/API-BOILERPLATE-GENERATOR.git
cd API-BOILERPLATE-GENERATOREdit schema.json (one is already included so you can try it right away):
{
"models": {
"User": { "id": "int", "name": "str", "email": "str" },
"Item": { "id": "int", "name": "str", "price": "float" }
},
"routes": ["User", "Item"]
}python -m generator.cli myapp --json schema.json --db --install --runhttp://127.0.0.1:8000/docs
That's it — full CRUD API with database, live in seconds.
python -m generator.cli <project_name> --json <schema_file> [options]
| Flag | Description |
|---|---|
<project_name> |
Name of the output folder to generate |
--json |
Path to your JSON schema file |
--db |
Initialize the SQLite database |
--install |
Auto-install all required Python dependencies |
--run |
Start the FastAPI development server after generation |
myapp/
├── app/
│ ├── main.py # FastAPI app entry point
│ ├── database.py # DB engine & session config
│ ├── models.py # SQLAlchemy ORM models
│ └── routes/
│ ├── user.py # Full CRUD for User
│ └── item.py # Full CRUD for Item
└── requirements.txt
| File | What it contains |
|---|---|
app/models.py |
SQLAlchemy ORM classes for each model in your schema |
app/routes/*.py |
GET, POST, PUT, DELETE endpoints per model |
app/database.py |
SQLite engine, Base declaration, and session factory |
app/main.py |
FastAPI app with all routers registered and ready |
requirements.txt |
All dependencies: fastapi, uvicorn, sqlalchemy, etc. |
If you skipped --run, start the server yourself:
cd myapp
uvicorn app.main:app --reloadThen open: http://127.0.0.1:8000/docs
- JSON → SQLAlchemy model generation
- Auto CRUD route generation
- Database auto-setup
- One-command dependency install & server start
- Pydantic v2 schema generation (request/response models)
- JWT authentication support
- PostgreSQL & MySQL support
- Docker / docker-compose output
- Interactive CLI mode (no JSON file needed)
- PyPI package —
pip install fastapi-boilerplate-gen
Contributions are very welcome! Here's how:
- Fork the repo
- Create a branch:
git checkout -b feature/your-idea - Commit your changes
- Open a Pull Request
Bug reports and ideas via Issues are just as appreciated.
If this saved you time, a star helps other developers find it.
MIT © CrestXcode