Back to projects

Project case study

Library Studio

Asynchronous book catalogue API in FastAPI, with paginated search, ISBN metadata and a demonstration web interface.

My roleBack-end development
Technologies used
  • FastAPI
  • Python
  • SQLAlchemy
  • SQLite
  • Pydantic
  • Jinja2
  • pytest
Library Studio with the collection counters, the book search and the filters.
library-api-advanced.vercel.app / Home page

Problem

Registering books by hand means retyping metadata that already exists in public databases, and a write API open on the internet becomes a target for abuse.

Solution

Architecture at a glance
  • Books stored by the API itself, with a seed of 14 real books in the demo.
  • OpenLibrary metadata looked up by ISBN, with a 24 h cache.
OpenAPI documentation with the book and health endpoints.
OpenAPI documentation with the book and health endpoints.
Technical decisions
  1. API, Service and Repository layers over asynchronous SQLAlchemy models, with Pydantic DTOs.
  2. Search by title or author, year and year range, with sorting, pagination and the total in the X-Total-Count header.
  3. ISBN lookup on OpenLibrary with a 5 s timeout and check-digit validation before the request.

Result

pytest test functions
41
Private repository / static count in tests/ / commit 0199d76
Books in the demo seed
14
Published demo / X-Total-Count from GET /api/v1/books/ / 13 Oct 2026

The project shows a small foundation API with real protections for being open on the internet.

  • Layered asynchronous REST API
  • Input validation
  • Abuse protections
  • Tests with a mocked external service

Learnings and limitations

  • In the demo the database is SQLite in /tmp: it returns to the seed on every cold start and may differ between instances.
  • There is no authentication; writes are protected by the rate limit and the switch that turns them off.
  • There is no lending flow and no versioned migrations.

More about the project

Full case details, collapsed for optional reading.

Full description

Library Studio is an asynchronous book catalogue API in FastAPI, with a web interface served by the application itself.

Search combines title or author, year and year range, sorts, paginates and returns the total in the X-Total-Count header.

Registration validates the ISBN and fills in metadata from OpenLibrary, with a 5 s timeout and a 24 h cache.

To stay open on the internet, the API limits writes per IP, request body and collection size, and can switch writes off.

FastAPI with asynchronous SQLAlchemy and SQLite, Pydantic, Jinja2 for the interface and pytest with OpenLibrary mocked.

Features and highlights
  • Full book CRUD.
  • Paginated search with sorting and year filters.
  • Metadata filled in from the ISBN.
  • OpenAPI documentation at /docs and /redoc.
  • Web interface with collection counters.
  • Validates the ISBN by its check digit before calling OpenLibrary, with a 5 s timeout and a 24 h cache.
  • Rate-limits writes per IP in a sliding window, with bodies of up to 16 KB and a switch that turns writes off.
  • Returns X-Request-Id and X-Process-Time on every response and the paginated total in X-Total-Count.
Technical architecture and data
  • Per-IP sliding-window rate limit, a 16 KB body limit and a switch that turns writes off.
  • Separate CSP for the application and for the OpenAPI documentation.

Technical architecture

How the case was designed as a product

Asynchronous book catalogue API in FastAPI, with paginated search, ISBN metadata and a demonstration web interface.

FastAPIFrameworkPythonLanguageSQLAlchemyDatabaseSQLiteDatabasePydanticFrameworkJinja2FrameworkpytestFramework

Data used

  • Books stored by the API itself, with a seed of 14 real books in the demo.
  • OpenLibrary metadata looked up by ISBN, with a 24 h cache.

Core components

  • Full book CRUD.
  • Paginated search with sorting and year filters.
  • Metadata filled in from the ISBN.
  • OpenAPI documentation at /docs and /redoc.
  • Web interface with collection counters.

Technical decisions

  • Layered asynchronous REST API
  • Input validation
  • Abuse protections
  • Tests with a mocked external service

Trade-offs

  • In the demo the database is SQLite in /tmp: it returns to the seed on every cold start and may differ between instances.
  • There is no authentication; writes are protected by the rate limit and the switch that turns them off.
  • There is no lending flow and no versioned migrations.
How to run
  1. The repository is private; the steps below apply to anyone with access.
  2. python -m venv .venv and activate the environment.
  3. pip install -r requirements.txt
  4. uvicorn app.main:app --reload
  5. pytest
Credits

Developed by Matheus Siqueira - https://www.matheusdev.tech

Next projectNotes Manager

Notes app that saves in the browser, with no account, in-place editing and versioned data migration.

View full case