Skip to content

rehna-jp/GMS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

11 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ›๏ธ Government Project Monitoring System

Next.js TypeScript Supabase Tailwind CSS PWA

A GPS-verified government infrastructure project monitoring platform built to prevent fraud and ensure transparency across Ghana.

Features โ€ข Tech Stack โ€ข Getting Started โ€ข Screenshots โ€ข Architecture โ€ข Team


๐Ÿ“Œ Overview

The Government Project Monitoring System (GMS) is a full-stack web application that enables GPS-verified photo submissions from contractors on government infrastructure projects. Officials can review submissions, verify location authenticity, and approve or flag reports โ€” all with a permanent audit trail.

Built for Group 12 as part of a university software engineering project.

The Problem

  • Contractors submit fake progress photos from locations other than the project site
  • Government officials have no efficient digital tool to verify submissions
  • Citizens have zero visibility into how public funds are being spent
  • No audit trail exists for review decisions

The Solution

  • ๐Ÿ“ GPS verification โ€” EXIF data extracted from photos, distance calculated using Haversine formula
  • ๐Ÿ” Role-based access โ€” different interfaces for Admin, Official, Contractor, and Citizen
  • ๐Ÿ“Š Live dashboards โ€” real-time analytics with charts and fraud alerts
  • ๐ŸŒ Public transparency portal โ€” citizens can track projects on an interactive map
  • ๐Ÿ“ฑ Offline PWA โ€” contractors can capture photos on-site without network connectivity

โœจ Features

๐Ÿ” Authentication & Security

  • Email + password authentication via Supabase Auth
  • Force password change on first login
  • Role-based route protection via Next.js middleware
  • Row Level Security (RLS) on all database tables
  • Admin-only user creation

๐Ÿ—๏ธ Project Management

  • Create, edit, and manage infrastructure projects
  • GPS coordinates required for every project
  • 16 Ghana regions + 9 project type categories
  • Budget tracking in Ghana Cedis (GHโ‚ต)
  • Milestone management with deadlines and progress tracking
  • Auto-generated project numbers (PRJ-2026-001)

๐Ÿ“ธ GPS-Verified Photo Submissions

  • Direct rear camera access on mobile (capture="environment")
  • Drag & drop upload from gallery on desktop
  • EXIF metadata extraction for GPS coordinates
  • Haversine formula distance calculation
  • Three-tier verification system:
    • โœ… Verified โ€” photo taken within 100m of project site
    • โš ๏ธ Review โ€” photo taken 100โ€“500m from site
    • ๐Ÿšฉ Flagged โ€” photo taken more than 500m away

๐Ÿ” Review & Approval Workflow

  • Officials can: Approve, Flag as Fraud, Request Changes, Mark Under Review
  • Contractors can resubmit on the same thread with new photos
  • Old photos preserved for side-by-side comparison
  • Permanent audit trail for every review action
  • Real-time notifications via bell icon

๐Ÿ“Š Analytics & Live Dashboards

  • Role-specific dashboards (Admin / Official / Contractor)
  • force-dynamic rendering for always-fresh data
  • Submission trend line chart (6 months)
  • Projects by region bar chart
  • Submissions by status donut chart
  • Auto-update project completion % on approval

๐ŸŒ Public Transparency Portal

  • /public/map โ€” interactive project map (no login required)
  • Anonymous citizen tip submission with reference number tracking
  • Google Maps integration for site location verification

๐Ÿ“ฑ PWA & Offline Support

  • Installable as a Progressive Web App on Android and iOS
  • Service Worker for offline page caching
  • IndexedDB queue stores photos when offline
  • Auto-uploads when network connectivity returns
  • Floating queue manager with live status indicator

๐Ÿ› ๏ธ Tech Stack

Layer Technology Purpose
Framework Next.js 14 (App Router) React framework with SSR/RSC
Language TypeScript Type safety across the codebase
Styling Tailwind CSS Utility-first CSS
Components shadcn/ui Accessible UI component library
Backend Supabase Database, Auth, Storage
Database PostgreSQL Relational data with RLS
Charts Recharts Analytics dashboards
Forms React Hook Form + Zod Form handling and validation
GPS exif-parser EXIF metadata extraction
Offline IndexedDB + Service Worker PWA offline support
Icons Lucide React Icon library

๐Ÿš€ Getting Started

Prerequisites

  • Node.js 18+
  • npm or yarn
  • Supabase account (free tier works)

Installation

# 1. Clone the repository
git clone https://github.com/your-username/govt-monitoring-system.git
cd govt-monitoring-system

