Docs / fastkit-core / Overview

FastKit Core

A lightweight toolkit that adds structure and common patterns to FastAPI. Not a framework, not a replacement — just FastAPI with batteries included.

Open Source MIT License Python 3.11+ FastAPI ≥ 0.115 SQLAlchemy 2.0+ AI-Ready

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:

Repository Pattern

Clean data access layer with Django-style query operators.

Service Layer

Business logic with before/after lifecycle hooks.

Multi-language Support

Built into models and translation files from day one.

Validation

Structured, translated error messages ready for your frontend.

HTTP Utilities

Standardized API responses and exception handling.

Async / Sync Support

Full async support with complete feature parity.

Caching

InMemory & Redis backends, @cached decorator, pattern invalidation.

Events

Signal system to decouple side effects from business logic.

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:

Faster Development
Stop building infrastructure. Start building features. The architecture is already there, already tested, already standardized.
Production Ready
Patterns proven in real-world applications, not experimental code. 92% test coverage across all packages.
TranslatableMixin
Effortless multi-language model support — a unique feature that's difficult to implement cleanly from scratch.
Zero Vendor Lock-in
Pure FastAPI underneath. Use what you need, skip what you don't. No magic, no hidden dependencies.
Great Developer Experience
Inspired by Laravel and Django, built for FastAPI's modern Python. Familiar patterns in a fresh context.

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.

AI-Ready by Design

We believe software development should be a creative and enjoyable process. FastKit Core ships with AI_CONTEXT.md — a precision-crafted context file that gives AI coding agents complete knowledge of FastKit's patterns, conventions, and best practices.

Instead of spending time explaining your stack to an agent, you configure it once and your agent becomes a FastKit expert immediately — generating architecturally correct modules, using the right patterns, following the right conventions.

Verified Against Real Code

Every snippet in AI_CONTEXT.md is verified against the actual source and real project examples — no hallucinated APIs.

Zero Learning Curve for Agents

Claude Code and Cursor can scaffold complete modules with CRUD, pagination, and events without any prior FastKit knowledge.

Always in Sync

AI_CONTEXT.md is versioned and updated with every release — your agent always works with the latest patterns.

Setup for Claude Code

No existing CLAUDE.md in your project:

bash
echo '@AI_CONTEXT.md' > CLAUDE.md

Already have a CLAUDE.md — add one line at the top:

markdown
@AI_CONTEXT.md

# rest of your existing CLAUDE.md...

Setup for Cursor

No existing rules file:

bash
mkdir -p .cursor/rules
echo 'Apply all conventions from @AI_CONTEXT.md' > .cursor/rules/fastkit.mdc

Already have Cursor rules — add to your existing .cursor/rules/*.mdc:

text
Apply all conventions from @AI_CONTEXT.md

A Quick Look

Here's what FastKit Core looks like in action compared to raw FastAPI:

Without FastKit Core

python
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

python
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:

FastAPI Application
HTTP Layer
Responses, Exceptions, Middleware
Validation
Schemas, Error formatting
Service Layer
Business Logic · Hooks · Orchestration
Repository
Data access, Queries, Transactions
Translations
i18n, Locale context
Database Layer
Models · Mixins · SQLAlchemy

Modules

FastKit Core is organized into focused modules. Each can be used independently — use only what your project needs.