Work · Case file 07 · Course project, full-stack database system · 2025

EduQuery SG

3 min readJump to proofJump to limits

At a glance

Result
A hybrid PostgreSQL plus MongoDB system behind one Express API, with advanced search over 25+ filterable fields, a Leaflet map of Singapore schools and six analytics endpoints.
Problem
Singapore school data is spread across sources and hard to compare, and administrators need a safe way to edit records.
My role
Full-stack developer on a team project for INF2003 Database Systems.GitHub describes the repository as a team project, and my part is as on my résumé. The README does not state the team size or split the work by person.
Stack
Express.js 4 · PostgreSQL (Supabase) · MongoDB Atlas · Leaflet.js

Proof

What try, see and check mean

On this pageThe problem

The problem

Singapore school data (subjects, CCAs, MOE programmes, ALP and LLP distinctive programmes) is spread across sources and hard to compare. Students, parents and educators need to search across all of it, see schools on a map and compare them side by side, while administrators need a safe way to edit records.

The idea. Put the relational data in a Third Normal Form PostgreSQL schema with junction tables for every many-to-many link, log user activity in MongoDB where a flexible schema and high write rate fit better, and serve both through one Express REST API.

Fig. 01 · Two databases, one API

  1. Search and filters25+ fields, OneMap distance
  2. Express APIJWT admin auth, bcrypt at 12 rounds
  3. PostgreSQL, 3NFinstitutions, programmes, junction tables, via Supabase pooler
  4. MongoDB Atlasactivity logging
  5. Analytics dashboardaggregate queries
The browser talks only to Express. School reads and writes go to the 3NF PostgreSQL schema on Supabase, where Schools links to Subjects, CCAs, Programmes and Distinctive_Programmes through four junction tables. Every user action is also written to the MongoDB activity_logs collection. Admin routes pass a JWT check first.

How it works

  1. Data model

    Schools is the main entity, linked to Subjects, CCAs, Programmes and Distinctive_Programmes through four junction tables, with a Users table for admin authentication. Indexes sit on school_name, zone_code and postal_code, and two views (v_school_summary, v_zone_statistics) serve common queries.

  2. API

    A single Express server.js exposes auth, schools CRUD, search, map, analytics and dropdown endpoints with parameterized queries. Create, update and delete routes require a JWT; passwords are hashed with bcrypt at 12 rounds and tokens expire after 24 hours.

  3. Search

    Universal search runs across all entities, category search targets one, and advanced search exposes 25+ filterable fields including zone, level, programmes and transport, with debounced live suggestions.

  4. Map

    Leaflet.js draws schools with markers colour-coded by zone (North, South, East, West, Central). OneMap geocodes addresses, and /api/schools/nearby finds schools by distance from a postal code or the current location.

  5. Analytics

    Six endpoints (zone stats, subject diversity, above-average schools, CCA participation, data completeness, zone comparison) use aggregate functions, CTEs, window functions, STRING_AGG and subqueries.

  6. Logging

    Every user action is written to the MongoDB activity_logs collection with timestamp, action type and metadata, while PostgreSQL connections go through the Supabase Session Pooler.

What was hard

Deciding where each kind of data belongs. Relational school data needs referential integrity and cascade deletes, so it went into a normalized PostgreSQL schema on Supabase; activity logs have a loose shape and a high write volume, so they went to MongoDB Atlas. The cost is two connections and two failure modes, which is why the README carries a troubleshooting table and a switch to the Supabase Session Pooler for IPv4 compatibility.

Limits. The README documents known rough edges: OneMap geocoding can fail and needs fallback coordinates, the map depends on the Leaflet CDN being reachable, and the Future Enhancements entry in the table of contents has no section behind it.

Evidence

Schema
3NF: Schools plus 4 reference tables, 4 junction tables and a Users table; cascade deletion via foreign keysEduQuery README, Database Schema and Technical Implementation
Advanced search
25+ filterable fieldsEduQuery README, Key Features
Authentication
JWT with 24-hour expiry; bcrypt with 12 roundsEduQuery README
Analytics endpoints
6 (zone-stats, subject-diversity, above-average, cca-participation, data-completeness, zone-comparison)EduQuery README, API Reference
Map zones
5 (North, South, East, West, Central), geocoded with the Singapore OneMap APIEduQuery README
Repository
79 commits, 1 fork, MIT licensegithub.com/ZulfaqarHafez/INF2003_EduQuery (metadata and LICENSE)
Demo
Walkthrough videohttps://youtu.be/Wo4YhykGx-8

Stack

  • Node.js
  • Express.js 4
  • PostgreSQL (Supabase)
  • MongoDB Atlas
  • JWT and bcrypt
  • Leaflet.js
  • Singapore OneMap API
  • Vanilla JavaScript
  • HTML5
  • CSS3