An open API service indexing awesome lists of open source software.

https://github.com/sachingupta0019/fastapi-instagram

Instagram Clone App
https://github.com/sachingupta0019/fastapi-instagram

fastapi fastapi-crud fastapi-docker fastapi-framework fastapi-sqlalchemy fastapi-users jwt jwt-authentication oauth2 postgresql sqlalchemy-orm

Last synced: 24 days ago
JSON representation

Instagram Clone App

Awesome Lists containing this project

README

          

# πŸ“Έ FastAPI Instagram Clone API

A backend API built with **FastAPI** that mimics Instagram’s core features such as authentication, posting images, liking, and commenting.

---

## πŸš€ Features

* User authentication & authorization (JWT-based)
* Create, update, and delete posts
* Add Post title, description, caption, Images
* Like & comment on posts
* SQLite database (default, via `instagram_api.db`)
* Organized project structure (auth, database, routes, schema)
* Automatic API docs with **Swagger** & **ReDoc**

---

## πŸ“‚ Project Structure

```bash
Instagram_Clone/
│── Instagram/
β”‚ β”œβ”€β”€ auth/ # Authentication logic
β”‚ β”œβ”€β”€ database/ # Database connection/config
β”‚ β”œβ”€β”€ images/ # Uploaded images
β”‚ β”œβ”€β”€ routes/ # API routes (users, posts, comments, etc.)
β”‚ β”œβ”€β”€ schema/ # Pydantic schemas
β”‚ β”œβ”€β”€ instagram_api.db # SQLite database
β”‚ β”œβ”€β”€ main.py # Application entry point
β”‚ └── requirements.txt # Dependencies for this app
β”‚
β”œβ”€β”€ instagram_env/ # Virtual environment (ignored in git)
β”œβ”€β”€ react_app/ # Frontend (React project)
β”œβ”€β”€ .gitignore
└── requirements.txt # Root dependencies
```

---

## βš™οΈ Installation & Setup

### 1️⃣ Clone the repository

```bash
git clone https://github.com/your-username/fastapi-instagram-clone.git
cd FastAPI/Instagram_Clone
```

### 2️⃣ Create & activate virtual environment

```bash
# Create virtual environment
python -m venv instagram_env

# Activate venv (Windows)
instagram_env\Scripts\activate

# Activate venv (Mac/Linux)
source instagram_env/bin/activate
```

### 3️⃣ Install dependencies

```bash
pip install -r Instagram/requirements.txt
```

### 4️⃣ Run the application

```bash
uvicorn Instagram.main:app --reload
```

Server will start at πŸ‘‰ **[http://127.0.0.1:8000](http://127.0.0.1:8000)**

---

## πŸ“‘ API Documentation

* Swagger UI β†’ [http://127.0.0.1:8000/docs](http://127.0.0.1:8000/docs)
* ReDoc β†’ [http://127.0.0.1:8000/redoc](http://127.0.0.1:8000/redoc)

---

## πŸ› οΈ Environment Variables

Create a `.env` file in the root or configure inside `main.py`:

```ini
DATABASE_URL=sqlite:///./Instagram/instagram_api.db
SECRET_KEY=your_secret_key
ALGORITHM=HS256
ACCESS_TOKEN_EXPIRE_MINUTES=30
```

---

## 🎯 Future Enhancements

* Switch to PostgreSQL for production
* Add image storage in AWS S3 / Cloudinary
* Implement notifications & stories
* Dockerize the application

---

βœ… Now you can run your **Instagram Clone API** locally with just a few commands.