A simple REST API built with FastAPI to perform CRUD operations on User entities.
- ✅ CRUD operations for Users
- ✅ PostgreSQL with SQLAlchemy ORM
- ✅ Pydantic validation
- ✅ Unique constraints on email and phone
- ✅ Standard HTTP status codes
- FastAPI (Python 3.9+)
- PostgreSQL
- SQLAlchemy
- Pydantic
- Uvicorn
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
uvicorn app.main:app --reloadAPI available at http://localhost:8000
CREATE DATABASE fastapi_db;
Edit .env with your database credentials:
DATABASE_URL=postgresql://postgres:postgres@localhost:5432/fastapi_db
python-fastapi-postgres/
├── app/
│ ├── main.py # FastAPI app entry point
│ ├── database.py # Database configuration
│ ├── models.py # SQLAlchemy models
│ ├── schemas.py # Pydantic schemas
│ ├── crud.py # CRUD operations
│ └── routers/
│ └── users.py # User endpoints
├── requirements.txt
├── .env.example
└── README.md