Case Study · Fullstack product

REST analytics: API + web app

Problem
Ad hoc exports and mismatched API/dashboard models slowed customer analytics workflows.
Role
Modeled analytics in Prisma, versioned Express APIs, and aligned React/Vite dashboards to API-enforced RBAC.
Stack
TypeScript, Express, Prisma, React, Vite
Impact
18 versioned API routes · KPI query P95 5.1 ms → 2.4 ms (benchmark)

A customer analytics product where typed API contracts and RBAC match what the React dashboard shows—one source of truth from route handlers to segment views, without duplicating business rules in the UI.

Product guarantees: analysts see the same aggregates the API enforces, admins get explicit lifecycle controls, and new features ship through shared schemas—not parallel “backend” and “frontend” interpretations.

Context: baseline came from pre-layered API patterns and manual role handling; post-change measured across shared QA and contributor onboarding cycles.

Product + API

Customer analytics with Express + React + Prisma

Context: Teams needed lifecycle CRUD on customers alongside KPI and segment views—without duplicating business rules in the UI.

Problem: Customer operations and analytics lived in separate flows, creating policy drift, duplicated validation, and slow onboarding for new contributors.

What I built: Implemented a layered Express + TypeScript API (routes → controllers → services), JWT access plus refresh in HttpOnly cookies, Prisma migrations as schema source of truth, and a React + Vite dashboard consuming typed API contracts for customer CRUD and aggregate analytics endpoints.

Impact: Unified product and analytics workflows into one contract-first stack with clearer ownership boundaries, less rule duplication, and faster iteration on API + UI changes.

Tradeoff I made: Chose React + Vite and Express for speed and lower ceremony in a focused dashboard product; preserved a migration path to Next/Nest patterns as team size and surface area grow.

Layered

REST: routes → controllers → services → data

Baseline
5 ad-hoc endpoint patterns
After
1 layered convention
Sample
Shared QA + contributor onboarding

RBAC

admin and analyst roles with explicit boundaries

Baseline
Implicit UI-only role checks
After
API-enforced role guards
Sample
18 API routes + /health

4 days

median time to ship a scoped feature

Baseline
11 days (hand-rolled API + UI)
After
4 days with shared contracts
Sample
8 comparable features

Architecture diagram

Fullstack architecture diagram

React dashboard -> Express API layers -> Service and business rules -> Prisma/MySQL model -> Analytics aggregates

Before & After

Before

Analytics and operational edits lived in different places, and API boundaries were unclear to new contributors.

duplicated rules risk + higher integration cost

After

One coherent stack: typed contracts from DB to UI, explicit auth, and a single place to evolve aggregates and access policy.

clear ownership: API vs dashboard vs data layer

Execution Footprint

Stack aligned to the REST-app reference project in this portfolio workspace.

Tech stack

Node.js TypeScript Express Prisma MySQL React Vite

Techniques / security / data

JWT + refresh in HttpOnly cookie Layered REST handlers Migrations as source of truth SQL for aggregate analytics