A robust social media backend application built with Go, featuring Neo4j graph database for social connections and Kafka for message queuing.
π Features
- User authentication and authorization
- Post creation with multiple media support
- Comment system
- Real-time messaging using WebSocket
- Cloud-based media storage using Cloudinary
- Message queuing with Kafka
- Graph-based social connections using Neo4j
π οΈ Tech Stack
- Go - Main programming language
- Neo4j - Graph database for social connections
- Kafka - Message queuing system
- Docker - Containerization
- Cloudinary - Cloud media storage
- WebSocket - Real-time communication
- Wire - Dependency injection
π¦ Prerequisites
- Go 1.21.7 or higher
- Docker and Docker Compose
- Neo4j 5.21.2 or higher
- Kafka
π§ Installation
- Clone the repository:
git clone https://github.com/abdullahnettoor/connect-social-media.git
cd connect-social-media
- Create a
dev.env
file in the root directory with the following variables:
# Neo4j Configuration
NEO4J_AUTH=neo4j/your_password
NEO4J_URI=bolt://localhost:7687
NEO4J_USERNAME=neo4j
NEO4J_PASSWORD=your_password
# Cloudinary Configuration
CLOUDINARY_CLOUD_NAME=your_cloud_name
CLOUDINARY_API_KEY=your_api_key
CLOUDINARY_API_SECRET=your_api_secret
# Server Configuration
PORT=9000
- Start the services using Docker Compose:
docker-compose up -d
- Install dependencies:
make deps
- Run the application:
make run
ποΈ Project Structure
.
βββ cmd/
β βββ main.go # Application entry point
βββ internal/
β βββ config/ # Configuration management
β βββ domain/ # Domain entities and interfaces
β βββ infrastructure/ # External services implementation
β βββ repo/ # Database repositories
β βββ usecase/ # Business logic
β βββ di/ # Dependency injection
βββ pkg/ # Shared packages
βββ docker-compose.yml # Docker services configuration
π οΈ Development
make nodemon
- Generate Swagger documentation:
make swag
π API Documentation
Swagger documentation is available at /swagger/index.html
when the server is running.
π³ Docker Services
The application uses multiple Docker containers orchestrated using Docker Compose:
-
Neo4j Database
- Port: 7474 (HTTP), 7687 (Bolt)
- Community edition 5.21.2
-
Kafka Message Queue
- Port: 9092
- Includes Zookeeper on port 2181
-
API Server
- Port: 9000
- Built using multi-stage Docker build for optimized image size
π€ Contributing
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
)
- Commit your changes (
git commit -m 'Add some amazing feature'
)
- Push to the branch (
git push origin feature/amazing-feature
)
- Open a Pull Request
π License
This project is licensed under the MIT License - see the LICENSE file for details.