Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
39 changes: 39 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: CD Pipeline

on:
push:
branches:
- master

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
cache: 'npm'

# To be updated depending on structure of project
- name: Generate deployment package
run: zip -r peerprep-app.zip index.js package.json package-lock.json

- name: Get Node.js version
run: echo "VERSION=$(node -p 'require('./package.json').version')" >> "$GITHUB_ENV"

- name: Deploy to EB
uses: einaregilsson/beanstalk-deploy@v22
with:
aws_access_key: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
application_name: PeerPrep-09
environment_name: PeerPrep-09-env
region: ap-southeast-1
version_label: Version-${{ github.sha }}
deployment_package: peerprep-app.zip
use_existing_version_if_available: true

98 changes: 98 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL Advanced"

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
schedule:
- cron: '37 23 * * 4'

jobs:
analyze:
name: Analyze (${{ matrix.language }})
# Runner size impacts CodeQL analysis time. To learn more, please see:
# - https://gh.io/recommended-hardware-resources-for-running-codeql
# - https://gh.io/supported-runners-and-hardware-resources
# - https://gh.io/using-larger-runners (GitHub.com only)
# Consider using larger runners or machines with greater resources for possible analysis time improvements.
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
permissions:
# required for all workflows
security-events: write

# required to fetch internal or private CodeQL packs
packages: read

# only required for workflows in private repositories
actions: read
contents: read

strategy:
fail-fast: false
matrix:
include:
- language: 'javascript-typescript'
build-mode: none
# CodeQL supports the following values keywords for 'language': 'actions', 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'rust', 'swift'
# Use `c-cpp` to analyze code written in C, C++ or both
# Use 'java-kotlin' to analyze code written in Java, Kotlin or both
# Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
# To learn more about changing the languages that are analyzed or customizing the build mode for your analysis,
# see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning.
# If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how
# your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages
steps:
- name: Checkout repository
uses: actions/checkout@v4

# Add any setup steps before running the `github/codeql-action/init` action.
# This includes steps like installing compilers or runtimes (`actions/setup-node`
# or others). This is typically only required for manual builds.
# - name: Setup runtime (example)
# uses: actions/setup-example@v1

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality

# If the analyze step fails for one of the languages you are analyzing with
# "We were unable to automatically build your code", modify the matrix above
# to set the build mode to "manual" for that language. Then modify this step
# to build your code.
# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
- if: matrix.build-mode == 'manual'
shell: bash
run: |
echo 'If you are using a "manual" build mode for one or more of the' \
'languages you are analyzing, replace this with the commands to build' \
'your code, for example:'
echo ' make bootstrap'
echo ' make release'
exit 1

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"
39 changes: 39 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

# Dependency directories
node_modules/
bower_components/

# Build output
dist/
dist-ssr/
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea/
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

# React / Frontend specific
.DS_*
**/*.backup.*
**/*.back.*
*.sublime*

# Design files
*.psd
*.thumb
*.sketch
78 changes: 78 additions & 0 deletions MICRO_FRONTEND_SETUP.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# Micro Frontend Setup - PeerPrep

## What We've Built

**Container App** - Main PeerPrep app
- **Location**: `ui-shell/`
- **Port**: 5173

**Matching Micro Frontend**
- **Location**: `ui-services/matching-ui-service/`
- **Port**: 5174

**Questions Micro Frontend**
- **Location**: `ui-services/questions-ui-service/`
- **Port**: 5175

**Collaboration Micro Frontend**
- **Location**: `ui-services/collab-ui-service/`
- **Port**: 5176

**User Micro Frontend**
- **Location**: `ui-services/user-ui-service/`
- **Port**: 5177

**History Micro Frontend**
- **Location**: `ui-services/history-ui-service/`
- **Port**: 5178

---

## How It Works

This setup uses **Micro Frontends (MFEs)** where each service (Matching, Questions, Collaboration, User) runs as a standalone Vite app, built and served separately.

The **Container App (ui-shell)** acts as the main entry point and dynamically loads these MFEs at runtime.
Each MFE is hosted on its own port and exposed via Module Federation, which allows the shell to import and render them seamlessly.

---

## Running the Apps

### 1. Running Locally (without Docker)
Each app uses Vite. Navigate into the app directory and run:

```bash
npm install

#For shell
npm run dev

#For MFE
npm run build && npm run preview -- --port <port_number> --strictPort
```

By default, the ports are:
- Shell: http://localhost:5173
- Matching: http://localhost:5174
- Questions: http://localhost:5175
- Collaboration: http://localhost:5176
- User: http://localhost:5177
- History: http://localhost:5178
---
### 2. Running with Docker Compose (Recommended)
This approach simplifies the process by managing all services with a single command. It uses the `docker-compose.yml` file provided to build and run all services together.
- Ensure you have Docker and Docker Compose installed.
- Navigate to the root directory where the docker-compose.yml file is located.
- Run the following command to build and start all services in detached mode:
```bash
docker-compose up --build -d
```

This command will build the Docker images for each service and start all containers, exposing them on the specified ports.
---
## Testing the Setup
1. Start all MFEs and the shell (either locally with npm run dev or via Docker).
2. Open the shell in your browser: http://localhost:5173
3. The shell will load the MFEs dynamically.
4. Interact with the UI — if the MFEs load correctly, the setup is working!
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
[![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: G09

Team Members:
- WOO ZONG HUA
- CENSON LEE LEMUEL JOHN ALEJO
- SONG JIA HUI
- SHARON SOH XUAN HUI
- YAP ZHAO YI

### Note:
- You are required to develop individual microservices within separate folders within this repository.
Expand Down
54 changes: 54 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@

services:
ui-shell:
build:
context: ./ui-shell
dockerfile: Dockerfile
ports:
- "5173:5173"
depends_on:
- matching-ui
- questions-ui
- collab-ui
- user-ui
- history-ui
container_name: peerprep-ui-shell

matching-ui:
build:
context: ./ui-services/matching-ui-service
dockerfile: Dockerfile
ports:
- "5174:5174"
container_name: peerprep-matching-ui

questions-ui:
build:
context: ./ui-services/question-ui-service
dockerfile: Dockerfile
ports:
- "5175:5175"
container_name: peerprep-question-ui

collab-ui:
build:
context: ./ui-services/collab-ui-service
dockerfile: Dockerfile
ports:
- "5176:5176"
container_name: peerprep-collab-ui

user-ui:
build:
context: ./ui-services/user-ui-service
dockerfile: Dockerfile
ports:
- "5177:5177"
container_name: peerprep-user-ui
history-ui:
build:
context: ./ui-services/history-ui-service
dockerfile: Dockerfile
ports:
- "5178:5178"
container_name: peerprep-history-ui
1 change: 1 addition & 0 deletions ui-services/collab-ui-service/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
24 changes: 24 additions & 0 deletions ui-services/collab-ui-service/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
19 changes: 19 additions & 0 deletions ui-services/collab-ui-service/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Use Node for build & serve
FROM node:22-alpine
WORKDIR /app

# Install deps
COPY package*.json .
RUN npm install --frozen-lockfile

# Copy source
COPY . .

# Build the app (generates /dist)
RUN npm run build

# Expose port
EXPOSE 5176

# Start with Vite preview (serves dist/)
CMD ["npm", "run", "preview", "--", "--host", "0.0.0.0", "--port", "5176", "--strictPort"]
Loading
Loading