Skip to content

A complete CRUD system for book management, developed with FastAPI and SQLite, ready for Docker.

Notifications You must be signed in to change notification settings

Rodrigomattos93/CRUD_PROJECT

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📚 Books CRUD Project - FastAPI & SQLite

FastAPI Python SQLite Docker

A complete CRUD system for managing books, developed with FastAPI and SQLite, Docker-ready.

Features

  • Full CRUD operations (Create, Read, Update, Delete)
  • Data validation with Pydantic
  • SQLite database
  • Logging with Loguru
  • Automatic documentation (Swagger UI and Redoc)
  • Ready for containerization with Docker

Technologies Used

  • Python
  • FastAPI
  • SQLAlchemy
  • Pydantic
  • Uvicorn
  • SQLite
  • Poetry
  • Docker
  • Loguru
  • Git

Getting started

Prerequisites

  • Python 3.12+
  • Poetry (Dependency manager)
  • Docker (optional)

Installation

git clone https://github.com/Rodrigomattos93/projeto_crud.git
cd projeto_crud

Running the Project

Locally:

poetry install --no-root
poetry env activate
uvicorn app.main:app --reload

With Docker:

docker build -t livro-crud .
docker run -d --name livro-crud -p 8000:8000 livro-crud

Documentation

The API documentation will be available at:

- Swagger UI: `http://localhost:8000/docs`
- Redoc: `http://localhost:8000/redoc`

API Endpoints

Método HTTP Endpoint Descrição
GET /books/ List all books
GET /books/{id} Gets a specific book
POST /books/ Creates a new book
PUT /books/{id} Update an existing book
DELETE /books/{id} Delete a book

Data Model

class BookModel(Base):
    __tablename__ = "books"
    
    id = Column(Integer, primary_key=True, index=True)
    title = Column(String, index=True)
    author = Column(String, index=True)
    publication_year = Column(Integer, nullable=True)
    genre = Column(String, nullable=True)
    publisher = Column(String, nullable=True)
    page_count = Column(Integer, nullable=True)
    description = Column(String, nullable=True)
    is_avaiable = Column(Boolean)
    created_at = Column(DateTime, default=func.now())

Project Structure

├── app/
│   ├── controllers.py    # Lógica de negócios
│   ├── db.py             # Configuração do banco
│   ├── logger_config.py  # Configuração de logs
│   ├── main.py           # Ponto de entrada
│   ├── models.py         # Modelos do banco
│   ├── routers.py        # Endpoints
│   └── schemas.py        # Validação
├── Dockerfile            # Config Docker
├── pyproject.toml        # Dependências
├── books.db              # Banco de dados
└── README.md             # Documentação

Deploy

The application is hosted on Render and can be accessed at the following link

About

A complete CRUD system for book management, developed with FastAPI and SQLite, ready for Docker.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages