This repository is a FastAPI-based REST backend that uses SQLAlchemy for ORM, Pydantic (via pydantic_settings) for configuration, and PostgreSQL for data persistence.
Alembic is included for database schema migrations.
The application is structured in modular routers (for posts, users, authentication, and votes), providing clear separation of concerns and easy scalability.
| Component | Purpose | 
|---|---|
| Python 3.13.2 | Core programming language | 
| FastAPI | Web framework for building APIs | 
| Uvicorn | ASGI server for running the FastAPI app | 
| SQLAlchemy | ORM layer for database interaction | 
| PostgreSQL | Relational database | 
| Alembic | Database migrations | 
| Pydantic Settings | Environment variable management | 
| Docker + docker-compose | Containerized setup for reproducible environments | 
The app reads configuration values using Pydantic Settings (from app/config.py), typically loaded from a .env file.
| Variable | Description | 
|---|---|
| DATABASE_HOSTNAME | Hostname for the database (e.g., postgres) | 
| DATABASE_PORT | Database port (default: 5432) | 
| DATABASE_USERNAME | Database username | 
| DATABASE_PASSWORD | Database password | 
| DATABASE_NAME | Database name | 
| SECRET_KEY | Secret key for JWT token signing | 
| ALGORITHM | Algorithm used for JWT (e.g., HS256) | 
| ACCESS_TOKEN_EXPIRE_MINUTES | JWT token expiry in minutes | 
⚠️ Do NOT commit this file. It should be listed in.gitignore.
DATABASE_HOSTNAME=postgres
DATABASE_PORT=5432
DATABASE_USERNAME=postgres
DATABASE_PASSWORD=password123
DATABASE_NAME=fastapi
SECRET_KEY=replace_with_real_secret_key
ALGORITHM=HS256
ACCESS_TOKEN_EXPIRE_MINUTES=30Create and activate a virtual environment:
python -m venv venv
venv\Scripts\activateInstall dependencies
pip install -r requirements.txtSet environment variables (or use a .env file in the project root).
Run the FastAPI app
uvicorn app.main:app --reloadApp will be available at 👉 http://127.0.0.1:8000