Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
103 commits
Select commit Hold shift + click to select a range
a82cb80
Setting up GitHub Classroom Feedback
github-classroom[bot] Sep 21, 2025
5e9249d
add deadline
github-classroom[bot] Sep 21, 2025
f36fd29
add folders
matochichap Sep 21, 2025
3412ff1
Merge pull request #2 from CS3219-AY2526Sem1/dev
matochichap Sep 21, 2025
c52eb26
create next app and test mock login page
matochichap Sep 21, 2025
4d0bc19
create express server with typescript
matochichap Sep 21, 2025
5bf0f94
dockerise ui
matochichap Sep 21, 2025
a7a340b
dockerise user service
matochichap Sep 21, 2025
5ceae4f
add dockerised server for question service
matochichap Sep 21, 2025
5e0ae42
add dockerised server for matching service
matochichap Sep 21, 2025
5d5ee82
add dockerised server for collaboration service
matochichap Sep 21, 2025
9b0d256
add env file
matochichap Sep 21, 2025
7ce04d9
edit readme
matochichap Sep 21, 2025
46e6e79
Merge pull request #3 from CS3219-AY2526Sem1/dev
matochichap Sep 21, 2025
93ef374
update build scripts
matochichap Sep 22, 2025
da3c592
add google oauth for login
matochichap Sep 22, 2025
ee8262d
add login, home page and protected routes
matochichap Sep 24, 2025
cb488b7
fix shared imports
matochichap Sep 24, 2025
0c149f9
fix docker volume mount
matochichap Sep 24, 2025
b3a7b27
add mongodb to store users, add middleware for authenticating users
matochichap Sep 24, 2025
795b510
fix bugs for middleware and properly manage session cookie
matochichap Sep 24, 2025
135c9e1
add homepage, fix edit profile, change to dark theme
matochichap Sep 24, 2025
d7353eb
Merge pull request #4 from CS3219-AY2526Sem1/dev
matochichap Sep 24, 2025
a1bfbcb
use redis for session storage and expiry and update docker setup
matochichap Sep 25, 2025
62e9d94
update ui package.json
matochichap Sep 25, 2025
b692aeb
Merge pull request #6 from CS3219-AY2526Sem1/dev
matochichap Sep 25, 2025
39d55c8
fix .env naming
matochichap Sep 26, 2025
ff7ef89
fix shared package import for dev and prod build
matochichap Sep 26, 2025
4b62bd9
add shared lib build into scripts
matochichap Sep 26, 2025
fda8031
Merge pull request #7 from CS3219-AY2526Sem1/dev
matochichap Sep 26, 2025
479e549
Add AuthGuard.tsx
Billy026 Sep 26, 2025
3bcdda8
Merge branch 'master' into matching-service
Billy026 Sep 26, 2025
0e733d3
Create basic UI for matching page
Billy026 Sep 26, 2025
dac681a
Add residual files
Billy026 Sep 26, 2025
4985e32
add script to build and reinstall shared module
matochichap Sep 27, 2025
33c8aa8
change nextjs app to import shared module instead of using src
matochichap Sep 27, 2025
5e039e3
use yarn for nextjs app
matochichap Sep 27, 2025
f60ac22
Merge pull request #8 from CS3219-AY2526Sem1/dev
matochichap Sep 27, 2025
41e7154
Add persistent matching loop
Billy026 Sep 27, 2025
a0d755d
Merge branch 'master' into matching-service
Billy026 Sep 27, 2025
6e7fd91
Add WebSocket notifications and queue optimisations
Billy026 Sep 27, 2025
d08bcd8
remove database url env varible
matochichap Sep 28, 2025
10df36e
change from mongodb atlas to local mongodb instance
matochichap Sep 30, 2025
999c665
Merge pull request #9 from CS3219-AY2526Sem1/dev
matochichap Sep 30, 2025
94bec03
Merge branch 'master' into matching-service
Billy026 Sep 30, 2025
a96379d
move redis confg to shared lib
matochichap Oct 1, 2025
7cc2e9c
change from redis managed sessions to jwt
matochichap Oct 3, 2025
6cfc6ed
separate user and auth contexts, add ttl for refresh tokens, clean up…
matochichap Oct 4, 2025
4e6e83f
update env variables
matochichap Oct 4, 2025
6f560ad
remove comments
matochichap Oct 4, 2025
2e18051
Merge pull request #10 from CS3219-AY2526Sem1/dev
matochichap Oct 4, 2025
eb9105d
Merge branch 'master' into matching-service
Billy026 Oct 4, 2025
e649c6e
Add matching functionality to Matching Button in profile page
Billy026 Oct 4, 2025
aa9620b
add rbac for user and admin roles
matochichap Oct 5, 2025
6d071aa
Fixed problems with setting up user service for authentication
Billy026 Oct 5, 2025
a82b709
add admin page for managing profiles
matochichap Oct 5, 2025
9b2d88d
add input validation and editing profile image at user level
matochichap Oct 5, 2025
d464be7
allow empty first and last name
matochichap Oct 5, 2025
689c97a
Merge pull request #11 from CS3219-AY2526Sem1/dev
matochichap Oct 5, 2025
9b4b280
remove ProtectedRoute component and have AuthContext redirect unautho…
matochichap Oct 6, 2025
bc082a3
fix page not redirecting after accesstoken is cleared
matochichap Oct 6, 2025
8420f7e
Merge pull request #12 from CS3219-AY2526Sem1/dev
matochichap Oct 6, 2025
e2413cc
merge
Billy026 Oct 6, 2025
3bbc8c8
Merge branch 'master' into matching-service
Billy026 Oct 6, 2025
39dbaf9
Attempt to connect to WebSocket during matching
Billy026 Oct 8, 2025
092404d
initial change Dockerfiles for prod build
matochichap Oct 9, 2025
f4ac13b
remove redirect in delete profile handler, redirect is now handled by…
matochichap Oct 9, 2025
9f62de5
Add socket.io connection
Billy026 Oct 15, 2025
846c099
Connect dummy users to room for testing
Billy026 Oct 16, 2025
998c7d9
setup question service
WinSheng1 Oct 16, 2025
2bbf78a
Add UI for header and given question
Billy026 Oct 16, 2025
72766ff
dockerise builds for ui and user-service, fix mongodb replica set iss…
matochichap Oct 17, 2025
b2ebc8e
Merge pull request #17 from CS3219-AY2526Sem1/dev
matochichap Oct 17, 2025
241bad8
fix images not showing on ui app
matochichap Oct 18, 2025
815e91a
Merge remote-tracking branch 'origin/dev' into matching-service
matochichap Oct 20, 2025
62e5b69
finish most of matching service
matochichap Oct 21, 2025
f526a88
pls stop using npm...
matochichap Oct 21, 2025
3f52204
B
matochichap Oct 21, 2025
3bb9277
Merge pull request #18 from CS3219-AY2526Sem1/dev
matochichap Oct 21, 2025
6b2e94c
use env variables for url
matochichap Oct 23, 2025
ef1b70d
match based on difficulty, topic and programming language with any op…
matochichap Oct 23, 2025
0818a10
add notify match function
matochichap Oct 23, 2025
d5fa025
add common constants
matochichap Oct 23, 2025
70e5d26
add matching constants
matochichap Oct 23, 2025
ba7cab1
add question constants
matochichap Oct 23, 2025
7b35aa9
refactor logic
matochichap Oct 23, 2025
fb96a14
add match utils
matochichap Oct 23, 2025
767c2b8
Revert "add match utils"
matochichap Oct 23, 2025
c4d814d
Reapply "add match utils"
matochichap Oct 23, 2025
0809853
fix matching service build
matochichap Oct 23, 2025
dae3866
dockerise matching service build
matochichap Oct 23, 2025
8ad1228
Merge remote-tracking branch 'origin/collaboration-service' into dev
matochichap Oct 23, 2025
3ef2ec4
update package.json shared import
matochichap Oct 23, 2025
e982149
add shared script into collaboration service package.json
matochichap Oct 23, 2025
dc2f5de
add match context to pass match info to collaboration page
matochichap Oct 23, 2025
6fed735
Merge pull request #16 from WinSheng1/question-service
matochichap Oct 23, 2025
b68282b
dockerise collaboration service build
matochichap Oct 23, 2025
a51b448
Merge remote-tracking branch 'origin/question-service' into dev
matochichap Oct 23, 2025
50ce745
dockerise question service build
matochichap Oct 23, 2025
d4f5d23
Merge pull request #19 from CS3219-AY2526Sem1/dev
matochichap Oct 23, 2025
74e7394
remove user to socket mapping after closing socket
matochichap Oct 23, 2025
8238577
set compose project name
matochichap Oct 23, 2025
4f4e70f
Merge pull request #20 from CS3219-AY2526Sem1/dev
matochichap Oct 23, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
UI_PORT=3000
USER_SERVICE_PORT=3001
MATCHING_SERVICE_PORT=3002
QUESTION_SERVICE_PORT=3003
COLLABORATION_SERVICE_PORT=3004
BASE_URL=localhost

