Skip to content

Repository files navigation

📚 Bookly API

A fast, modern RESTful API for managing books, reviews, and tags.

FastAPI Python PostgreSQL Redis Alembic

✨ Features

  • 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 asyncpg and SQLAlchemy/SQLModel.

🛠️ Tech Stack

  • 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

🚀 Getting Started

Prerequisites

  • Docker and Docker Compose
  • uv or standard Python pip

1. Clone the repository

git clone https://github.com/your-username/project-new.git
cd project-new

2. Set up environment variables

Copy the example environment file and adjust the secrets:

cp .env.example .env

3. Spin up PostgreSQL and Redis (Docker Compose)

Use Docker to easily start the database and caching layer:

docker-compose up -d

4. Install Dependencies

Using uv:

uv sync

Or with standard pip if you exported the requirements:

pip install -r requirements.txt

5. Apply Database Migrations (if applicable)

alembic upgrade head

(Note: Current development setup automatically creates tables on startup, but production should use Alembic.)

6. Run the Application

Start the FastAPI server:

fastapi dev main.py

Or using uvicorn directly:

uvicorn main:app --reload --port 8010

📖 API Documentation

Once the server is running, the interactive API documentation is automatically accessible at:

Core Endpoints Overview

  • /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

📄 License

This project is licensed under the MIT License.

About

High-performance Book Management API featuring JWT Authentication, role-based access control, and asynchronous database interactions.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages