Loading repository data…
Loading repository data…
Facta-Dev / repository
BaseAPI is a production-ready backend framework built with FastAPI, designed for rapid development of secure, scalable web applications. It includes JWT authentication, background task processing with Celery + Redis, Postgress integration, and a modular architecture — perfect for startups and teams building APIs or MVPs with modern Python.
A transparent discovery signal based on current public GitHub metadata.
This score does not audit code, security, maintainers, documentation quality, or suitability. Verify the repository and its current documentation before adoption.
When a request hits your API, BaseAPI processes it through several layers:
Long-running operations are handled asynchronously:
Stripe integration handles the complete payment lifecycle:
BaseAPI is designed for production deployment with enterprise-grade features:
Traditional API development can take weeks or months to set up properly. BaseAPI eliminates this overhead by providing:
This repository may be helpful for those seeking a backend implementation in Python that is both framework-agnostic and storage-agnostic (unlike Django). Such flexibility can be achieved by using a web framework that doesn't impose strict software design (like FastAPI) and applying a layered architecture patterned after the one proposed by Matias Baglieri, which we'll explore further.
The most abstract policies define core business rules, while the least abstract ones handle I/O operations. Being closer to implementation details, less abstract policies are more likely to change. A layer represents a collection of components expressing policies at the same level of abstraction.
The concentric circles represent boundaries between different layers. The meaning of the arrows in the diagram will be discussed later. For now, we will focus on the purpose of the layers.
Domain Layer
[!NOTE] The Domain layer may also include aggregates (groups of entities that must change together as a single unit, defining the boundaries of transactional consistency) and repository interfaces (abstractions for manipulating aggregates). While these concepts aren't implemented in the project's codebase, understanding them can deepen your knowledge of DDD.
Application Layer
[!NOTE] Domain and Application layers may import external tools and libraries to the extent necessary for describing business logic — such as utilities for numerical computations, timezone management, or object modeling that extend the language's capabilities. However, they should avoid any ties to specific frameworks, databases, or external systems.
Infrastructure Layer
[!IMPORTANT]
- Clean Architecture doesn't prescribe any particular number of layers. The key is to follow the Dependency Rule, which is explained in the next section.
A dependency occurs when one software component relies on another to operate. If you were to split all blocks of code into separate modules, dependencies would manifest as imports between those modules. Typically, dependencies are graphically depicted in UML style in such a way that
[!IMPORTANT]
A -> B(A points to B) means A depends on B.
The key principle of Clean Architecture is the Dependency Rule. This rule states that more abstract software components must not depend on more concrete ones. In other words, dependencies must never point outwards within the application's boundaries.
[!IMPORTANT]
Components within the same layer can depend on each other. For example, components in the Infrastructure layer can interact with one another without crossing into other layers.
Components in any outer layer can depend on components in any inner layer, not necessarily the one closest to them. For example, components in the Presentation layer can directly depend on the Domain layer, bypassing the Application and Infrastructure layers.
Avoid letting business logic leak into peripheral details, such as raising business-specific exceptions in the Infrastructure layer without re-raising them in the business logic or declaring domain rules outside the Domain layer.
In specific cases where database constraints enforce business rules, the Infrastructure layer may raise domain-specific exceptions, such as
emailAlreadyExistsErrorfor aUNIQUE CONSTRAINTviolation. Handling these exceptions in the Application layer ensures that any business logic implemented in adapters remains under control.Avoid introducing elements in inner layers that specifically exist to support outer layers. For example, you might be tempted to place something in the Application layer that exists solely to support a specific piece of infrastructure. At first glance, based on imports, it might seem that the Dependency Rule isn't violated. However, in reality, you've broken the core idea of the rule by embedding infrastructure concerns (more concrete) into the business logic (more abstract).
The Infrastructure layer in the Clean Architecture acts as the adapter layer — connecting the application to external systems. In this project, we treat both Infrastructure and Presentation as adapters, since both adapt the application to the outside world. Speaking of dependencies direction, the diagram by R. Martin in Figure 1 can, without significant loss, be replaced by a more concise and pragmatic one — where