63 lines
1.4 KiB
Markdown
63 lines
1.4 KiB
Markdown
# 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
|
|
|
|
```bash
|
|
# Install dependencies
|
|
pip install -e ".[dev]"
|
|
|
|
# Run database migrations
|
|
alembic upgrade head
|
|
|
|
# Run the application
|
|
uvicorn app.main:app --reload
|
|
```
|
|
|
|
## Testing
|
|
|
|
```bash
|
|
# 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
|