All projects
Full-stack web application

Emergency Social Network

A real-time community platform for disaster-affected neighborhoods combining safety updates, messaging, emergency map coordination, volunteer workflows, and role-based administration.

Overview

Emergency Social Network (ESN) is a completed team-built full-stack web application designed to help small communities communicate and coordinate during natural disasters.

Built intentionally without frontend frameworks—using vanilla JavaScript ES modules, CSS custom properties, Node.js, Express 5, PostgreSQL, Socket.IO, and Leaflet—the application brings together real-time safety status sharing, public and private messaging, official announcements, contextual search, an interactive emergency map with Karma-incentivized volunteer assistance, skill-based help requests, shift duty handovers, disaster-preparedness training and challenges, pet recovery, and full role-based user administration.

Key features

  1. Join the community and share safety status. Register, log in, and browse a live citizen directory ordered online first and alphabetically. Share OK, Help, or Emergency status with real-time broadcasts and an atomic, deduplicated status history.

  2. Communicate publicly, privately, and via announcements. Exchange messages on a public wall and in persistent one-to-one private chats with unread counts, read acknowledgments, optional shared-location attachments, and Coordinator/Administrator-restricted community announcements.

  3. Search information in context. Filter citizens by username or safety status, search public messages, announcements, and private conversations in ten-result batches, and inspect a peer’s ten latest safety-status changes.

  4. Coordinate help on an interactive emergency map. Drop and filter urgency pins on a Leaflet map, attach pins to messages, claim assistance requests with directions, and confirm mutual completion to award 10 Karma redeemable for profile customizations.

  5. Match volunteers, hand over duties, and train readiness. Register emergency skills and route help requests to available volunteers, manage shift notebooks and AI-assisted duty handovers, complete disaster-preparedness lessons, graded readiness tests, and timed peer challenges, and coordinate volunteer-assisted pet recovery.

  6. Administer accounts and test throughput safely. Administrators manage user profiles, Citizen/Coordinator/Administrator privileges, Karma balances, and active/inactive account status (with immediate token and socket revocation), and can run isolated POST/GET speed tests against a disposable PostgreSQL database.

  7. Adapt the interface for accessibility. Tabbed settings provide theme switching, token-based large and extra-large text scaling without breaking map hit-testing, self-service password updates, and an in-app Help and FAQ guide.

Engineering

Architecture

ESN is built as a modular monorepo with a framework-free vanilla JavaScript (ES modules) client, a Node.js and Express 5 REST API, PostgreSQL 16 persistence, and Socket.IO for real-time presence, messaging, map alerts, and challenge updates.

LayerResponsibility
Client (client/)Responsive HTML/CSS/JS views, Leaflet map, accessibility modes, API clients, and Socket.IO event bridge
Shared (common/)Shared socket events, role/status constants, customization catalogs, and domain rules
Routes & middleware (server/routes/, server/middleware/)REST namespaces, JWT verification, RBAC privilege enforcement, inactive-account rejection, idempotency, and speed-test traffic suspension
Controllers (server/controllers/)Request validation, ownership checks, and use-case coordination across communication, map, volunteer, training, duty, pet-recovery, and admin flows
Models & strategies (server/models/, server/strategies/)Domain behavior, Observer-pattern private chat subjects, Strategy-pattern contextual search, and SQL persistence
Data access & sockets (server/dao/, server/sockets/)PostgreSQL pool management, AsyncLocalStorage-isolated speed-test pools, and account-ID-scoped Socket.IO rooms

The Express application (server/app.js) is decoupled from server startup and database listeners so unit and HTTP contract suites can import it cleanly.

Design patterns and security

Private messaging implements the Observer pattern: PrivateChat subjects persist messages and notify registered observers, with a Socket.IO observer delivering messages and unread alerts exclusively to server-verified account-ID rooms. Contextual search implements the Strategy pattern behind SearchContext for usernames, safety statuses, announcements, public messages, private conversations, and peer status history.

Authentication uses bcrypt password hashing and JWT verification across HTTP endpoints and Socket.IO connections. Role-based middleware enforces Coordinator/Administrator permissions on announcements and Administrator permissions on profile administration and speed testing. Deactivating an account immediately blocks subsequent /api requests via rejectInactiveBearerToken and terminates live socket sessions. SQL queries bind parameters throughout, and dynamic text renders via DOM textContent.