REDIS_HOST=host.docker.internal
REDIS_PORT=6379
REDIS_PASSWORD=password

JWT_ACCESS_SECRET=
JWT_REFRESH_SECRET=
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.env
redis_data
redis_data_build
mongo_data
mongo_data_build
21 changes: 0 additions & 21 deletions LICENSE

This file was deleted.

21 changes: 20 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
[![Review Assignment Due Date](https://classroom.github.com/assets/deadline-readme-button-22041afd0340ce965d47ae6ef1cefeee28c7c493a6346c4f15d667ab976d596c.svg)](https://classroom.github.com/a/QUdQy4ix)
# CS3219 Project (PeerPrep) - AY2526S1
## Group: Gxx
## Group: G31

## Set up
Each microservice has its own `README.md` file with instructions on how to set up and run the microservice individually. Please refer to those files for individual microservice setup.

1. `npm install -g yarn`
2. run `yarn install` in shared folder first before setting up the rest of the microservices.

## Running with Docker
Copy `.env.example` to `.env` and modify the environment variables as needed.

```
docker compose build --no-cache
docker compose up
```

## Development
- For testing individual microservices, navigate to the respective microservice folder and follow the instructions in the `README.md` file of that microservice.
- Hot reload is not supported when running with Docker. For hot reload during development, you can run the microservices individually as described in their respective `README.md` files.

### Note:
- You are required to develop individual microservices within separate folders within this repository.
Expand Down
171 changes: 171 additions & 0 deletions collaboration-service/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage/
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)
web_modules/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional stylelint cache
.stylelintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local

# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache

# Next.js build output
.next
out

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# Vuepress build output
.vuepress/dist

# Vuepress v2.x temp and cache directory
.temp
.cache

# Docusaurus cache and generated files
.docusaurus

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Stores VSCode versions used for testing VSCode extensions
.vscode-test

# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*

# TypeScript build output
dist/
build/

# Database files
*.db
*.sqlite
*.sqlite3

# IDE and Editor files
.vscode/
.idea/
*.swp
*.swo
*~

# OS generated files
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db

# Temporary files
temp/
tmp/
*.tmp

# Test coverage
coverage/

# Backup files
*.bak
*.backup

# Lock files (uncomment if you want to ignore them)
# package-lock.json
# yarn.lock
25 changes: 25 additions & 0 deletions collaboration-service/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
FROM node:20-alpine AS builder

WORKDIR /app

COPY ./shared/ ./shared/
COPY ./collaboration-service/ ./collaboration-service/

WORKDIR /app/collaboration-service

RUN yarn shared
RUN yarn install
RUN yarn build

FROM node:20-alpine AS runner

WORKDIR /app/collaboration-service

COPY --from=builder /app/collaboration-service/dist ./dist
COPY --from=builder /app/collaboration-service/node_modules ./node_modules
COPY --from=builder /app/collaboration-service/package.json ./package.json
COPY --from=builder /app/collaboration-service/yarn.lock ./yarn.lock

EXPOSE 3004

CMD ["yarn", "start"]
9 changes: 9 additions & 0 deletions collaboration-service/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
### Collaboration Service
Responsible for facilitating collaboration between users, including features like chat, file sharing, and real-time editing.

Provides the mechanism for real-time collaboration (e.g., concurrent code editing) between the authenticated and matched users in the collaborative space.

### Set up
1. `npm install -g yarn`
2. `yarn install`
3. `yarn run dev` to start the development server.
10 changes: 10 additions & 0 deletions collaboration-service/nodemon.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"watch": [
"src"
],
"ignore": [
"src/**/*.spec.ts"
],
"ext": "ts, html, css, ejs, json",
"exec": "ts-node ./src/index.ts"
}
25 changes: 25 additions & 0 deletions collaboration-service/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "collaboration-service",
"version": "1.0.0",
"main": "./src/index.ts",
"license": "MIT",
"scripts": {
"shared": "yarn --cwd ../shared install && yarn --cwd ../shared build && yarn add file:../shared --force",
"dev": "nodemon",
"build": "tsc",
"start": "node dist/index.js"
},
"dependencies": {
"dotenv": "^17.2.2",
"express": "^5.1.0",
"shared": "file:../shared",
"socket.io": "^4.8.1",
"socket.io-client": "^4.8.1"
},
"devDependencies": {
"@types/express": "^5.0.3",
"nodemon": "^3.1.10",
"ts-node": "^10.9.2",
"typescript": "^5.9.2"
}
}
17 changes: 17 additions & 0 deletions collaboration-service/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import dotenv from "dotenv";
import path from "path";
dotenv.config({ path: path.resolve(__dirname, "../../.env") });

