Document 01 · README.md
Project Overview
Unified Campus Social & Real-Time Information Hub
Bridging the communication gap across university campuses with verified feeds, instant emergency blood requests, transit tracking, and resilient offline capability.
§1The Campus Problem, vs. The Notebook Solution
| The Campus Problem Today | The Notebook Solution |
|---|---|
| Buried Academic Notices: Critical exam and class routine changes get lost under thousands of informal messages in messaging groups. | Dedicated Academic Hub: Clean, categorized academic notices tagged by department and semester with permanent bookmarking. |
| Emergency Blood Bottlenecks: Life-critical blood requests fail due to missing donor filters and slow broadcast reach. | Emergency Health Hub: Instant access to blood donor calls, urgent filters, and one-tap volunteer contact actions. |
| Commuter Transit Uncertainty: Students miss unscheduled bus changes and room relocations while traveling. | Real-Time Transport Desk: Centralized schedule updates and commuter alerts accessible from any device. |
| Unstable Campus Connectivity: Weak Wi-Fi in auditoriums and dormitories cuts students off from vital information. | Offline-First PWA: Service Worker caching with smooth bottom status alert (“Showing cached campus content”). |
§2Key Features & Hub Architecture
Five Specialized Functional Hubs
General
Inter-departmental highlights, campus events, sports meets, and student club showcases.
Academic Hub
Syllabus notes, assignment briefs, exam routines, and class representative announcements.
Transport Desk
Real-time campus bus schedules, route notices, and commuter alerts.
Logistics & Lost/Found
Hostel notices, canteen daily menus, library hours, and lost item reports.
Emergency Health & Blood Registry
Urgent blood donation appeals, on-campus medical center hours, and emergency first-aid contacts.
Robust Student Identity & Security
- Student ID & Department Tagging: Automatic profile attribution showing student batch, department, and ID.
- Self-Service Password Reset: Integrated email-based recovery directly within the login modal.
- Seamless Account Re-creation: Safeguards that prevent orphaned or stale user profile records.
Engagement & Personal Bookmarking
- Multi-Sentiment Reactions: Instant reaction toggles — Upvote (endorsement/agreement), Heart (appreciation), and Helpful (academic utility).
- Threaded Commenting: Active peer discussions under every post with real-time UI updates.
- Private Bookmarking (Saved Vault): One-tap saving of important schedules and notes for fast recall.
Offline-First PWA Technology
- Installable on Any Device: Installable on Android, iOS, Windows, and macOS as a native standalone app.
- Smart Bottom Offline Banner: Non-intrusive bottom notification alert indicating cached campus mode when internet connectivity drops.
- Automatic Background Sync: Restores live feed queries immediately upon reconnection.
Campus Safety & Support Desk
- Community Report System: Multi-category reporting mechanism for harassment, spam, or false information.
- One-Tap Emergency Directory: Direct WhatsApp, phone call, and email shortcuts to campus authorities and medical clubs.
§3System Architecture
Notebook leverages a modern Decoupled Client-First Progressive Web Architecture.
┌────────────────────────────────────────────────────────────────┐
│ Notebook Progressive Web App │
│ (ES6+ Modular JS + Tailwind CSS v4) │
└──────────────┬───────────────────────────────┬─────────────────┘
│ (Offline Cache) │ (REST / WebSockets)
▼ ▼
┌─────────────────────┐ ┌────────────────────────┐
│ Service Worker │ │ Supabase Backend │
│ (sw.js) │ │ • PostgreSQL 15 (RLS) │
│ • Cache Storage │ │ • GoTrue Auth (JWT) │
│ • Offline Fallback │ │ • Realtime CDC Engine │
└─────────────────────┘ └────────────────────────┘
§4Quick Start Guide
Prerequisites
- Node.js (v18.0.0 or higher recommended)
- npm, bun, or yarn
git clone https://github.com/your-username/notebook-campus-social.git
cd notebook-campus-social
npm install
VITE_SUPABASE_URL=https://vrkcucdeqavujvfbkqpk.supabase.co
VITE_SUPABASE_ANON_KEY=your_supabase_anon_key_here
npm run dev
# → http://localhost:3000
npm run lint
npm run build
# → optimized static bundle in /dist
§5Project Directory Structure
├── /css # Modular CSS layer powered by Tailwind CSS v4
│ ├── /base # Reset, typography, and keyframe animations
│ ├── /components # Auth modal, cards, create-post widget, PWA toasts
│ ├── /layout # Top navbar, bottom navigation, adaptive sidebar
│ └── /pages # Page-specific styling (Friends, Profile, Saved, Support)
├── /js # Modular ES6+ JavaScript Layer
│ ├── /config # Supabase client singleton configuration
│ ├── /modules # Core application engines (Auth, Feed, Comments, Nav, PWA)
│ ├── /pages # Standalone page controllers (Profile, Saved, Support, Report)
│ └── main.js # Main application bootstrap and event orchestration
├── /docs # Documentation suite (PRD, TECHNOLOGY, README)
├── /public
│ └── manifest.json # PWA web manifest configuration
├── index.html # Semantic HTML5 root document
└── sw.js # Service Worker for offline caching & background sync
§63-Minute Hackathon Pitch Script
| Time | Segment | What to Say & Demonstrate |
|---|---|---|
| 0:00–0:45 | The Problem | “Judges, university students lose hours every week scrolling through noisy WhatsApp groups trying to find bus schedules, class routines, or urgent blood donors. Notebook solves this with a unified, verified campus social network.” (Show mobile view.) |
| 0:45–1:45 | The 5 Hubs & Post Flow | “Notebook has 5 dedicated hubs: Academic, Transport, Health, Logistics, and General Life. Watch how easy it is to filter exam notices or publish a post with instant image compression and student ID attribution.” (Create post & react.) |
| 1:45–2:30 | Offline Resilience | “Campus Wi-Fi often drops in transit or basements. Watch what happens when I switch to offline mode — Notebook keeps working from cached storage and alerts the user with a smooth bottom status toast.” (Toggle offline in DevTools.) |
| 2:30–3:00 | Safety & Roadmap | “We’ve also built a Campus Safety Report Desk and One-Tap Emergency Directory. In Phase 2 we expand to GPS shuttle tracking and SMS emergency donor broadcasts. Thank you!” |
§7Documentation Suite
- PRD.md — Complete Product Requirements, User Personas, Feature Matrix & Roadmap.
- TECHNOLOGY.md — Technical Architecture, PostgreSQL 15 DDL, Security Posture & Performance Metrics.
- README.md — Comprehensive Project Overview and Hackathon Evaluation Guide.
§8Contributors & Acknowledgements
- Developer & Project Lead: Built for the Campus Hackathon Primary Selection.
- Pilot Campus: National Institute of Textile Engineering & Research (NITER).
- Special Thanks: Campus mentors, student beta testers, and open-source contributors.
Document 02 · PRD.md
Product Requirements Document
Notebook — Unified Campus Social & Real-Time Information Hub
§1Executive Summary & Vision
Modern higher-education campuses suffer from extreme digital fragmentation. Academic routines, exam updates, campus transit alerts, emergency blood donor appeals, and lost-and-found notices are dispersed across disconnected WhatsApp groups, Facebook pages, Telegram channels, and physical notice boards.
This chaos leads to information overload, missed academic deadlines, delayed transit notices, and dangerous bottlenecks during medical emergencies.
Notebook is a purpose-built, offline-capable Progressive Web Application (PWA) and verified campus social platform that unifies all essential student services into a centralized, fast, and accessible digital ecosystem.
“One Campus, One Feed, Zero Lost Notices.”
Notebook replaces the noise of unstructured messaging groups with categorized, real-time, searchable, and offline-accessible campus hubs tailored to the student lifestyle.
§2Competitive Landscape & Benchmark Analysis
| Dimension | WhatsApp / Messenger | Facebook Groups/Pages | Physical Notice Boards | Notebook |
|---|---|---|---|---|
| Information Structure | Chaotic chronological chat stream | Algorithmically demoted posts | Static, campus-bound only | 5 Categorized Functional Hubs |
| Emergency Blood Requests | Buried under general chatter | Low reach due to feed algorithms | Ineffective | Dedicated Health Tag & Urgent Filter |
| Offline Accessibility | Requires active internet | Fails completely offline | Physical only | PWA Caching & Bottom Toast Alerts |
| Campus Identity & Trust | Random phone numbers / aliases | External unverified accounts | Anonymous | Department, Year & Student ID Tagging |
| Searchability | Poor search across media | Fragmented keywords | None | Instant Real-Time Keyword Filter |
| Safety & Moderation | Admin ban only (reactive) | Generic Facebook reporting | None | Built-in Campus Safety & Report Desk |
§3Target User Personas & Journeys
Tanvir
2nd Year CSE student; commutes 20km daily by campus transport.
- Frustrations
- Misses abrupt bus departure changes, can’t find assignment deadlines when Wi-Fi is spotty in transit.
- Notebook Solution
- Checks the Transport Desk and reads cached academic posts offline while on the bus.
Sumaiya
3rd Year CR responsible for 60+ classmates.
- Frustrations
- Spends hours repeating routine changes, room reassignments, and lab schedules on WhatsApp.
- Notebook Solution
- Publishes official notices under the Academic Hub with permanent tags and reference bookmarks.
Dr. Rafiq / Club Volunteer
Campus medical volunteer coordinating emergency blood donations.
- Frustrations
- Broadcasts for urgent blood (e.g., O-Negative) go unnoticed or get answered hours too late.
- Notebook Solution
- Posts directly to the Emergency Health Hub with one-tap contact buttons for verified student donors.
Campus Administration
Student Affairs coordinator tasked with maintaining student well-being.
- Frustrations
- No structured channel to capture harassment complaints, lost property claims, or feedback.
- Notebook Solution
- Reviews prioritized tickets via the Campus Safety & Report Desk.
End-to-End User Journey Map
┌─────────────────┐ ┌───────────────────┐ ┌───────────────────┐
│ 1. ONBOARDING │ │ 2. DISCOVERY │ │ 3. INTERACTION │
│ • Quick Auth │───────▶│ • Choose Hub │───────▶│ • React (Upvote) │
│ • Student ID │ │ • Search & Filter │ │ • Thread Comment │
│ • Dept Tagging │ │ • Read Notices │ │ • Save / Bookmark │
└─────────────────┘ └───────────────────┘ └───────────────────┘
│
┌─────────────────┐ ┌─────────────────┐ │
│ 5. RECONNECTION │ │ 4. OFFLINE MODE │ │
│ • Sync Updates │◀──────│ • Cached Posts │◀────────────────────┘
│ • Status Toast │ │ • Local Storage │
│ • Realtime Pull │ │ • Bottom Alert │
└─────────────────┘ └─────────────────┘
§4Comprehensive Functional Requirements
Module 1 — Authentication, Identity & Recovery
- FR-1.1 Student Registration & Login: Email/password authentication via Supabase GoTrue with secure JWT session tokens.
- FR-1.2 Identity Tagging: Auto-extracts and records student name, department (CSE, TE, EEE, BBA, etc.), and academic year.
- FR-1.3 Integrated Password Recovery: Users initiate password reset emails directly inside the authentication modal.
- FR-1.4 Account Re-creation Safeguard: Handles re-registration cleanly by updating existing records without orphaned data.
Module 2 — Categorized Hub Feeds & Search Engine
- FR-2.1 Five Dedicated Functional Hubs: Home/General Academic Transport Logistics Health & Emergency
- FR-2.2 Instant Filter & Search: Real-time client-side substring and category filter with debounce for immediate results.
Module 3 — Post Creation & Media Engine
- FR-3.1 Rich Post Publishing: Title, formatted description, category assignment, and topic tags.
- FR-3.2 Client-Side Image Compression: Automated image scaling and base64 compression to conserve mobile bandwidth and storage quotas.
- FR-3.3 Author Identification Badge: Author avatar, full name, department chip, and human-readable relative timestamp (e.g., “5m ago”).
Module 4 — Community Engagement & Personal Vault
- FR-4.1 Multi-Sentiment Reactions: Upvote, Heart, and Helpful toggles.
- FR-4.2 Threaded Comments: Collapsible peer discussion section under every post with real-time UI updates.
- FR-4.3 Saved Vault (Bookmarks): Private one-click bookmarking for schedules and notices.
Module 5 — Progressive Web App (PWA) & Offline Engine
- FR-5.1 Installability: Manifest configuration enabling one-click “Add to Home Screen” on Android, iOS, Windows, and macOS.
- FR-5.2 Service Worker Caching: Intelligent caching of CSS, JS bundles, fonts, and assets for instant app boots.
- FR-5.3 Bottom Offline Notification: Animated bottom banner — “You are currently offline. Showing cached campus content.” — with automatic green reconnection confirmation.
Module 6 — Safety, Reporting & Emergency Support
- FR-6.1 Community Report Desk: Structured grievance submission for harassment, spam, misinformation, or academic violations.
- FR-6.2 Campus Emergency Directory: One-tap action buttons (WhatsApp, Phone Call, Email) connecting students to campus security, medical centers, and proctorial teams.
§5Non-Functional Requirements & Quality Standards
- NFR-1 Security & Privacy: All database mutations are protected with PostgreSQL Row-Level Security (RLS). Passwords are cryptographically hashed with bcrypt.
- NFR-2 Cross-Platform Compatibility: Fully responsive layout tested across mobile viewports (360px–428px), tablets (768px–1024px), and desktop displays (1280px+).
- NFR-3 Modularity & Maintainability: Zero monolithic spaghetti code — strict modular breakdown separating Auth, Feed, Navigation, Post-Interactions, and Pages.
§6Risk Analysis & Mitigation Strategy
| Identified Risk | Severity | Probability | Mitigation Strategy |
|---|---|---|---|
| Low connectivity during campus rush hours | High | High | Offline Service Worker caching with graceful fallback to cached feed data. |
| Spam / misinformation in emergency posts | High | Medium | Verified department identity tags and instantaneous community report queue. |
| Storage exhaustion from large image uploads | Medium | Medium | Client-side compression pipeline limits payloads before transmission. |
| Database rate limits during hackathon demo | Medium | Low | Dual-mode data fetching: live Supabase query with automatic local fallback state. |
§7Phased Product Roadmap
Hackathon MVP
Current Production Candidate- Complete Supabase Auth with Password Recovery & Profile Management
- 5 Functional Hubs (Academic, Transport, Logistics, Health, General)
- Real-time Reactions, Threaded Comments, and Saved Bookmarks
- Offline-First PWA with Smart Bottom Status Banner
- Campus Safety Report Desk & Emergency Directory
Post-Selection Scale & Integration
- Direct Peer-to-Peer Encrypted Chat & Classmate Messaging
- Live GPS Campus Shuttle Tracking on Interactive Map
- Automated Blood Donor Push Alerts (Matching Blood Group & Location)
- University Single Sign-On (SSO) & Student Portal API Integration
Inter-Campus Expansion
- Multi-University Federation (Inter-Campus Academic Contests)
- AI-Powered Routine & Exam Schedule Extractor from PDFs
- Campus Marketplace for Used Textbooks & Lab Equipment
§8Hackathon Evaluation Rubric Alignment
| Criterion | Weight | How Notebook Excels |
|---|---|---|
| Innovation & Impact | 30% | Directly solves the daily campus communication nightmare and life-critical blood donor bottleneck. |
| Technical Execution | 25% | PWA offline capability, sub-second performance, modular ES6+ architecture, and Supabase integration. |
| Design & User Experience | 25% | Intuitive 5-hub navigation, clean dark/light UI, responsive mobile-first ergonomics, and zero clutter. |
| Completeness & Viability | 20% | Fully working prototype with robust error handling, seed resilience, and a clear multi-phase roadmap. |
Document 03 · TECHNOLOGY.md
Technical Architecture & Engineering
Decoupled Client-First PWA with Backend-as-a-Service (BaaS)
§1System Architecture & End-to-End Data Pipeline
Notebook utilizes a high-performance Client-First Progressive Web Architecture. The frontend operates as a zero-runtime-overhead SPA that interfaces directly with Supabase cloud infrastructure through authenticated RESTful APIs and PostgreSQL Change Data Capture (CDC) WebSockets.
┌──────────────────────────────────────────────┐
│ STUDENT CLIENT │
│ PWA (Android / iOS / Windows / macOS / Web) │
└──────────────────────┬───────────────────────┘
│
┌─────────────────────┴─────────────────────┐
│ │
▼ ▼
┌─────────────────────────┐ ┌─────────────────────────┐
│ SERVICE WORKER (sw.js) │ │ MODULAR JAVASCRIPT CORE │
│ • Cache-First Assets │ │ • Feed & Comments Engine│
│ • Offline Interceptor │ │ • Auth & Session Mgr │
│ • Network State Bridge │ │ • Reactions & Bookmarks │
└────────────┬────────────┘ └────────────┬────────────┘
│ (Cache Hit / Fallback) │ (REST / WebSockets)
▼ ▼
┌─────────────────────────┐ ┌─────────────────────────┐
│ BROWSER STORAGE │ │ SUPABASE CLOUD │
│ • CacheStorage API │ │ • GoTrue Auth (JWT) │
│ • LocalStorage Vault │ │ • PostgreSQL 15 (RLS) │
│ • Session Storage │ │ • Realtime Channels │
└─────────────────────────┘ └─────────────────────────┘
§2Technology Stack Evaluation & Rationale
| Layer | Selected Tech | Alternative Considered | Why This Was Chosen |
|---|---|---|---|
| Frontend Core | Vanilla ES6+ Modules | React / Angular / Vue | Zero Runtime Overhead: boots in milliseconds on low-end budget smartphones; avoids virtual DOM memory pressure. |
| Styling & Design | Tailwind CSS v4 | CSS Modules / Styled-Components | Utility-First Speed: instant responsive styling, unified theme tokens, dark/light palette, minimal CSS footprint. |
| Vector Icons | Lucide Icons | FontAwesome / Material Icons | Sharp & Light: tree-shakeable SVG rendering with uniform stroke weights across high-DPI displays. |
| Build & Tooling | Vite 6 + TypeScript 5.8 | Webpack / Parcel | Sub-Second Compilation: lightning-fast HMR in dev, ultra-lean production bundling with asset hashing. |
| Backend & DB | Supabase (PostgreSQL 15) | Firebase / MongoDB | Relational Integrity & RLS: native SQL relationships between profiles, posts, and comments. |
| Authentication | Supabase GoTrue | Custom Node Auth Server | RFC-Compliant JWT: native bcrypt hashing, token auto-refresh, integrated SMTP password reset. |
| Offline Resilience | Native Service Worker (sw.js) | Workbox / Offline Plugins | Predictable Caching: direct control over asset strategies and the custom offline toast lifecycle. |
§3Database Schema & Data Modeling
Entity Relationship Diagram
┌─────────────────────────────────┐ ┌─────────────────────────────────┐
│ PROFILES │ 1 * │ POSTS │
├─────────────────────────────────┼───────────────┼─────────────────────────────────┤
│ id : UUID (PK) │ │ id : UUID / TEXT (PK) │
│ name : TEXT │ │ author_id : UUID (FK->profiles│
│ student_id : TEXT │ │ author_name : TEXT │
│ department : TEXT │ │ author_avatar:TEXT │
│ year : TEXT │ │ category : TEXT (Enum check) │
│ avatar_url : TEXT │ │ title : TEXT │
│ created_at : TIMESTAMPTZ │ │ content : TEXT │
│ updated_at : TIMESTAMPTZ │ │ image_url : TEXT (Base64/URL) │
└────────────────┬────────────────┘ │ likes : INTEGER │
│ │ reactions : JSONB │
│ 1 │ created_at : TIMESTAMPTZ │
│ └──────────────┬──────────────────┘
│ * │ 1
│ │ *
┌────────────────▼────────────────┐ ┌──────────────▼──────────────────┐
│ REPORTS │ │ COMMENTS │
├─────────────────────────────────┤ ├─────────────────────────────────┤
│ id : UUID (PK) │ │ id : UUID / TEXT (PK) │
│ reporter_id : UUID │ │ post_id : UUID (FK->posts) │
│ target_id : TEXT │ │ user_id : UUID (FK->profiles│
│ category : TEXT │ │ user_name : TEXT │
│ details : TEXT │ │ user_avatar : TEXT │
│ status : TEXT ('pending') │ │ text : TEXT │
│ created_at : TIMESTAMPTZ │ │ created_at : TIMESTAMPTZ │
└─────────────────────────────────┘ └─────────────────────────────────┘
Production DDL & Security Rules (PostgreSQL 15)
-- Enable UUID generation extension
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
-- 1. Profiles Table
CREATE TABLE public.profiles (
id UUID PRIMARY KEY REFERENCES auth.users(id) ON DELETE CASCADE,
name TEXT NOT NULL,
student_id TEXT,
department TEXT,
year TEXT,
avatar_url TEXT,
updated_at TIMESTAMP WITH TIME ZONE DEFAULT timezone('utc'::text, now()) NOT NULL,
created_at TIMESTAMP WITH TIME ZONE DEFAULT timezone('utc'::text, now()) NOT NULL
);
-- 2. Posts Table with Category Constraint
CREATE TABLE public.posts (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
author_id UUID REFERENCES public.profiles(id) ON DELETE SET NULL,
author_name TEXT NOT NULL,
author_avatar TEXT,
category TEXT NOT NULL CHECK (category IN ('home', 'academic', 'transport', 'logistics', 'health')),
title TEXT,
content TEXT NOT NULL,
image_url TEXT,
likes INTEGER DEFAULT 0,
reactions JSONB DEFAULT '{"upvote": 0, "heart": 0, "helpful": 0}'::jsonb,
created_at TIMESTAMP WITH TIME ZONE DEFAULT timezone('utc'::text, now()) NOT NULL
);
-- 3. Comments Table
CREATE TABLE public.comments (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
post_id UUID REFERENCES public.posts(id) ON DELETE CASCADE,
user_id UUID REFERENCES public.profiles(id) ON DELETE SET NULL,
user_name TEXT NOT NULL,
user_avatar TEXT,
text TEXT NOT NULL,
created_at TIMESTAMP WITH TIME ZONE DEFAULT timezone('utc'::text, now()) NOT NULL
);
-- 4. Reports Table for Campus Safety Desk
CREATE TABLE public.reports (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
reporter_id UUID REFERENCES auth.users(id) ON DELETE SET NULL,
target_id TEXT NOT NULL,
category TEXT NOT NULL,
details TEXT NOT NULL,
status TEXT DEFAULT 'pending' CHECK (status IN ('pending', 'reviewed', 'resolved')),
created_at TIMESTAMP WITH TIME ZONE DEFAULT timezone('utc'::text, now()) NOT NULL
);
-- Indexes for Sub-Second Query Execution
CREATE INDEX idx_posts_category ON public.posts(category);
CREATE INDEX idx_posts_created_at ON public.posts(created_at DESC);
CREATE INDEX idx_comments_post_id ON public.comments(post_id);
-- Enable Row-Level Security (RLS)
ALTER TABLE public.profiles ENABLE ROW LEVEL SECURITY;
ALTER TABLE public.posts ENABLE ROW LEVEL SECURITY;
ALTER TABLE public.comments ENABLE ROW LEVEL SECURITY;
ALTER TABLE public.reports ENABLE ROW LEVEL SECURITY;
-- RLS Policy: Public read for campus posts
CREATE POLICY "Public profiles can read posts" ON public.posts
FOR SELECT USING (true);
-- RLS Policy: Authenticated users can insert posts
CREATE POLICY "Authenticated users can create posts" ON public.posts
FOR INSERT WITH CHECK (auth.role() = 'authenticated');
-- RLS Policy: Users can only update/delete their own posts
CREATE POLICY "Authors can update own posts" ON public.posts
FOR UPDATE USING (auth.uid() = author_id);
CREATE POLICY "Authors can delete own posts" ON public.posts
FOR DELETE USING (auth.uid() = author_id);
§4Frontend Architecture & Directory Map
├── /css
│ ├── /base
│ │ ├── reset.css # Modern box-sizing & clean baseline styles
│ │ ├── typography.css # Display & body font pairings with mathematical scaling
│ │ └── animations.css # Smooth micro-interactions & entry keyframes
│ ├── /components
│ │ ├── auth-modal.css # Tabbed Login, Signup & Forgot Password overlay
│ │ ├── create-post.css # Rich post creation modal with image preview
│ │ ├── cards.css # Modular quick-action cards for each campus hub
│ │ ├── feed.css # Clean feed cards, reaction pills & comments
│ │ └── pwa.css # Bottom offline alert & install banner styles
│ ├── /layout
│ │ ├── navbar.css # Sticky desktop & mobile top navigation bar
│ │ ├── sidebar.css # Adaptive left navigation panel
│ │ └── main-layout.css # Responsive container grids & breakpoints
│ └── /pages
│ ├── friends.css # Classmate discovery & campus network styling
│ ├── profile.css # Student profile header, badges & activity
│ ├── saved.css # Private bookmarking vault view
│ ├── support.css # Emergency helpline directory
│ ├── report.css # Campus safety & moderation desk
│ └── settings.css # Preference controls & theme toggles
│
├── /js
│ ├── /config
│ │ └── supabase.js # Supabase client singleton & environment configuration
│ ├── /modules
│ │ ├── auth.js # User session, login, signup, and password recovery
│ │ ├── feed.js # Post rendering, category switching & search filtering
│ │ ├── post-interactions.js # Upvote, Heart, Helpful reaction engine & bookmarks
│ │ ├── comments.js # Threaded discussion fetching & publishing
│ │ ├── navigation.js # SPA route manager & active module state
│ │ ├── pwa.js # Online/offline network monitor & install prompt
│ │ └── realtime.js # Supabase Realtime broadcast listener
│ ├── /pages
│ │ ├── profile.js # Profile page data binding & edit handler
│ │ ├── saved.js # Bookmarks storage retrieval & render engine
│ │ ├── support.js # Emergency contact shortcuts & FAQs
│ │ └── report.js # Moderation ticket generator
│ └── main.js # App bootstrap, DOM bindings & global event orchestration
│
├── /sw.js # Offline Service Worker cache engine
├── manifest.json # Web App Manifest specification
└── index.html # Semantic HTML5 root entry point
§5Offline-First PWA Implementation
Service Worker Caching Pipeline (sw.js)
HTTP Fetch Request
│
▼
┌──────────────┐ Cache Hit
│ ServiceWorker│──────────────▶ Return Cached Static Asset (<10ms)
└──────┬───────┘
│ Cache Miss
▼
┌──────────────┐ Online
│ Network Fetch│──────────────▶ Return Fresh Data & Update Cache
└──────┬───────┘
│ Offline / Failed
▼
┌──────────────┐
│ Offline Mode │──────────────▶ Trigger Bottom Alert & Return Cached Feed State
└──────────────┘
Dynamic Network Status Controller (/js/modules/pwa.js)
- State Detection: watches
window.addEventListener('offline')and'online'. - Non-Intrusive Bottom Banner: when offline, slides up a discrete bottom banner:
<div id="pwa-offline-banner" class="pwa-offline-banner visible">
<span class="pwa-status-dot"></span>
You are currently offline. Showing cached campus content.
</div>
- Seamless Reconnection: when the connection is re-established, the banner updates with a green dot and confirmation (“Back online! Connection restored.”) before smoothly exiting.
§6Performance Benchmarks & Build Pipeline
Measured Lighthouse Results
Build & Verification Commands
# Execute static type checking and linting
npm run lint
# Production compilation and minification
npm run build
# Launch local preview server
npm run preview