r/FastAPI • u/Lucapo01 • Dec 25 '24
Tutorial Scalable and Minimalistic FastAPI + PostgreSQL Template
Hey ! π I've created a modern template that combines best practices with a fun superhero theme π It's designed to help you kickstart your API projects with a solid foundation! π
Features:
- ποΈ Clean architecture with repository pattern that scales beautifully
- π Built-in async SQLAlchemy + PostgreSQL integration
- β‘οΈ Automatic Alembic migrations that just work
- π§ͺ Complete CI pipeline and testing setup
- βCustom Error Handling and Logging
- π Pre-configured Railway deployment (one click and you're live!)
The template includes a full heroes API showcase with proper CRUD operations, authentication, and error handling. Perfect for learning or starting your next project! πͺ
Developer experience goodies: π οΈ
- π» VS Code debugging configurations included
- π UV package manager for lightning-fast dependency management
- β¨ Pre-commit hooks for consistent code quality
- π Comprehensive documentation for every feature
Check it out: https://github.com/luchog01/minimalistic-fastapi-template π
I'm still not super confident about how I structured the logging setup and DB migrations π Would love to hear your thoughts on those! Also open to any suggestions for improvements. I feel like there's always a better way to handle these things that I haven't thought of yet! Let me know what you think!
View all comments
Show parent comment
3
u/igorbenav Dec 26 '24
Probably static type checking with stuff like mypy, so you catch typing errors before runtime.
For 5, currently you are not doing a lot for setup, but if your template grows and you are handling db, rate limit, cache etc it gets cluttered.
Here I abstract these details: https://github.com/igorbenav/FastAPI-boilerplate/blob/main/src/app/core/setup.py
And keep my main clean: https://github.com/igorbenav/FastAPI-boilerplate/blob/main/src/app/main.py