1.4 KiB
1.4 KiB
Instagram Clone API
A FastAPI-based Instagram clone API with SQLAlchemy 2.0 and Alembic migrations.
Tech Stack
- Framework: FastAPI 0.109+
- ORM: SQLAlchemy 2.0
- Database: SQLite (dev), PostgreSQL (prod)
- Migrations: Alembic
- Testing: pytest + httpx
Project Structure
instagram-clone/
├── app/
│ ├── api/
│ │ ├── endpoints/ # API route handlers
│ │ └── dependencies/ # FastAPI dependencies
│ ├── core/ # Configuration and settings
│ ├── db/ # Database connection and models
│ ├── models/ # SQLAlchemy models
│ ├── schemas/ # Pydantic schemas
│ ├── services/ # Business logic
│ └── utils/ # Utility functions
├── alembic/ # Database migrations
├── tests/
│ ├── unit/ # Unit tests
│ └── integration/ # Integration tests
├── pyproject.toml
└── alembic.ini
Setup
# Install dependencies
pip install -e ".[dev]"
# Run database migrations
alembic upgrade head
# Run the application
uvicorn app.main:app --reload
Testing
# Run all tests
pytest
# Run with coverage
pytest --cov=app tests/
API Documentation
Once running, visit:
- Swagger UI: http://localhost:8000/docs
- ReDoc: http://localhost:8000/redoc