Validation, maintainability, and delivery

The completed repository contains 174 Jest unit test suites (covering pure domain rules, controllers, middleware, views, and Socket.IO handlers) and 33 PostgreSQL-backed integration suites executing against a dedicated test database.

GitHub Actions runs ESLint and unit tests with coverage on pushes and pull requests, paired with Sigrid static maintainability analysis for unit size and duplication checks. Deployment workflows build a production Docker image, publish to GitHub Container Registry, and trigger Render deployment hooks.

My contribution

Across five iterations (60 commits), my work spanned backend architecture, real-time workflows, administration, and frontend design:

  • Core auth, messaging, search, and throughput testing. Implemented JWT login/logout authentication and Socket.IO presence, Observer-pattern private messaging, community announcements, batch-loaded contextual search, and the disposable-database speed-test engine.
  • Emergency map and Karma workflows. Built the Leaflet location-sharing and message-attachment flows, pin-response and mutual completion workflow with automatic pin cleanup, and map/shop navigation and filtering.
  • User profile administration and account controls. Implemented the Administrator user-profile management workflow, privilege and inactive-account enforcement across HTTP routes and sockets, admin Karma controls, and self-service password changes.
  • Frontend redesign, accessibility, and maintainability. Led the frontend visual redesign, built token-based accessibility/usability modes and tabbed settings, authored REST API specifications, refactored duplication and unit size for Sigrid quality checks, and expanded automated test coverage.

Challenges and solutions

Coordinate real-time state across many independent workflows

As the platform grew from core messaging to map pins, volunteer skills, duty handovers, readiness challenges, pet recovery, and profile administration, multiple live events needed to stay consistent across open browser tabs without leaking private data.

Socket rooms are keyed strictly to server-verified account IDs rather than usernames, preventing spoofed or colliding room delivery. Client views track active screens and session state before applying asynchronous updates, and inactive-account changes propagate immediately to both HTTP middleware and live sockets.

Isolate destructive load tests from live community data

Speed testing required exercising high-volume POST and GET throughput without polluting or locking real citizen records.

Performance runs provision a disposable PostgreSQL database and use Node’s AsyncLocalStorage to route test requests to an isolated connection pool while middleware suspends ordinary API endpoints with 503. Phase transitions drain in-flight writes before reads begin, cleanup waits for pending work, and a watchdog recovers abandoned sessions.

Scale accessibility without breaking interactive maps

Early text-enlargement relied on CSS zoom, which skewed pointer coordinates inside Leaflet maps. Replacing zoom with native CSS custom-property typography and tap-target tokens (large and xlarge modes) preserved accurate map hit-testing while scaling controls across the application.

Maintain code quality across a multi-developer monorepo

Integrating five team members’ theme-specific modules alongside shared communication features created unit-size and duplication pressure under Sigrid maintainability gates. Refactoring shared HTTP/view helpers, splitting large controllers and views, and standardizing REST contracts (including retiring legacy action-verb routes cleanly) kept the codebase cohesive through Iteration 5.

Outcomes

ESN was completed across five course iterations as a full-stack, zero-framework disaster response platform uniting core communication, interactive mapping, volunteer coordination, preparedness training, duty handover, pet recovery, and role-based administration in a single cohesive interface.

DimensionDelivered in completed repository
Core workflowsRegistration/auth, live presence, safety status & history, public wall, private chat, announcements, contextual search, isolated speed test
Community modulesEmergency map & Karma, volunteer skill matching, duty handover with AI-assisted briefs, preparedness learning & timed challenges, pet recovery
Governance & UXRole-based access control, admin profile & Karma management, inactive-account revocation, self-service password change, accessibility modes & Help/FAQ
Automated verification174 Jest unit test suites, 33 PostgreSQL integration test suites, ESLint, Sigrid maintainability workflows, and Docker/Render CI delivery

Automated suites verify API contracts, domain rules, socket isolation, and view behavior locally and in CI; live production traffic metrics and real-world disaster deployment reliability are outside the scope of this course project.