FluxCRUD is a easy to use, fast, and modern CRUD framework for FastAPI.
Project description
Modern, High-Performance, Async-First CRUD Framework for FastAPI ⚡
FluxCRUD is a developer-friendly framework designed to eliminate boilerplate when building efficient, scalable APIs with FastAPI and SQLAlchemy 2.0. It provides a fully typed, async-first experience with built-in best practices like caching, N+1 query prevention (DataLoaders), and automatic extensive pagination.
✨ Features
- 🚀 Async & Fast: Built on top of
asyncpg,aiosqlite, andSQLAlchemy 2.0. - 🛠️ Zero Boilerplate: Auto-generates fully typed CRUD routes (Create, Read, Update, Delete, List).
- ⚡ Smart Caching: Integrated support for Redis, Memcached, and In-Memory caching.
- 🔍 Query Optimization: Built-in DataLoaders to solve N+1 query problems automatically.
- 📄 Advanced Pagination: Cursor-based and limit-offset pagination out of the box.
- 🛡️ Type Safe: Deep integration with Pydantic v2 for robust data validation.
- 📦 Modular: Use what you need—Router, Repository, or the full Framework.
📦 Installation
pip install fluxcrud
# OR with standard extras
pip install "fluxcrud[postgresql,redis]"
🚀 Quick Start
Build a comprehensive API in less than 30 lines of code.
from fastapi import FastAPI
from sqlalchemy.orm import Mapped, mapped_column
from pydantic import BaseModel
from fluxcrud import Flux, Base
# 1. Define your Database Model
class Item(Base):
__tablename__ = "items"
id: Mapped[int] = mapped_column(primary_key=True)
name: Mapped[str]
price: Mapped[float]
# 2. Define Pydantic Schemas
class ItemSchema(BaseModel):
id: int
name: str
price: float
class CreateItemSchema(BaseModel):
name: str
price: float
# 3. Initialize App & Flux
app = FastAPI()
flux = Flux(app, db_url="sqlite+aiosqlite:///:memory:")
flux.attach_base(Base)
# 4. Register Routes
# Auto-generates: GET /items, POST /items, GET /items/{id}, PATCH /items/{id}, DELETE /items/{id}
flux.register(
model=Item,
schema=ItemSchema,
create_schema=CreateItemSchema
)
Run it locally:
uvicorn main:app --reload
🧩 Advanced Usage
Customizing the Repository
Need custom logic? Extend FluxRepository seamlessly.
from fluxcrud.core import FluxRepository
class ItemRepository(FluxRepository[Item]):
async def get_expensive_items(self, min_price: float):
query = select(Item).where(Item.price > min_price)
return await self.all(query)
Enabling Caching
FluxCRUD makes caching trivial.
from fluxcrud.cache import RedisBackend
# Configure Redis cache with 60s TTL
flux = Flux(
app,
db_url="...",
cache_backend=RedisBackend("redis://localhost"),
cache_ttl=60
)
🤝 Contributing
We welcome contributions! Please check out our Contributing Guide to get started.
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
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 fluxcrud-0.1.1.tar.gz.
File metadata
- Download URL: fluxcrud-0.1.1.tar.gz
- Upload date:
- Size: 17.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a6888574d65f531f766296761684b49fe1b56de8d997cc14797572742cfc3a43
|
|
| MD5 |
3a7734a31528cb5f9510f329737001e3
|
|
| BLAKE2b-256 |
624ae79d8344e44702ea73a79c0e660dc83d76e4c6fa7d218357a940fe1ecd3e
|
File details
Details for the file fluxcrud-0.1.1-py3-none-any.whl.
File metadata
- Download URL: fluxcrud-0.1.1-py3-none-any.whl
- Upload date:
- Size: 25.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f7cc50828da2b2795ec62962975a7212564efb69e512a266818b1bed146f6b80
|
|
| MD5 |
bf93933641cd2b2cea2ccb9208169d45
|
|
| BLAKE2b-256 |
2ecda682138a49bc60b451a34e558bf4a445cd973548aea2f85754baf892250c
|