Contains client-side code for the PeerPrep web application.
- Build Script
- Architecture
- Docker Images
- Deployment
- Configuration
- Prerequisites
- Usage
- Folder Structure
- Technologies Used
- Features
build_images.sh is a build script for building the Docker images and optionally pushing them to the container registry. To get more information about the script, run:
./build_images.sh -h
Name: ghcr.io/cs3219-ay2324s1-g04/peerprep_user_service_api
Description: Runs the API server which serves the static webpage content. This is the image to be used for production deployment via Kubernetes.
Name: ghcr.io/cs3219-ay2324s1-g04/peerprep_webpage_service_api_docker
Description: Runs the API server which serves the static webpage content. This is the image to be used for deployment via Docker compose.
This is the main deployment method for production.
Prerequisite
- Docker images must be pushed to the container registry and made public.
- To push to the container registry (assuming one has the necessary permissions), run:
./build_images.sh -p - To make the images public, change the visibility of the image on GitHub.
- To push to the container registry (assuming one has the necessary permissions), run:
- Kubernetes cluster must be setup as specified in the main repository.
Steps:
- Ensure the "peerprep" namespace has been created:
kubectl create namespace peerprep - Navigate to the "kubernetes" directory:
cd kubernetes - Deploy the Kubernetes objects:
./deploy.sh- To delete the Kubernetes objects, run:
./delete.sh
- To delete the Kubernetes objects, run:
This is intended for development use only. It is meant to make developing other services easier.
Note:
- No horizontal auto scaling is provided.
- Make sure that the all services are up.
- The container for the API is not exposed and must be accessed through the Gateway Service.
Prerequisite
- Docker images must be built.
- To build the images, run:
./build_images.sh
- To build the images, run:
Steps:
- Ensure that the "peerprep" network exist:
docker network create -d bridge peerprep - Create the docker containers:
docker compose up- To delete the docker containers, run:
docker compose down
- To delete the docker containers, run:
The app uses environment variables for configuration. Update the .env files with the necessary values.
The PeerPrep webapp is built using React and Vite. Remember to install Node.js with the correct version and node package dependencies to begin.
npm install
# then
npm run devVisit http://localhost:5173/ in your browser.
Brief rundown of key folders and files of the webapp
- /src: Source code files
- /components: Common Reusable React components
- /context: Redux store init functions
- /features: Grouped components by feature with their necessary redux handlers and types
- /sampleFeature: All files within this folder are related to the specified feature name
- /components: Reusable React components
- sagas.ts: Redux saga functions
- selectors.ts: Redux store state selectors
- slice.ts: Redux store reducer and actions
- types.ts: Common types shared
- /sampleFeature: All files within this folder are related to the specified feature name
- /hooks: Custom reusable React hooks used by components
- /pages: Page React components
- /services: Grouped functions according to the service it calls
- /utils: Utility or helper functions
- /constants: Files that export constants that are shared throughout the app
- /theme: Theme override configs
- App.tsx: Root Parent React Component
- index.css: Global css styles
- main.tsx: ReactDOM initialisation (Entry point of app)
- vite-env.d.ts: Vite env configs
- /public: Public static assets
- .env: Environment files
- vite.build.config.ts: Vite build configs
- vite.config.ts: Vite configs
- index.html: Static html file where JavaScript bundle is built by Vite is referenced
- Vite: Development Server and bundler
- React: Front-end framework
- Redux: Global state manager
- Redux Saga: Middleware that extends Redux as the state manager
- React-Router: Handles application routes
- Joy UI: React UI framework
Guests are can sign up with a new account.

Users can login with their respective account credentials.

Users can manage their account information
- Updating profile info
- Updating password
- Deleting Account (Admins are not able to do this)
Users or guests can see the problems page for a full list of all problems. The table can be filtered by complexity or category and sorted accordingly. The searchbar can also be used to search for specific questions.

Users can to view a specific problem and its full details.

Users can PeerPrep and attempt a problem with a peer. This can be done through the PeerPrep button in Problems Page or QuickPrep.
Before joining a queue, they must specify their problem settings first. However, if QuickPrep was selected problem settings are randomised and the user can instantly join the queue.
Matched users are able to code together in real time with the problem's code template(if any).

Users in rooms are also able to chat with each other through the chat button.

Users are able to see a full list of their past attempts. The searchbar can be used to search for specific attempts.

Users can also see the full details of their attempt, including the code submitted and question details.

Users or guests are able to see the rankings page. Rankings are based on the attempt count of each user.

Question management functions are only accessible for admins.
Admins can create questions and add on necessary code templates.

Admins can delete questions. This prevents users from attempting this question.

Users or guests can use the app in light or dark mode by clicking on the mode icon on the top right of the navigation bar.





