Peer Prep
Overview
As part of a software development course, I did a group project to create a microservice-based web application for collaborative code editing. It includes features like user authentication, collaborative code editing and a chat api with ChatGPT. I was responsible for writing the code in the User Service and the Attempts Service.
Technology Stack
- Frontend: Developed with Next.js/React for interactive and responsive UI/UX.
- Backend: Built using Express/Node.js, ensuring robust server-side functionality.
- Databases: Utilized MongoDB for flexible document storage and PostgreSQL for structured data, optimizing data management across services.
Microservices
- User Service: Manages user accounts, authentication, and profile information
- Question Service: Users can create and manage events.
- Matching Service:
- Collaboration Service: Handles collaborative code editing via RabbitMQ
- AI Service: Handles chat functionality with ChatGPT
- Attempts Service (bundled with User Service): Handles saving of code during attempts of every user
Architecture
The backend consists of microservices, each of which is run in a separate docker container. The frontend communicates with these microservices via HTTP requests using an Nginx API Gateway.
For the user service/attempts service, the code can be broadly be thought of to follow a layered architecture consisting of a web layer, service layer, data access layer and the database.
- Web Layer: The web layer handles the public APIs for the User Service. It consists of a Node.js Express application that exposes REST endpoints for client and other services to integrate with.
- Service Layer: The service layer contains the logic and coordination across components. It handles tasks like authentication and request validation and consists of the middlewares and routes.
- Data Access Layer: The data layer abstracts the underlying PostgreSQL database. It consists of the functions to interact with the database in the controller
- Database: The database (written in PostgreSQL for the user and attempts service) stores the user information and attempts