PULSE: Multi-Tenant Project Intelligence Platform Case Study

PULSE is a full-stack SaaS platform that moves beyond traditional project tracking by computing work pressure, silence, and drift in real time rather than storing static state. The platform demonstrates deliberate architectural decisions: tenant isolation enforced by PostgreSQL row-level security as a backstop behind application filters; real-time collaboration built on LISTEN/NOTIFY primitives rather than third-party message brokers; pressure signals derived at read time from activity logs rather than computed on a schedule; and a design system where every color carries its measured WCAG contrast ratio in source. Built with Next.js, React, PostgreSQL, and Drizzle ORM, PULSE encompasses 26,200+ lines of application code, 47 components, 23 database tables (16 protected by RLS), and ~11,000 lines of Playwright verification covering drag-and-drop, live sync, and tenant boundary scenarios.

Service
Web Development
Industry
SaaS, Project Management, Software Tools
Category
FULL-STACK ENGINEERING

Built with: Next.js, PostgreSQL, React, Drizzle.

Overview

The Problem

  • Most project trackers report only task status changes and cannot detect stalled or quietly converging work, making a dormant board indistinguishable from a healthy one until deadlines expose the truth
  • Multi-tenant SaaS platforms typically rely on application code alone for tenant isolation, leaving cross-tenant data leaks just one missing WHERE clause away
  • Real-time collaboration is typically added as a third-party service (Pusher, Ably, Socket.io), introducing a new vendor, a new bill, and a new failure mode for a capability the database already provides natively
  • Risk flags are usually computed on a schedule and stored, becoming stale the moment the clock advances and nothing re-runs
  • Complex filtering and grouping controls become overloaded and difficult to distinguish, reducing clarity about what data is actually being displayed

The Solution

  • Signal computation at read time: pressure, silence, and drift are computed fresh from the activity log on every request and never stored, making them structurally incapable of going stale
  • Dual-layer tenant isolation: an explicit organizational filter in every query serves as the control, backed by a PostgreSQL row-level security policy that catches forgotten filters as a backstop
  • Real-time built on database primitives: one LISTEN/NOTIFY channel and one Server-Sent Events route replaces message brokers entirely, with commit-guaranteed event ordering and zero client-side state reconciliation
  • Activity-first write path: every mutation records its own event in the same transaction as the change, ensuring the activity log and data state never disagree
  • Measured design system: every color carries its WCAG contrast ratio computed and checked into source, with two intentional surfaces (dark instrument panels and light paper) to ensure legibility of brand hues
  • Fractional-index order keys for drag-and-drop: reordering inserts a lexicographically sortable key between two items without touching any other row, making optimistic client updates always correct

Solution Workflow

  1. Capture
  2. Store
  3. Broadcast
  4. Render
  5. Sync

Full Technical Breakdown

Multi-Tenant Schema & Row-Level Security

23 tables with 16 enforced by PostgreSQL row-level security under one shared isolation policy. The application connects as pulse_app, a role that owns no objects and is subject to RLS by construction. Every table carries a one-line policy checking organization_id via current_setting, with no bypass GUC available. Application-layer WHERE filters serve as the control; RLS serves as the backstop, demonstrating defense-in-depth security at the schema level.

Real-Time Subsystem via LISTEN/NOTIFY and SSE

One Postgres LISTEN/NOTIFY channel drives a single Server-Sent Events route with one client hook. Events fire only on commit, guaranteeing a client never observes an event before the change is durable. Events carry metadata (seq, verb, projectId, taskId) only, never data payloads, forcing clients to re-fetch through the same authenticated, visibility-checked queries that governed the page. Zero Redis pub/sub, zero third-party realtime vendor.

Derived Signals and Activity-First Write Path

All pressure signals (overdue, due now, stalled, carried) are computed at read time from the activity log rather than stored as state, preventing staleness. A recordActivity function is the single writer to the activity table; every mutation records its event in the same transaction as the change itself. The activity log serves as the source of truth for the feed, notifications, dwell-time history, and trace sparklines without any disagreement.

Order Keys, Not Integer Positions

Reordering a board integer-by-integer renumbers every row after the insertion point — which turns optimistic drag-and-drop into a lie, since the client can't predict the server's renumbering and the card visibly snaps back. PULSE uses fractional indexing instead: a lexicographically sortable string key, so inserting between two cards produces a key strictly between them without touching any other row. One drag, one row write, and the optimistic position is always the final one.

recordActivity — ONE WRITER, ONE TRUTH

Every mutation records its own event inside the same database transaction as the state change it describes. Exactly one function in the codebase is permitted to write to the activity table. That single rule is what lets the trace, the feed, notifications, and dwell-time history all read from one log without ever disagreeing — a log a state change can outrun is worse than no log at all.

Design System with Math Shown

The brand palette, measured plainly, is an ink palette — its signature red scores 1.24:1 against the dark surface it was designed for, well under the 3:1 floor for legibility. Rather than force it, the system uses two surfaces on purpose: dark instrument panels carry brand hues as tinted strokes at graded opacity, while light paper panels carry those same hues at full literal strength as ink, where they clear AA outright.

Results

