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

https://github.com/umutdeveloper/instagram-light

A lightweight, open-source Instagram clone built with Go (Fiber), Next.js, and PostgreSQL โ€” designed for performance, simplicity, and modular scalability. Includes basic features like user authentication, posts, likes, comments, and real-time notifications.
https://github.com/umutdeveloper/instagram-light

Last synced: 5 months ago
JSON representation

A lightweight, open-source Instagram clone built with Go (Fiber), Next.js, and PostgreSQL โ€” designed for performance, simplicity, and modular scalability. Includes basic features like user authentication, posts, likes, comments, and real-time notifications.

Awesome Lists containing this project

README

          

# ๐ŸŒ… Instagram Light

> A lightweight, open-source Instagram clone built with **Go (Fiber)**, **Next.js**, and **PostgreSQL** โ€” optimized for simplicity, speed, and modular scalability.







---

## ๐Ÿงญ Overview

**Instagram Light** is a minimal, fast, and modern re-implementation of Instagramโ€™s core features โ€” built for learning, prototyping, and small-scale deployment.

The goal is to create a **clean, modular architecture** with production-ready patterns: authentication, database management, API design, and frontend integration โ€” all within a single monorepo.

---

## ๐Ÿงฑ Architecture

```
instagram-light/
โ”œโ”€โ”€ backend/ # Go (Fiber) API Server
โ”‚ โ”œโ”€โ”€ api/ # Route handlers
โ”‚ โ”œโ”€โ”€ db/ # DB connection & migrations
โ”‚ โ”œโ”€โ”€ models/ # GORM models
โ”‚ โ”œโ”€โ”€ utils/ # Helpers, JWT, password hashing, etc.
โ”‚ โ””โ”€โ”€ main.go
โ”‚
โ”œโ”€โ”€ frontend/ # Next.js web app
โ”‚ โ”œโ”€โ”€ app/ # App router (Next.js 14+)
โ”‚ โ”œโ”€โ”€ components/
โ”‚ โ”œโ”€โ”€ pages/
โ”‚ โ”œโ”€โ”€ styles/
โ”‚ โ””โ”€โ”€ ...
โ”‚
โ”œโ”€โ”€ shared/ # Shared constants, types, assets
โ”‚
โ”œโ”€โ”€ infra/ # Docker, CI/CD, configs
โ”‚ โ”œโ”€โ”€ docker-compose.yml
โ”‚ โ”œโ”€โ”€ Dockerfile.backend
โ”‚ โ”œโ”€โ”€ Dockerfile.frontend
โ”‚ โ””โ”€โ”€ ...
โ”‚
โ””โ”€โ”€ README.md
```

---

## โš™๏ธ Tech Stack

| Layer | Technology | Description |
|-------|-------------|-------------|
| **Backend** | Go (Fiber), GORM, JWT, Bcrypt | REST API, Auth, ORM |
| **Frontend** | Next.js (14+), TailwindCSS | SSR frontend & UI |
| **Database** | PostgreSQL | User/Post/Like tables |
| **Realtime** | WebSocket (Fiber) | Notifications & chat |
| **Storage** | Local โ†’ S3 (later) | Media uploads |
| **Deployment** | Docker + Fly.io / Render / Railway | Easy cloud deploy |
| **Logging/Monitoring** | Zap or Logrus (Go) | Structured logging |

---

## ๐Ÿชœ Getting Started

### 1๏ธโƒฃ Prerequisites

Ensure you have:
- **Go 1.22+**
- **Node.js 18+**
- **Docker & Docker Compose**
- **Git**

---

### 2๏ธโƒฃ Clone the Repository

```bash
git clone https://github.com//instagram-light.git
cd instagram-light
```

---

### 3๏ธโƒฃ Environment Variables

Create `.env` files in both `/backend` and `/frontend`.

#### `/backend/.env`
```
PORT=8080
DB_URL=postgres://postgres:password@db:5432/instagram_light?sslmode=disable
JWT_SECRET=supersecret
MEDIA_PATH=./media
```

#### `/frontend/.env.local`
```
NEXT_PUBLIC_API_URL=http://localhost:8080
```

---

### 4๏ธโƒฃ Docker Setup

Run everything via Docker Compose:

```bash
docker-compose up --build
```

It will:
- Start PostgreSQL
- Start Go backend (Fiber)
- Start Next.js frontend

Access:
- Frontend โ†’ [http://localhost:3000](http://localhost:3000)
- Backend โ†’ [http://localhost:8080/health](http://localhost:8080/health)

---

## ๐Ÿงฉ Core Features (MVP)

| Feature | Status | Description |
|----------|---------|-------------|
| ๐Ÿ‘ค User Auth | โœ… | JWT login/register/logout |
| ๐Ÿ–ผ๏ธ Post CRUD | ๐Ÿ”„ | Upload & view posts |
| โค๏ธ Likes | ๐Ÿ”„ | Like/unlike posts |
| ๐Ÿ’ฌ Comments | ๐Ÿ”„ | Add/view comments |
| ๐Ÿ”” Notifications | ๐Ÿšง | Real-time with WebSocket |
| ๐Ÿšซ Moderation | ๐Ÿšง | Basic NSFW/keyword filter |
| ๐Ÿงฎ Analytics | ๐Ÿ•’ | Future (optional module) |

---

## ๐Ÿงช API Example

### Health Check
```bash
GET /health
Response: { "status": "ok" }
```

### Register
```bash
POST /api/auth/register
{
"username": "testuser",
"email": "test@example.com",
"password": "123456"
}
```

---

## ๐Ÿงฐ Developer Tips

- Run backend locally without Docker:
```bash
cd backend
go run main.go
```
- Run frontend locally:
```bash
cd frontend
npm run dev
```
- Database migrations (planned via `golang-migrate`)

---

## ๐Ÿงช Testing

- **Backend tests:** `go test ./...`
- **Frontend tests:** `npm run test`
- **CI/CD:** GitHub Actions (workflow in `.github/workflows/ci.yml`)

---

## ๐Ÿš€ Deployment

You can deploy using:
- **Fly.io**
- **Render**
- **Railway**
- **Docker Hub + VPS**

Example:
```bash
docker-compose -f docker-compose.prod.yml up -d
```

---

## ๐Ÿ“š Roadmap

| Phase | Goal | Status |
|-------|------|---------|
| **Phase 1** | Basic auth, posts, likes | โœ… |
| **Phase 2** | Realtime notifications | ๐Ÿšง |
| **Phase 3** | Image CDN & moderation | ๐Ÿ•’ |
| **Phase 4** | Analytics & Admin Dashboard | ๐Ÿ•’ |

---

## ๐Ÿง‘โ€๐Ÿ’ป Contributors

| Name | Role | Contact |
|------|------|----------|
| You | Creator / Lead Dev | [GitHub](https://github.com/your-username) |

---

## ๐Ÿชช License
This project is licensed under the **MIT License** โ€” free to use and modify.

```
MIT License ยฉ 2025 Umut ร‡AKIR
```

---

## ๐ŸŒŸ Support
If you like this project:
- โญ Star it on GitHub
- ๐Ÿž Open issues for bugs or ideas
- ๐Ÿ’ฌ Contribute with pull requests

---


Made with โค๏ธ using Go + Next.js