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

https://github.com/iamarvy/nexlink

Dreamscape is a modern, scalable social media platform built with a microservices architecture. It enables users to post updates, view and engage with content, like and comment on posts, and communicate in real time via direct messages and group chats.
https://github.com/iamarvy/nexlink

docker ecs-fargate event-driven-architecture jwt microservices nestjs nuxtjs sqs typescript websockets

Last synced: 2 months ago
JSON representation

Dreamscape is a modern, scalable social media platform built with a microservices architecture. It enables users to post updates, view and engage with content, like and comment on posts, and communicate in real time via direct messages and group chats.

Awesome Lists containing this project

README

          

# ๐Ÿ’ฌ Nexlink

A scalable, modular **Social Media Backend** built with **NestJS**, supporting both **real-time communication** and traditional REST/GraphQL interactions. Built with microservices, gRPC, and WebSockets, it provides real-time chat, friend/follow systems, and a foundation for modern social features.

---

## ๐Ÿ“Œ Table of Contents

* [Features](#features)
* [Tech Stack](#tech-stack)
* [Architecture](#architecture)
* [Getting Started](#getting-started)
* [Microservices Overview](#microservices-overview)
* [Gateway API](#gateway-api)
* [Authentication](#authentication)
* [Real-time Communication](#real-time-communication)
* [API Documentation](#api-documentation)
* [Usage Examples](#usage-examples)
* [Planned Features](#planned-features)
* [Project Structure](#project-structure)
* [Contributing](#contributing)
* [License](#license)

---

## โœจ Features

* ๐Ÿงฑ Microservices architecture with gRPC
* ๐ŸŒ REST + GraphQL API support
* ๐Ÿ” Auth system with JWT and RBAC
* ๐Ÿง‘โ€๐Ÿคโ€๐Ÿง‘ Follow/friend request system
* ๐Ÿ’ฌ 1-on-1 and group chat support with Socket.IO
* ๐Ÿ“ฅ Group join requests with admin approval
* ๐Ÿ“Œ Real-time messaging using WebSockets
* ๐Ÿ”” Notification support (via Redis pub/sub)

---

## ๐Ÿ›  Tech Stack

| Layer | Tech Used |
| ----------------- | --------------------------------------- |
| Backend Framework | NestJS |
| API Protocols | REST, GraphQL, gRPC |
| Real-time Engine | WebSockets, Socket.IO |
| Messaging Queue | Redis Pub/Sub |
| Database | PostgreSQL |
| Auth | JWT, RBAC |
| Containerization | Docker, Docker Compose |
| DevOps | GitHub Actions (CI/CD), Terraform (WIP) |

---

## ๐Ÿ— Architecture

\[Insert system architecture diagram here: gateway, services, Redis, WebSockets, etc.]

---

## ๐Ÿš€ Getting Started

### Prerequisites

* Node.js (v18+)
* Docker & Docker Compose
* PostgreSQL
* Redis

### Clone the Repo

```bash
git clone https://github.com/iamarvy/social-media-api.git
cd social-media-api
```

### Install Dependencies

```bash
npm install
```

### Run with Docker

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

### Run Individual Services

```bash
cd services/auth
npm run start:dev
```

---

## ๐Ÿงฉ Microservices Overview

| Service | Description |
| -------------------- | ---------------------------------------- |
| Auth Service | Handles sign up, login, token generation |
| User Service | Stores user profile and connection data |
| Post Service | Manages posts, comments, and likes |
| Chat Service | Handles real-time and group messaging |
| Notification Service | Sends real-time or async notifications |

---

## ๐ŸŒ Gateway API

* Unified **REST and GraphQL** entry point for frontend clients
* Integrates with all microservices over gRPC
* Handles WebSocket connections for real-time communication
* Includes role and token validation middleware

---

## ๐Ÿ” Authentication

* Uses **JWT-based** auth across services
* Role-based permissions: User, Admin, Group Admin
* Token validation handled at gateway + gRPC level guards

---

## ๐Ÿ”„ Real-time Communication

* WebSocket gateway powered by **Socket.IO**
* Chat service emits and listens to events using Redis pub/sub
* Group messaging with join requests and admin approval
* Message persistence using PostgreSQL

---

## ๐Ÿ“š API Documentation

This project uses **Swagger** for automatic API documentation.

* ๐Ÿงญ **Full REST Docs**: Available at `http://localhost:3000/api`
* โš™๏ธ **Generated via**: NestJS + Swagger module

### Sample Endpoints

| Method | Endpoint | Description |
| ------ | -------------- | ------------------------ |
| POST | `/auth/signup` | Register a new user |
| POST | `/auth/login` | Authenticate and get JWT |
| GET | `/users/me` | Fetch current user info |
| POST | `/posts` | Create a new post |

๐Ÿ“Œ For the complete list of endpoints, request/response schemas, and error formats, see the Swagger UI at `/api/docs`.

---

## ๐Ÿงช Usage Examples

### Authentication

```bash
curl -X POST http://localhost:3000/auth/login \
-H 'Content-Type: application/json' \
-d '{ "email": "user@example.com", "password": "123456" }'
```

### Create Post

```bash
curl -X POST http://localhost:3000/posts \
-H 'Authorization: Bearer ' \
-H 'Content-Type: application/json' \
-d '{ "text": "My first post!" }'
```

### Send WebSocket Message (via Socket.IO client)

```js
socket.emit('send_message', {
roomId: 'abc123',
message: 'Hello, world!',
});
```

---

## ๐Ÿ›  Planned Features

* [ ] Story/Status system
* [ ] Media uploads with storage microservice
* [ ] Notification preferences & batching
* [ ] Activity logs and admin moderation tools
* [ ] Full-text post and comment search

---

## ๐Ÿ“ Project Structure

```bash
/services
โ”œโ”€โ”€ auth/
โ”œโ”€โ”€ users/
โ”œโ”€โ”€ posts/
โ”œโ”€โ”€ chat/
โ”œโ”€โ”€ notifications/
โ””โ”€โ”€ common/
/gateway
โ”œโ”€โ”€ api-gateway/
/proto
โ””โ”€โ”€ *.proto
/docker
โ””โ”€โ”€ docker-compose.yml
```

---

## ๐Ÿค Contributing

1. Fork this repo
2. Create a branch (`git checkout -b feature/my-feature`)
3. Commit your changes
4. Push to your branch (`git push origin feature/my-feature`)
5. Open a Pull Request

---

## ๐Ÿ“„ License

This project is licensed under the MIT License.
ยฉ 2025 Oluwaseyi Oke