Key Features

  • The Board with Drag-and-Drop: Zone-grouped columns (queue, in flight, shipped) with fractional-index order keys enabling one-row writes per drag. Bottleneck detection shows where dwell time actually spikes. Per-project trace sparklines in the rail keep every other project's state one glance away.
  • The Ledger (List View): The same board read as a register with every measure in a fixed column for row-to-row comparison. Ordering by pressure bands rows into overdue, due-now, stalled, and carried groups. Count badges prove they match the portfolio header.
  • The Work Record: Due dates set by placing a marker on a scaled timeline instead of typing into a date picker. Overrun is drawn to scale so visual representation matches magnitude. A stage track with live dwell clock and a priority meter that fills instead of radio buttons.
  • Personal Field: A page centered on a person rather than a project, showing everything an individual carries across all projects, banded by the same pressure logic as the board, with no duplicate assignment data.
  • Live Collaboration: Teammate changes appear where you are already looking and settle without toast notifications or client-side reconciliation logic, powered by a single SSE connection.
  • Activity Trail: Every event serves as a door back into the work, the actor, or the day itself, all sourced from the same activity log that powers pressure signals and trace rendering.

Before

Before PULSE, project tracking platforms lacked the ability to detect work stalled in-flight; a dormant board was indistinguishable from quiet convergence. Tenant isolation relied entirely on application code, leaving each production deployment one missed WHERE clause away from a cross-tenant data leak. Real-time collaboration required adding a third-party service like Pusher or Socket.io, introducing a new vendor dependency, an additional bill, and a new failure mode. Risk signals like "at risk" or "overdue" were computed on a schedule and stored as state, becoming wrong the moment the clock advanced and no cron job re-ran. Complex filtering and grouping controls were often overloaded into a single UI element, making it unclear what restrictions were actually applied. Drag-and-drop reordering required renumbering rows, making client-side optimistic updates always incorrect and causing visible snap-back after the server response.

After

PULSE ships with real-time pressure signals computed at read time from the activity log, making them structurally incapable of going stale. Tenant isolation is enforced twice: an explicit filter in every query paired with PostgreSQL row-level security as a backstop that catches forgotten filters by construction. Real-time collaboration flows through a single LISTEN/NOTIFY channel and Server-Sent Events route with no message broker; events are commit-guaranteed and carry only metadata, forcing clients to re-fetch through authenticated, visibility-checked queries. Drag-and-drop uses fractional-index order keys, requiring only one row write per drag with the optimistic client position always correct. The design system is measured, with every color carrying its computed WCAG contrast ratio in source, ensuring legibility across both dark instrument panels and light paper surfaces. The activity log is the single source of truth for all derived features, preventing disagreement between the trace, feed, notifications, and dwell-time history.

What This Proves

PULSE demonstrates that full-stack engineering means more than integrating existing libraries and frameworks. It shows the difference between inheriting architectural defaults and making deliberate choices: storing tenant isolation at the database layer as a backstop behind application filters rather than trusting code alone; building real-time from a database primitive already running instead of reflexively adding a third-party broker; treating staleness as an architectural problem with a real answer (derive signals at read time) rather than a caching problem to paper over; and shipping a design system with its accessibility math shown in source, not asserted in a guide. The codebase demonstrates this discipline across 26,200+ lines of application source, 47 React components, 23 database tables (16 protected by RLS), 273 automated unit tests, and ~11,000 lines of Playwright verification driving real drag-and-drop, live sync, and tenant-boundary scenarios. Every figure is measured directly from the repository, not projected. This is what a senior full-stack engineer's default settings look like when nothing is templated and nothing is left for code review to catch.

Tech Stack

Frontend Layer

  • Next.js App Router — Server-first rendering framework with server components as default and server actions as the single mutation surface
  • React 19 — Client-side component library with server-first defaults and client state reserved for UI concerns like drag position
  • Zustand — Lightweight state management for shared UI state that survives lens switches
  • Tailwind CSS v4 — Utility-first CSS with every color and spacing value tracing to a single token file

Real-Time & Design

  • Server-Sent Events — One-directional real-time transport for database notifications without a return channel
  • CSS Custom Properties — Design token system with measured contrast ratios computed and versioned in source

Testing & Deployment

  • Vitest — Unit testing framework for pure logic including order keys, signal ranking, and time calculations
  • Playwright — End-to-end browser testing covering drag-and-drop, live sync, accessibility, and tenant boundary scenarios
  • Docker Compose — Local development environment maintaining parity with production PostgreSQL and Redis
  • Vercel — Deployment platform for edge-deployed Next.js with zero-config preview environments

Data & Security Layer

  • PostgreSQL 16 — Primary database with row-level security, LISTEN/NOTIFY, and transactional guarantees the product depends on
  • Drizzle ORM — Type-safe query builder that reads like the SQL it generates with migrations as reviewable diffs
  • Better-Auth — Authentication library with organization-scoped sessions and permission checks in every server action
  • Redis — Session and cache layer deliberately kept out of the correctness path

Scalability & Flexibility

  • Multi-Tenant Onboarding: Adding a new organization is a single insert into the organizations table. The shared RLS policy and every query filter generalize to any organization_id without code changes or redeployment.
  • New Lenses and Views: Calendar and timeline views exist in navigation as disabled routes today. Routing and layout contracts are complete; each view requires only a new query function, not an application rebuild.
  • Event Type Expansion: The live-scope model (me, project, task) generalizes to any future event type. Adding a new verb requires only a new case in one switch statement in the event-dispatch logic.
  • Security Policy Inheritance: The two-role security pattern (pulse_app + schema_owner) applies to any table added later by construction, not by remembering to write a new policy for each table.
  • Token-Based Theming: White-label or workspace-specific themes are new token values in the CSS custom-property file, not find-and-replace across components.

Live Preview

Live site: https://pulse-five-pi.vercel.app/

About Nexoryn Nexoryn Services Nexoryn Portfolio Client Reviews Contact Nexoryn Privacy Policy Terms of Service Cookie Policy