Skip to content

CS3219-AY2526Sem1/cs3219-ay2526s1-project-g16

 
 

Repository files navigation

Review Assignment Due Date

CS3219 Project (PeerPrep) - AY2526S1

Group: G16

Overview

PeerPrep is a collaborative coding platform that pairs users to solve algorithm questions in real time.
It is built with a microservices architecture, ensuring scalability, modularity, and maintainability.


Architecture

The system consists of several microservices communicating via REST APIs:

  • User Service – Manages users, authentication, and profiles
  • Question Service – Stores and retrieves coding questions
  • Match Service – Handles matchmaking logic using Redis
  • Collaboration Service – Manages real-time coding sessions
  • Attempt Service – Stores user code attempts and history
  • API Gateway – Single entry point handling routing, JWT auth, and rate limiting
  • Code Runner - Runs user code to return result or error if any.

All services are containerized with Docker and deployed on a shared private network.

Architecture

Tech Stack

  • Frontend: React, Tanstack, Tailwind, Vite
  • Backend: Node.js, Express.js
  • Database: PostgreSQL (Google Cloud SQL)
  • Cache/Queue: Redis
  • Deployment: Google Cloud Platform (Dockerized)
  • Auth: JWT (access & refresh tokens)
  • Docs: API Documentation

Key Features

  • Real-time peer matching with Redis queues and atomic transactions
  • Collaborative coding rooms via the Collaboration Service
  • Centralized authentication and routing through API Gateway
  • Persistent question and attempt history with version tracking

Deployment

Each service runs as an independent container on Google Cloud.
Only the API Gateway is publicly accessible; all other services communicate privately.

Development Setup

Prerequisites

Before starting, make sure you have the following installed:

  • Docker & Docker Compose – required to run all services
  • Node.js 18+ – optional, for local service development
  • PostgreSQL 14+ and Redis – optional, if running services manually
  • Prisma CLI – optional, for managing database migrations

Starting Each Service

Frontend

Navigate to <project-dir>/frontend and run:

docker build -t <container-name> .
docker run --rm -p <host-port>:<container-port> <container-name>

Backend

Navigate to <project-dir>/backend/<microservice-directory> and run:

docker build -t <container-name> .
docker run --rm -p <host-port>:<container-port> <container-name>

This will:

  • Build the service containers
  • Run the service containers

Environment Setup

Each microservice loads its own configuration from a .env file. To set up for local development, create one by copying the example:

DATABASE_URL =
PORT =
ACCESS_JWT_SECRET =
REFRESH_JWE_SECRET =

Services and Ports

Service Port (Internal) Description
API Gateway 8080 Central routing, authentication, and rate limiting
User Service 3000 Manages users and authentication
Matching Service 3010 Redis-based matchmaking between users
Question Service 3002 Handles coding questions and topics
Attempt Service 3003 Stores and retrieves user code attempts
Code Runner Service 3005 Executes user code
Collab Service 3009 Manages real-time collaborative sessions
Redis Cache 6379 In-memory queue and message broker

AI Usage Declaration

AI has been used for this project in the following areas:

  • Documentation generation and overall grammar fixing
  • Refactoring code
  • Question generation for populating the database

All AI outputs have been reviewed before use.

About

nus-cs3219-ay2526s1-cs3219-ay2526s1-project-project-template created by GitHub Classroom

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • HTML 58.4%
  • TypeScript 39.5%
  • Dockerfile 1.2%
  • Other 0.9%