An opinionated architectural framework built on top of FastAPI that provides production-ready architecture, repository abstractions, scoped dependency injection, a secure dynamic query engine, and consistent transaction management.
Project description
A modest and practical architectural layer built on top of FastAPI.
What is ZCore?
ZCore is not a replacement for FastAPI; it is a modest and practical architectural layer built on top of it. While FastAPI provides the high-performance engine for handling HTTP requests, ZCore provides the "chassis"—a structured environment that solves common challenges in medium-to-large scale applications such as dependency management, transaction integrity, and data leakage prevention.
The framework focuses on Engineered Simplicity. It abstracts complex patterns like the Unit of Work and Scoped Inversion of Control into intuitive interfaces, allowing you to focus on your domain logic while the framework ensures that your database transactions are atomic and your sensitive data remains restricted based on the execution context.
Why Choose ZCore?
ZCore was designed to bridge the gap between "writing an endpoint" and "building a maintainable system."
| Feature | Standard FastAPI Challenge | The ZCore Approach |
|---|---|---|
| Dependency Injection | Manual wiring and complex Depends chains. |
Automated Scoped IoC with constructor injection. |
| Data Security | Manual filtering of Pydantic models for different users. | Context-aware Response Pruning via ResponseProjector. |
| Transactions | Scatterred .commit() calls leading to partial failures. |
Centralized Unit of Work (UOW) for atomic operations. |
| Project Structure | Inconsistent layouts across different teams. | Modular Plugin System and standardized CLI scaffolding. |
| Search & Filter | Writing repetitive boilerplate for every query. | A secure, dynamic Search Engine with depth-limit protection. |
The Request Lifecycle
Understanding how a request travels through ZCore is key to mastering its architecture. The following diagram illustrates the automated orchestration from the moment a request hits the server to the final pruned response.
sequenceDiagram
participant C as Client
participant M as Middlewares
participant R as ZCoreAPIRoute
participant S as Service & UOW
participant D as Database
participant P as ResponseProjector
C->>M: HTTP Request
Note over M: Generate Correlation ID<br/>Initialize Scoped DI
M->>R: Route Handled
Note over R: Schema Analysis<br/>Restricted Field Lookup
R->>S: Invoke Business Logic
S->>D: DB Operations (via Repository)
Note over S: Atomic Commit via Unit of Work
D-->>S: Record Persisted
S-->>R: Return Domain Model
R->>P: Data Sanitization
Note over P: Prune Restricted Fields<br/>(e.g., owner_id, internal_notes)
P-->>R: Clean Data
R-->>C: JSON Response (Pruned)
⚡ Quick Start
1. Installation
Set up a clean virtual environment and install ZCore with all optional dependencies:
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
pip install fastapi-zcore-framework[all]
2. Scaffold a Project
Initialize your project and generate a structured domain module using our command-line utility:
# Initialize project workspace
zc init product_api
cd product_api
# Scaffold a domain app with boilerplate templates
zc startapp products -t
3. Run the Development Server
Launch the local Uvicorn development server:
zc run
📚 Core Pillars at a Glance
- ⚡ Scoped IoC Container: Manage object lifecycles (Singleton, Transient, or Scoped) with ease. Scoped dependencies are automatically cleared at the end of every HTTP request to prevent memory pollution.
- 🛡️ Secure Search Engine: A dynamic query builder that supports nested filters and eager-loading, while automatically blocking access to restricted database columns based on security policies.
- 🔗 Unit of Work (UOW): Ensures that business operations succeed or fail as a single unit. It coordinates database flushes and delays event dispatching until the transaction is successfully committed.
- 🏗️ Modular Plugin System: Organize your application into decoupled domains. Each plugin manages its own lifecycle hooks (
on_startup,on_shutdown) and can declare dependencies on other plugins.
📖 Documentation & Learning
To explore the full capabilities of ZCore, please refer to our online documentation:
[!NOTE] [Getting Started Guide] - Step-by-step tutorial to build your first service.
[!TIP] [Architectural Concepts] - Understand the inner mechanics of our Scoped DI, UOW, and the Core Kernel.
[!IMPORTANT] For production environments, remember to generate a secure secret key using the
zc gensecretCLI command and update your.envconfiguration file.
ZCore is licensed under the Apache License 2.0. Built with ☕ and architectural rigor.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fastapi_zcore_framework-0.1.0b1.tar.gz.
File metadata
- Download URL: fastapi_zcore_framework-0.1.0b1.tar.gz
- Upload date:
- Size: 334.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5812b8d23d2b012ea522b9afb6bad077bf1652c82d9086d1019b79e800fc8a51
|
|
| MD5 |
a1e0af775b764ed4bed07ec2133c0f08
|
|
| BLAKE2b-256 |
a055a6acec77140294a138c6ed3678b9bd54e85694042802f3503c3dc63980dc
|
Provenance
The following attestation bundles were made for fastapi_zcore_framework-0.1.0b1.tar.gz:
Publisher:
publish.yml on fastapi-zcore-framework/zcore
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fastapi_zcore_framework-0.1.0b1.tar.gz -
Subject digest:
5812b8d23d2b012ea522b9afb6bad077bf1652c82d9086d1019b79e800fc8a51 - Sigstore transparency entry: 2085118582
- Sigstore integration time:
-
Permalink:
fastapi-zcore-framework/zcore@f14baecb38759900dacbc94f23261f9a18349471 -
Branch / Tag:
refs/tags/v0.1.0-beta.1 - Owner: https://github.com/fastapi-zcore-framework
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f14baecb38759900dacbc94f23261f9a18349471 -
Trigger Event:
push
-
Statement type:
File details
Details for the file fastapi_zcore_framework-0.1.0b1-py3-none-any.whl.
File metadata
- Download URL: fastapi_zcore_framework-0.1.0b1-py3-none-any.whl
- Upload date:
- Size: 82.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f9a3d68883d81515db41b466b8fed875abcaf9faa45ca9d2599a3ffbc266491a
|
|
| MD5 |
11a68c67a944a3e3c69bad70edaa285a
|
|
| BLAKE2b-256 |
f7ce6c37cc11442da7712ccad84261beb89ec37d51f8652b6cedd69fe0b1cc52
|
Provenance
The following attestation bundles were made for fastapi_zcore_framework-0.1.0b1-py3-none-any.whl:
Publisher:
publish.yml on fastapi-zcore-framework/zcore
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fastapi_zcore_framework-0.1.0b1-py3-none-any.whl -
Subject digest:
f9a3d68883d81515db41b466b8fed875abcaf9faa45ca9d2599a3ffbc266491a - Sigstore transparency entry: 2085118595
- Sigstore integration time:
-
Permalink:
fastapi-zcore-framework/zcore@f14baecb38759900dacbc94f23261f9a18349471 -
Branch / Tag:
refs/tags/v0.1.0-beta.1 - Owner: https://github.com/fastapi-zcore-framework
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f14baecb38759900dacbc94f23261f9a18349471 -
Trigger Event:
push
-
Statement type: