fastapi-async-storages
A powerful, extensible, and async-ready cloud object storage backend for FastAPI.
Drop-in, plug-and-play cloud storage for your FastAPI apps; with full async support.
Inspired by fastapi-storages, built on modern async patterns using aioboto3.
Features
- Fully asynchronous storage interface designed for FastAPI applications
- Async S3 backend powered by aioboto3
- SQLAlchemy and SQLModel integration
- Typed and extensible design
- Supports FastAPI dependency injection
Installation
uv add fastapi-async-storages
# for s3 support:
uv add "fastapi-async-storages[s3]"
Documentation
Full documentation is available on:
https://fastapi-async-storages.readthedocs.io
Example: FastAPI
from fastapi import FastAPI, UploadFile
from sqlalchemy import Column, Integer
from sqlalchemy.ext.asyncio import create_async_engine, AsyncSession
from sqlalchemy.orm import sessionmaker, declarative_base
from async_storages import S3Storage
from async_storages.integrations.sqlalchemy import FileType
Base = declarative_base()
app = FastAPI()
storage = S3Storage(...)
engine = create_async_engine("sqlite+aiosqlite:///test.db", echo=True)
# create AsyncSession factory
AsyncSessionLocal = sessionmaker(engine, class_=AsyncSession, expire_on_commit=False)
class Example(Base):
__tablename__ = "example"
id = Column(Integer, primary_key=True)
file = Column(FileType(storage=storage))
# create tables inside an async context
@app.on_event("startup")
async def startup():
async with engine.begin() as conn:
await conn.run_sync(Base.metadata.create_all)
@app.post("/upload/")
async def create_upload_file(file: UploadFile):
file_name = f"uploads/{file.filename}"
# upload before commit due to the sqlalchemy binding being sync
await storage.upload(file.file, file_name)
example = Example(file=file)
async with AsyncSessionLocal() as session:
session.add(example)
await session.commit()
return {"filename": example.file.name}
License
Metadata
Release files for fastapi-async-storages 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| fastapi_async_storages-0.1.4.tar.gz | 7.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| fastapi_async_storages-0.1.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 17.2 kB
Release files / fastapi_async_storages-0.1.4.tar.gz
| Download URL | fastapi_async_storages-0.1.4.tar.gz |
|---|---|
| Size | 7.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
569e19b060fb14841fc00b46c948a4c86832d40e47e7f92403b43765124a82cf
|
|
BLAKE2b-256 checksum How to use checksums |
00b46ce7e755c87efeb4306e93c27b096ca8eac442423125fd800c7a3b8cf11c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / fastapi_async_storages-0.1.4-py3-none-any.whl
| Download URL | fastapi_async_storages-0.1.4-py3-none-any.whl |
|---|---|
| Size | 9.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cc85e69d1dcf068f1dbe5a2a2395371fc72f15ff767f0c7811418389b00e8ac5
|
|
BLAKE2b-256 checksum How to use checksums |
27cfefb628a3f7bc94f3a403a84ab933e1e568b1b42cb8ff55f11e322ca23889
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|