Author: Tan Zheng Jia Application Type: Full-Stack Discussion Platform
Modulate is a modular forum application designed for structured discussions. It features a high-performance Go backend and a type-safe React (TypeScript) frontend. The application emphasizes data integrity through "Soft Deletion," ensuring that threaded conversations remain readable even if a user removes their specific contribution.
- Modular Organization: Posts are grouped by specific modules (e.g., "General," "Development," "Feedback").
- Threaded Discussions: Nested, recursive comment sections allowing for deep conversations.
- Soft Delete Logic: Posts and comments are "ghosted" (content scrubbed) rather than physically removed to preserve thread context and database integrity.
- Backend Authorization: All write operations (Update/Delete) verify the user's identity via JWT against the resource owner in the database.
- Frontend: React, TypeScript
- Backend: Go
- Database: PostgreSQL
- copy the .env.example files and fill in the required details
cp .env.example .env cp ./backend/.env.example ./backend.env cp ./frontend/.env.example ./frontend/.env
Ensure you have PostgreSQL installed and running.
-
Create a database named
modulate_db:CREATE DATABASE modulate_db;
-
Execute the schema migrations in backend/internal/db/migrations/init.sql
-
Go to nusmods_data_processing and run:
python extract.py python transform.py python load.py
-
Navigate to the backend directory:
cd backend -
Install dependencies:
go mod tidy
-
Environment Configuration: Ensure your database connection string in .env matches your local Postgres credentials:
-
Run the application:
go run main.go
The server will start on
http://localhost:8080by default unless specified.
- Navigate to the frontend directory:
cd frontend - Install dependencies:
npm install
- Start the development server:
The frontend will be accessible at
npm run dev
http://localhost:3000by default unless specified.
To test the core logic of the application, follow these steps:
- Auth Flow: Register a new user and log in.
- Creation: Navigate to a Module and create a new Post.
- Threading: Add a comment to your post, then add a reply to that comment to verify recursive rendering.
- Soft Delete: Delete your post or comment.
- Observation: The post should remain accesible via the link but show
[Deleted]as the title and[This post has been removed by the author]as the content.
- Observation: The post should remain accesible via the link but show
- Security Verification: * Log out and try to access a protected route (e.g.,
/api/posts/{id}).- Log in as a different user and attempt to edit/delete a post you don't own. The backend will return a
403 Forbiddenbecause it verifies theuserIDfrom the JWT context.
- Log in as a different user and attempt to edit/delete a post you don't own. The backend will return a
- Some of the styling in the css was done by GPT to speed up the process
- When there were parts I wasn't too sure about, I clarified with GPT to make sure my logic was sound