Starting a new backend means the same half hour every time: create folders, decide where routes
and services live, set up a virtual environment, install the same dependencies, write an .env
loader. It's mechanical work that's easy to do inconsistently.
Structura does it in one command, with the architecture pattern you choose, so every project you start looks the same and is laid out the way it should be.
Also available for Go — see structura-go.
- Four architecture patterns — MVC, MVC-API, MVCS, and Hexagonal
- Framework support — Flask and FastAPI, with boilerplate wired up
- Dependency management — works with
venv,pipenv, orpoetry - YAML-driven templates — every structure and dependency set is a YAML file you can edit or extend
- Boilerplate generation — creates config and environment files alongside the folder tree
- Cross-platform — Windows, macOS, and Linux
pip install structura-pyCreate a new project
structura init myproject --framework flaskstructura init myproject --framework fastapiChoose an architecture
structura init myproject --framework fastapi --architecture hexagonalSupported values: mvc, mvc-api, mvcs, hexagonal.
Run structura --help to see all available flags.
| Pattern | Best for |
|---|---|
| MVC | Conventional web apps with server-rendered views |
| MVC-API | REST APIs that don't need a view layer |
| MVCS | Apps where business logic deserves its own service layer |
| Hexagonal | Domain-centric designs that isolate business rules from adapters and I/O |
Structures and dependency sets live as YAML under structura_py/templates/. To change what gets
generated, edit the relevant template or add your own — no code changes needed.
structura_py/
├── cli.py # CLI entry point
├── commands/ # Command implementations
├── models/ # Project, architecture, and dependency models
├── utils/ # File, prompt, and command helpers
└── templates/ # YAML architecture + dependency definitions
Python · Poetry · YAML-based templating · pre-commit
Issues and pull requests welcome. Adding a new architecture or framework is usually just a new YAML template — a good first contribution.
MIT — see LICENSE.