- JWT Authentication & Authorization: Secure user registration, login, token refreshing, and role-based access control (Admin/User).
- Books Management: Full CRUD operations for books.
- Reviews: Users can read, leave, and manage reviews for distinct books.
- Tags System: Categorize books using distinct tags.
- Redis Blocklisting: Invalidated/revoked JWT tokens are securely stored in Redis.
- Asynchronous DB: High-performance interactions using
asyncpgand SQLAlchemy/SQLModel.
- Framework: FastAPI
- Database: PostgreSQL (with
asyncpg) - ORM & Migrations: SQLModel / SQLAlchemy / Alembic
- Caching / Token Blocklist: Redis
- Dependency Management:
uv(Fastest Python package manager) - Security: Passlib (Bcrypt), PyJWT
git clone https://github.com/your-username/project-new.git
cd project-newCopy the example environment file and adjust the secrets:
cp .env.example .envUse Docker to easily start the database and caching layer:
docker-compose up -dUsing uv:
uv syncOr with standard pip if you exported the requirements:
pip install -r requirements.txtalembic upgrade head(Note: Current development setup automatically creates tables on startup, but production should use Alembic.)
Start the FastAPI server:
fastapi dev main.pyOr using uvicorn directly:
uvicorn main:app --reload --port 8010Once the server is running, the interactive API documentation is automatically accessible at:
- Swagger UI: http://127.0.0.1:8010/docs
- ReDoc: http://127.0.0.1:8010/redoc
/api/v1/auth/*: Registration, Login, Token Refresh, Logout/api/v1/books/*: CRUD operations for books (Create, Read, Update, Delete)/api/v1/reviews/*: CRUD logic for book reviews/api/v1/tags/*: Categorization system
This project is licensed under the MIT License.