This repository is a proof of concept for an application stack that drastically minimized the code needed to handle CRUD opetations. It levereages the great PostgREST on a Python stack powered by Pydantic with SQLModel and FastAPI.
It implements an Herbal Tea classification web application based on EMA HMPC data.
The main idea is to simply declare the Data Definition Language in Python, then SQLModel and PostgREST will automatically build the CRUD API. Thanks to Pydantic integration, the schema of resources served by the CRUD API can be seamlessly used in other Python-based services, especially with FastAPI.
The code is structured following the Clean Architecture principles. All the entities are describe as Pydantic models. With a very little code, those entities definition are used to build the PostgREST service.
To make data operations even simpler, this stack leverages other useful tools, including:
- React Admin for data administration, helped by the PostgREST Data Provider For React-Admin (
tools/react/admin
folder). - Magic Link authentication service to avoid deal with passwords.
- An auth API (
tools/fastapi/auth-api
folder) based on FastAPI that transforms magic.link token into JWT (required by PostGREST). - An CLI app using Typer (
herbaltea-classifier/herbaltea_classifier/adapters/cli.py
). - Terraform scripts to deploy on Scaleway (
tools/terraform
).