Skip to content

GCode-codepad/backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GCode-codepad Backend Services

GCode-codepad is a collaborative online code editor integrated with real-time video calling functionality. The backend is designed as a distributed system using a microservices architecture, ensuring scalability, maintainability, and high performance. This README provides an overview of the backend structure, the services involved, and instructions to set up and test the system using Docker Compose.


Table of Contents

Architecture Overview

The backend of GCode-codepad is structured as a set of interconnected microservices, each responsible for specific functionalities. These services communicate over a dedicated Docker network, ensuring secure and efficient inter-service interactions. The system leverages:

  • MySQL: For persistent data storage.
  • Redis: For caching and fast data access.
  • Microservices: To handle user management, video calls, code synchronization, and API gateway functionalities.

UML Diagram


System Components

MySQL Database Service

  • Image: mysql:latest
  • Container Name: mysql-db
  • Description: Serves as the primary data store for persistent information such as user data, room metadata, and other relational data.
  • Environment Variables:
    • MYSQL_ROOT_PASSWORD: Root user password.
    • MYSQL_DATABASE: Name of the default database.
    • MYSQL_USER: Database user.
    • MYSQL_PASSWORD: Password for the database user.
  • Ports: 3306:3306
  • Volumes: Persists data in the mysql-data volume.

Redis Service

  • Image: redis:latest
  • Container Name: redis
  • Description: Provides in-memory data storage for caching, session management, and fast access to frequently used data.
  • Ports: 6379:6379

User Service

  • Image: Built from ./user-service/Dockerfile
  • Container Name: user-service
  • Description: Handles user registration, authentication, and profile management.
  • Environment Variables:
    • DB_HOST: Hostname for MySQL (mysql-db).
    • DB_PORT: Port for MySQL (3306).
    • DB_USER: MySQL user (youruser).
    • DB_PASSWORD: MySQL password (yourpassword).
    • DB_NAME: MySQL database name (yourdatabase).
  • Ports: 8081:8081
  • Dependencies: Depends on mysql-db.
  • Networks: backend

Gateway Service

  • Image: Built from ./gateway/Dockerfile
  • Container Name: gateway
  • Description: Acts as the API Gateway, routing requests to appropriate backend services and handling cross-cutting concerns like authentication, logging, and rate limiting.
  • Environment Variables:
    • SPRING_APPLICATION_NAME: Name of the application (gateway).
    • SERVER_PORT: Port for the gateway (8080).
    • USER_SERVICE_URI: URI for the User Service (http://user-service:8081).
    • CODE_SERVICE_URI: URI for the Code Service (http://code-service:8083).
  • Ports: 8080:8080
  • Dependencies: Depends on user-service, video-service, and code-service.
  • Networks: backend

Video Service

  • Image: Built from ./video-service/Dockerfile
  • Container Name: video-service
  • Description: Manages video call functionalities, handling signaling and peer connections using WebRTC.
  • Ports: 8002:8002
  • Networks: backend

Code Service

  • Image: Built from ./code-service/Dockerfile
  • Container Name: code-service
  • Description: Manages real-time code synchronization, leveraging Firebase Realtime Database for collaborative editing.
  • Ports: 8083:8083
  • Networks: backend

Prerequisites

Before setting up the backend services, ensure you have the following installed on your local machine or server:


Setup and Deployment

1. Clone the Repository

git clone https://github.com/yourusername/GCode-codepad-backend.git
cd GCode-codepad-backend

2. Build and Run with Docker Compose

docker-compose up -d --build

3. Verify the Services

docker-compose ps

4. Troubleshooting

docker-compose logs <service-name>

License

This project is licensed under the MIT License. You are free to use, modify, and distribute the code.


About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published