Skip to content

Jayasurya003/Bookstore_FastAPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“š FastAPI Bookstore API

A simple REST API built with FastAPI to manage a bookstore. This project includes full CRUD functionality and demonstrates use of path/query parameters, Pydantic validation, and Pipenv for dependency management.


πŸš€ Features

  • βœ… Get all books with optional author filtering
  • βœ… Get a book by its ID
  • βœ… Add a new book (with duplicate ID prevention)
  • βœ… Update an existing book
  • βœ… Delete a book
  • βœ… Validation for rating (must be between 0 and 5)
  • βœ… Price field included
  • βœ… Built using Pipenv for clean dependency management

πŸ“¦ Technologies Used


πŸ”§ Installation

1. Clone the repository

git clone https://github.com/Jayasurya003/Bookstore_FastAPI.git
cd Bookstore_FastAPI

2. Install dependencies using Pipenv

pipenv install

3. Activate the virtual environment

pipenv shell

▢️ Running the App

uvicorn main:app --reload
  • Go to: http://127.0.0.1:8000
  • Use the interactive docs: http://127.0.0.1:8000/docs

πŸ“¬ API Endpoints

Method Endpoint Description
GET /books Get all books (with optional author filter)
GET /books/{book_id} Get one book by its ID
POST /books Add a new book
PUT /books/{book_id} Update an existing book
DELETE /books/{book_id} Delete a book

πŸ“Œ Notes

  • rating must be a float between 0 and 5 (validated with confloat)
  • Prevents adding books with duplicate id
  • Uses Optional fields like description and rating for flexibility

πŸ§ͺ Future Improvements

  • Add persistence (e.g., database integration)
  • Add authentication
  • Add pagination or search filtering

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages