Skip to content

RafaelEmery/rafood-api

Repository files navigation

RaFood API

FastAPI project to manage restaurants, products and offers 🍔

Table of Contents

About the project

It was based on this backend challenge and a opportunity to learn and apply some concepts of FastAPI.

My inicial studies of FastAPI is at fastapi-studies repository

Tools used 🔨

  • Python (3.10.7)
  • Poetry
  • FastAPI
  • SQLModel & Alembic
  • Pytest
  • PostgreSQL
  • Docker & Docker Compose
  • Prometheus & Grafana

ER Model

er-model

Contexts

Based on the ER Model there are 5 folder to separate contexts:

  • Restaurants and restaurant schedules
  • Products
  • Offers and offers schedules
  • Categories
  • Users

Architecture Decision Records (ADRs)

The ADRs are at adr/ folder and documents the main decisions of this project.

Swagger

FastAPI generates an OpenAPI docs on /docs endpoint.

Monitoring

More about monitoring setup can be found at docs/monitoring.md.

Running the API 🏃

To show all Makefile commands:

make help

To install Python and Pyenv:

pyenv install 3.10.7

pyenv virtualenv 3.10.7 rafood-api

pyenv activate rafood-api

To install the application:

make build

To run the API and dependencies with Docker:

make start

To stop the API and dependencies:

make stop

You can also use restart and build commands.

To check API logs:

make logs

Alembic migrations

To create a new revision (migration file based on the models definitions):

make create-migration name=<revision-name>

To migrate or rollback

make migrate

make rollback

Linter

The pre-commit is enable to run linter before each commit, but you can run any time. To run linter manually:

make lint

Tests

To run tests with pytest:

make test

Be sure to have database container running with make start


Made for studies by RafaelEmery

About

FastAPI project to manage restaurants, products and offers 🍔

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages