FastKit Core
A lightweight toolkit that adds structure and common patterns to FastAPI. Not a framework, not a replacement — just FastAPI with batteries included.
Introduction
FastKit Core is an open-source, lightweight toolkit developed for the FastAPI framework. It provides common patterns, code structure, and infrastructure solutions following modern Python and FastAPI conventions.
We believe that software development is an enjoyable and creative experience, so developers should focus on building features, not infrastructure. That is only possible when developers have standardized, well-tested, and reliable infrastructure. FastKit Core provides the patterns and structure so you can do exactly that.
FastAPI is fast and flexible by design, but it is intentionally minimal — you build the structure yourself. FastKit Core provides that structure with production-ready patterns:
Clean data access layer with Django-style query operators.
Business logic with before/after lifecycle hooks.
Built into models and translation files from day one.
Structured, translated error messages ready for your frontend.
Standardized API responses and exception handling.
Full async support with complete feature parity.
Not a framework. Not a replacement. Just FastAPI with structure — inspired by Laravel's developer experience and Django's patterns, built specifically for FastAPI.
Who is FastKit Core for?
FastKit Core is built for developers who need proven patterns and consistent structure in their FastAPI projects.
Coming from Laravel or Django
- You love the structure and developer experience, but need FastAPI's performance
- You want familiar concepts — repositories, services, mixins — in modern Python
- You're tired of rebuilding the same patterns from scratch in every new project
Building Production Applications
- You need consistent, maintainable code structure across your team
- You want proven patterns, not experimental approaches
- You're building multi-language applications or complex business logic
Leading Development Teams
- You need to standardize how your team builds FastAPI applications
- You want faster onboarding and more consistent code reviews
- You're tired of every developer having their own architectural approach
FastKit Core is not for you if you prefer building everything from scratch, are building simple CRUD APIs with no business logic, or only need basic FastAPI features — FastAPI alone is perfect for that!
Why FastKit Core?
The Problem
When building FastAPI applications, you quickly face the same questions on every project:
- How should I structure my project?
- Where do repositories go? Do I even need them?
- How do I organize business logic?
- How do I handle multi-language content in my models?
- How do I format validation errors consistently for the frontend?
- How do I standardize API responses across the whole team?
Every team solves these differently, leading to inconsistent, hard-to-maintain codebases.
The Solution
FastKit Core provides battle-tested patterns so you don't reinvent the wheel on every project:
Performance
FastKit Core adds only 3–4ms overhead compared to raw FastAPI while providing a complete infrastructure layer.
| Metric | Native FastAPI | FastKit Core | Impact |
|---|---|---|---|
| Throughput | 695 RPS | 685 RPS | −1.5% |
| Avg Response | 6.0ms | 9.4ms | +3.4ms |
| Median Response | 5ms | 8ms | +3ms |
Benchmark: 60s duration · 100 concurrent users · PostgreSQL 16 · same Python process.
Less than 2% overhead in production — a perfect balance of performance and developer productivity.
A Quick Look
Here's what FastKit Core looks like in action compared to raw FastAPI:
Without FastKit Core
from fastapi import FastAPI, Depends
from sqlalchemy.orm import Session
from database import get_db
from models import User
app = FastAPI()
@app.get("/users")
def list_users(skip: int = 0, limit: int = 20, db: Session = Depends(get_db)):
users = db.query(User).offset(skip).limit(limit).all()
return {
"data": [
{"id": u.id, "name": u.name, "email": u.email}
for u in users
]
}
With FastKit Core
from fastapi import FastAPI, Depends
from fastkit_core.http import paginated_response
from services import UserService, get_user_service
app = FastAPI()
@app.get("/users")
def list_users(
page: int = 1,
per_page: int = 20,
service: UserService = Depends(get_user_service)
):
users, meta = service.paginate(page=page, per_page=per_page)
return paginated_response(items=users, pagination=meta)
Notice: cleaner code, built-in pagination with metadata, standardized response format, reusable service layer — and it's still just FastAPI underneath.
Architecture Overview
FastKit Core organizes your application into clear, well-defined layers. Each layer has a single responsibility:
Modules
FastKit Core is organized into focused modules. Each can be used independently — use only what your project needs.
System requirements, pip, uv, Poetry, database drivers.
Build a complete Todo API in 5 minutes.
Environment variables, config modules, multiple environments.
Base models, mixins, repository pattern, async support, TranslatableMixin.
BaseCrudService, lifecycle hooks, async services, validation hooks.
BaseSchema, validator mixins, translated error messages.
Response formatters, exceptions, middleware, pagination.
JSON translation files, locale detection, fallback support.