import http from "http";
import app from "./server";
import { initializeSocketServer } from "./socketServer";


const PORT = process.env.COLLABORATION_SERVICE_PORT || 3004;
const server = http.createServer(app);

initializeSocketServer(server);

server.listen(PORT, () => {
console.log(`Collaboration Service is running on port ${PORT}`);
});
5 changes: 5 additions & 0 deletions collaboration-service/src/model/publicUser.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export interface PublicUser {
id: string;
displayName?: string;
picture?: string;
}
10 changes: 10 additions & 0 deletions collaboration-service/src/model/room.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { Question } from "shared";
import { PublicUser } from "./publicUser";

export interface RoomPayload {
roomId: string;
users: PublicUser[];
question: Question;
createdAt: number;
lastActiveAt: number;
}
18 changes: 18 additions & 0 deletions collaboration-service/src/server.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import express from "express";
import type { Request, Response } from "express";
import { RoomPayload } from "./model/room";

const app = express();
app.use(express.json());

app.get("/", (req: Request, res: Response) => {
res.send("Collaboration Service is running!");
});

app.post("/api/room/create", (req: Request, res: Response) => {
const payload = req.body as RoomPayload;
console.log("Room created:", payload.roomId, payload.users);
res.status(200).send("Room initialized");
});

export default app;
Loading