Metadata-Version: 2.1
Name: fastapi-booster
Version: 0.1.1
Summary: 
Author: ulfaric
Author-email: ryf0510@live.com
Requires-Python: >=3.12,<4.0
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Requires-Dist: bcrypt (==4.0.1)
Requires-Dist: colorlog (>=6.8.2,<7.0.0)
Requires-Dist: fastapi[all] (>=0.112.1,<0.113.0)
Requires-Dist: passlib[bcrypt] (>=1.7.4,<2.0.0)
Requires-Dist: pyjwt (>=2.9.0,<3.0.0)
Requires-Dist: sqlalchemy (>=2.0.32,<3.0.0)
Description-Content-Type: text/markdown

# FastAPI Booster

FastAPI Booster is a library that provides a set of tools and utilities to enhance the development experience with FastAPI. It aims to streamline common tasks, provide additional functionality, and make the development process more efficient.

## Features

- **Authenticator**: Built-in support for JWT and HTTP Basic authentication.
- **Module**: Built-in support for Module, aka microservice with independent database and router.
- **Lifespan Manager**: Easy to manage the lifespan of the application, with `startup_function` and `shutdown_function` decorator.

## Example
```python
import uvicorn
from fastapi import Depends, FastAPI
from fastapi_booster.LifeSpanManager import lifespan
from fastapi_booster.Authenticator import JWT
from fastapi_booster.Module import Module
from sqlalchemy.orm import MappedColumn, mapped_column

# Create the FastAPI app with the lifespan manager
app = FastAPI(lifespan=lifespan)

# Create the JWT authenticator
jwt = JWT.JWT()

# Include the JWT router in the FastAPI app
app.include_router(jwt.router)

# Create the root route with the JWT authenticator
@app.get("/", dependencies=[Depends(jwt)])
async def root():
    return {"message": "Hello World"}

# Create the my_module
my_module = Module("my_module", "This is my module")

# Create the my_table
class my_table(my_module.model):
    __tablename__ = "my_table"
    id: MappedColumn[int] = mapped_column(primary_key=True)
    name: MappedColumn[str] = mapped_column()
    age: MappedColumn[int] = mapped_column()
    gender: MappedColumn[str] = mapped_column()

# Create the my_module root route
@my_module.router.get("/my_module")
async def my_module_root():
    return {"message": "Hello World from my_module"}

# Include the my_module router in the FastAPI app
app.include_router(my_module.router)


if __name__ == "__main__":
    uvicorn.run(app, host="0.0.0.0", port=8000)

```
