A simple FastAPI + PostgreSQL CRUD starter project using SQLModel and psycopg.
This repo includes an employee table example and basic endpoints to Create (POST) and Read (GET) employees, tested via Swagger UI.
Full tutorial (step-by-step guide):
https://thirdygayares.com/FastAPI/how-to-connect-fastapi-to-postgres
- FastAPI REST API
- PostgreSQL database connection (psycopg)
- SQLModel ORM models
- CRUD endpoints:
GET /employees– fetch all employeesPOST /employees– create an employee
- Swagger Docs:
http://127.0.0.1:8000/docs
- Python 3.10+ (recommended)
- PostgreSQL installed and running
pip install fastapi sqlmodel psycopg uvicorn