# 2. Install dependencies
npm install

# 3. Set up environment variables
cp .env.local.example .env.local
# Fill in your Supabase credentials

# 4. Run the development server
npm run dev

Open http://localhost:3000 in your browser.

Environment Variables

Create a .env.local file in the root directory:

NEXT_PUBLIC_SUPABASE_URL=https://your-project.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=your-anon-key

Find these in Supabase Dashboard โ†’ Project Settings โ†’ API.

Database Setup

Run the SQL setup files in your Supabase SQL Editor in order:

Week1-SETUP.sql   โ†’ Users, auth tables, RLS policies
Week2-SETUP.sql   โ†’ Projects, milestones
Week3-SETUP.sql   โ†’ Submissions, storage bucket
Week4-SETUP.sql   โ†’ Notifications, audit logs

๐Ÿ‘ฅ User Roles

Role Permissions
Admin Full system access, user management, all reports
Official Create/edit projects, review submissions, manage tips
Contractor View assigned projects, upload progress photos, resubmit
Citizen View public map, submit anonymous tips (no login needed)

Test Credentials

Admin:      admin@gov.gh        / admin123
Official:   official@gov.gh     / official123
Contractor: contractor@example.com / contractor123

โš ๏ธ Change these credentials before any production deployment.


๐Ÿ—๏ธ Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                    Next.js 14 App Router                 โ”‚
โ”‚                                                         โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”‚
โ”‚  โ”‚  RSC Pages  โ”‚  โ”‚Server Actionsโ”‚  โ”‚  Middleware    โ”‚  โ”‚
โ”‚  โ”‚ (dashboard, โ”‚  โ”‚ (auth, CRUD, โ”‚  โ”‚ (auth guard,  โ”‚  โ”‚
โ”‚  โ”‚  projects,  โ”‚  โ”‚  reviews,    โ”‚  โ”‚  role check)  โ”‚  โ”‚
โ”‚  โ”‚  submissionsโ”‚  โ”‚  analytics)  โ”‚  โ”‚               โ”‚  โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                         โ”‚
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                      Supabase                            โ”‚
โ”‚                                                         โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”              โ”‚
โ”‚  โ”‚PostgreSQLโ”‚  โ”‚   Auth   โ”‚  โ”‚ Storage  โ”‚              โ”‚
โ”‚  โ”‚ + RLS    โ”‚  โ”‚  (JWT)   โ”‚  โ”‚ (Photos) โ”‚              โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜              โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

GPS Verification Flow

Contractor takes photo
        โ†“
EXIF data extracted (client-side)
        โ†“
GPS coordinates parsed
        โ†“
Haversine distance calculated
        โ†“
< 100m  โ†’  โœ… Verified
100โ€“500m โ†’ โš ๏ธ  Needs Review
> 500m  โ†’  ๐Ÿšฉ Flagged
No GPS  โ†’  โš ๏ธ  Manual Review Required

Offline Flow

No network detected
        โ†“
Amber banner shown to contractor
        โ†“
Photo captured via camera
        โ†“
GPS extracted + saved to IndexedDB
        โ†“
"๐Ÿ“ถ QUEUED" badge shown
        โ†“
Network returns
        โ†“
Auto-upload triggers (< 2 seconds)
        โ†“
Submission created + Official notified โœ…

๐Ÿ“ Project Structure

govt-monitoring-system/
โ”œโ”€โ”€ app/
โ”‚   โ”œโ”€โ”€ (dashboard)/          # Protected authenticated routes
โ”‚   โ”‚   โ”œโ”€โ”€ dashboard/        # Role-based live dashboards
โ”‚   โ”‚   โ”œโ”€โ”€ projects/         # Project CRUD + details
โ”‚   โ”‚   โ”œโ”€โ”€ submissions/      # Photo submissions + review
โ”‚   โ”‚   โ”œโ”€โ”€ users/            # Admin user management
โ”‚   โ”‚   โ”œโ”€โ”€ tips/             # Citizen tips management
โ”‚   โ”‚   โ””โ”€โ”€ reports/          # Analytics + print/PDF
โ”‚   โ”œโ”€โ”€ public/
โ”‚   โ”‚   โ”œโ”€โ”€ map/              # Public project map
โ”‚   โ”‚   โ””โ”€โ”€ tips/             # Anonymous tip submission
โ”‚   โ””โ”€โ”€ login/                # Authentication
โ”‚
โ”œโ”€โ”€ components/
โ”‚   โ”œโ”€โ”€ dashboard/            # Charts, stats cards, activity feed
โ”‚   โ”œโ”€โ”€ submissions/          # PhotoUpload, ReviewPanel, GPSVerification
โ”‚   โ”œโ”€โ”€ projects/             # ProjectForm, MilestonesList
โ”‚   โ”œโ”€โ”€ users/                # UserStatusButton
โ”‚   โ”œโ”€โ”€ tips/                 # TipActionButton
โ”‚   โ””โ”€โ”€ public/               # PublicMapClient, TipSubmissionForm
โ”‚
โ”œโ”€โ”€ lib/
โ”‚   โ”œโ”€โ”€ actions/              # All server actions
โ”‚   โ”‚   โ”œโ”€โ”€ auth.ts
โ”‚   โ”‚   โ”œโ”€โ”€ projects.ts
โ”‚   โ”‚   โ”œโ”€โ”€ submissions.ts
โ”‚   โ”‚   โ”œโ”€โ”€ reviews.ts
โ”‚   โ”‚   โ”œโ”€โ”€ notifications.ts
โ”‚   โ”‚   โ”œโ”€โ”€ analytics.ts
โ”‚   โ”‚   โ”œโ”€โ”€ users.ts
โ”‚   โ”‚   โ””โ”€โ”€ tips.ts
โ”‚   โ”œโ”€โ”€ utils/
โ”‚   โ”‚   โ”œโ”€โ”€ gps.ts            # Haversine formula
โ”‚   โ”‚   โ”œโ”€โ”€ exif.ts           # EXIF GPS extraction
โ”‚   โ”‚   โ””โ”€โ”€ offline-queue.ts  # IndexedDB offline queue
โ”‚   โ””โ”€โ”€ supabase/             # Client + server Supabase instances
โ”‚
โ”œโ”€โ”€ public/
โ”‚   โ”œโ”€โ”€ sw.js                 # Service Worker
โ”‚   โ””โ”€โ”€ manifest.json         # PWA manifest
โ”‚
โ””โ”€โ”€ middleware.ts             # Auth + role protection

๐Ÿ—บ๏ธ Development Roadmap

Week Feature Status
Week 1 Authentication & Setup โœ… Complete
Week 2 Projects & Milestones โœ… Complete
Week 3 Photo Upload + GPS Verification โœ… Complete
Week 4 Review & Approval Workflow โœ… Complete
Week 5 Analytics & Live Dashboards โœ… Complete
Week 6 Maps, Reports, Tips, User Management โœ… Complete
PWA Offline Support & Camera Capture โœ… Complete

๐Ÿ”’ Security

  • Row Level Security โ€” Supabase RLS policies on all tables
  • JWT Authentication โ€” Tokens managed by Supabase, never in localStorage
  • Server-side role checks โ€” All sensitive actions verify role server-side
  • GPS anti-fraud โ€” EXIF data cannot be spoofed through the UI
  • Audit trail โ€” Every review action permanently logged
  • Private storage โ€” Photos in private Supabase bucket, signed URLs required

๐Ÿ“ฑ PWA Installation

On Android

  1. Open the app in Chrome
  2. Tap the โ‹ฎ menu โ†’ Add to Home Screen
  3. App installs with offline support

On iOS

  1. Open the app in Safari
  2. Tap the Share button โ†’ Add to Home Screen
  3. App installs with offline support

๐Ÿงช Quick Test Guide

# 1. Login as admin โ†’ verify dashboard stats
# 2. Create a project with GPS coordinates
# 3. Login as contractor โ†’ submit photos
# 4. Login as official โ†’ review submission
# 5. Approve โ†’ verify project completion % updates
# 6. Visit /public/map โ†’ verify project is visible
# 7. Submit tip from /public/tips โ†’ verify in /tips

Test offline:

  1. Chrome DevTools โ†’ Network โ†’ set Offline
  2. Upload a photo โ†’ see ๐Ÿ“ถ QUEUED badge
  3. Switch back to No throttling
  4. Watch auto-upload within 2 seconds โœ…

๐Ÿ‘จโ€๐Ÿ’ป Team

Group 12 โ€” 10 members

Area Responsibility Size
Frontend React components, UI/UX, responsive layout 4 members
Backend Server actions, database, RLS policies 3 members
Integration GPS verification, testing, PWA 2 members
Documentation README, UML diagrams, presentation 1 member

๐Ÿ“„ License

This project was built for academic purposes by Group 12.


Built with โค๏ธ in Ghana ๐Ÿ‡ฌ๐Ÿ‡ญ

Next.js + Supabase + TypeScript โ€ข Group 12 โ€ข 2026

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors