generated from hackforla/.github-hackforla-base-repo-template
-
-
Notifications
You must be signed in to change notification settings - Fork 21
Migrating from Flask to FastAPI
lasryariel edited this page Sep 6, 2024
·
3 revisions
This is a Decision Record. The decision was to Adopt aka migrate from Flask to FastAPI.
Our previous backend framework, Flask, served the project well but had limitations with developer accessibility, particularly for junior developers. As our project scales and our team grows, there is a need for a more modern framework that can support asynchronous operations, provide better integration with type hints, and improve code readability. FastAPI emerged as the preferred choice due to its built-in features such as dependency injection and automatic OpenAPI documentation generation.
We have chosen to migrate from Flask to FastAPI due to:
- Performance: FastAPI’s async capabilities improve performance, especially with concurrent requests.
- Developer experience: Type hints, Pydantic validation, and automatic OpenAPI documentation streamline development and make the code more accessible to new contributors (Issue #773).
- Dependency management: FastAPI's Dependency Injection simplifies modularization and testability (Issue #777).
- Performance gains: Initial tests indicate FastAPI will offer better performance, particularly with async operations.
- Migration ease: Most of the existing code can be ported without significant refactoring. Key efforts will focus on transitioning from Marshmallow to Pydantic for serialization.
- Scalability: FastAPI’s modern architecture is expected to support long-term growth and ease of new feature development.
The migration will be completed as part of the 6.0.2 milestone.
Onboarding Links
Project Links
Design Links
- HUU Design Wiki
- HUU Design Onboarding / Process / Best Practices
- Figma Project Link
- HUU Way of Working in Figma
- HUU Main Design File
- HUU Design System
- HUU Brand Style Guide
- HUU Design Google Folder