Skip to content
anushkaanairPublic

About

Pulse — market on your fingertips. A per-user diff engine over a fault-injecting simulated market feed (Express/TS/Postgres + Next.js/TS/Tailwind). Built for Code, by Groww.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Pulse

Live app: pulse-groww.vercel.app

Pulse is a market watchlist that doesn't just show prices — it tells you exactly what meaningfully changed since you last looked, ranked by how unusual it is for that specific stock, over a feed that behaves like a real one: delayed, occasionally out of order, sometimes duplicated, sometimes corrected.

Full reasoning: DECISIONS.md (every non-obvious choice, including three bugs found and fixed by the test suite itself), RESILIENCE.md (failure modes and how the system degrades), and DESIGN_SYSTEM.md (the UI language).

Features

  • Attention logic + Attention Deck — every tick is scored for how unusual it is for that specific stock (a z-score against its own trailing volatility, sector-adjusted where available), scaled by how long you've been away, and the top movers render as a ranked 3D card deck — depth mirrors how much each move actually matters, not just a flat list of everything that moved.
  • Personalization — every card you open is remembered and weighted into future ranking; "Snooze for 24h" suppresses a symbol from the deck for a day. Both are real per-user server-side state, not a client-side hide.
  • Paper trading — a notional ₹1,000-per-symbol basket over your watchlist, priced off real live quotes (1D return, total return, vs-NIFTY benchmark), with a per-stock breakdown page — never real money, never a real broker.
  • Live ticker — prices move on their own from a fault-injecting market simulator (real delay, out-of-order, duplicate, and corrected ticks), not a static snapshot.
  • Sensitivity (quiet / normal / loud) — a per-symbol override on how much movement counts as "meaningful" for that stock, so a naturally volatile stock doesn't drown out a quiet one.
  • History — a plain diff between any two past visits (top/bottom performer, average watchlist delta, per-stock % change), filterable and sortable.
  • Bulk editing — paste a comma-separated list of symbols to replace an entire watchlist in one save, with conflict resolution (keep mine / keep theirs / merge) if it changed elsewhere in the meantime.
  • Multiple watchlists — create and switch between separate watchlists from /app, each with its own baseline, history, and paper portfolio.
  • The "second clock" + retractions — a significant move is tracked independently of your visits, so "quiet for weeks, just woke up" is a real signal, not a visit-count artifact; if a triggering tick is later corrected below threshold, that's shown as a visible retraction, never silently dropped.
  • Attention budget — caps how many cards the deck can surface at once, so a genuinely volatile day is a triage, not a flood of everything that moved.
  • Sparklines — a per-symbol price-history mini-chart inside each expanded attention card.
  • Starter watchlist packs — one-click preset symbol lists so a brand new, empty watchlist isn't a dead end.
  • Market Rail + Market Trends — a live scrolling ticker and sector-level trend summary on the dashboard, independent of your own watchlist.
  • List virtualization — kicks in above 100 tracked symbols, so the full list stays smooth at scale instead of degrading with watchlist size.
  • Dark / light theme toggle.
  • Built-in demo walkthrough — a guided first-run tour of the product for a new visitor, not just a cold empty screen.

Screenshots

Live captures from the deployed app, running against the real backend (real Postgres, real simulated feed) — not mocked.

Home — same visual language as Groww on purpose; a live ticker, not a screenshot. Homepage

Watchlist — the ranked attention deck ("3 worth a look"), the full tracked-stock list, and the live paper portfolio. Watchlist

Personalization — every card opened is remembered and weighted into future ranking; "Snooze for 24h" suppresses a symbol from the deck for a day, a real per-user suppression, not a client-side hide. Personalization

Quick start

Requires Node 20+, Docker, npm.

# 1. Database
docker compose up -d
cd backend && npm install

# 2. Migrate + run
npm run migrate
npm run dev          # http://localhost:4000

# 3. Frontend, in a second terminal
cd ../frontend && npm install
npm run dev           # http://localhost:3000

Check it's alive: curl localhost:4000/health should return {"status":"ok", ...} once the simulated feed has ticked at least once (within ~1s).

Prove it's correct

cd backend
npm test              # unit tests for the change-ranking engine
npm run torture       # the real proof — see below

npm run torture spawns the actual server, drives tens of thousands of ticks with injected out-of-order/duplicate/corrected data, fires concurrent conflicting writes, kills the server with SIGKILL mid-run, respawns it, and checks 21 invariants — idempotency, monotonic price ordering, conflict resolution, diff correctness against an independent oracle, checkpoint exactness, staleness honesty through a real outage, and crash safety. It's designed to be run live, not just trusted: the exit code is the proof.

Architecture, in one paragraph

One shared ingestor polls the union of every watched symbol once (not once per user) from a fault-injecting market simulator, writing to Postgres with a monotonic upsert so a late or duplicate tick can never regress a price. Each user's "what changed" is computed on read, diffed against a snapshots row capturing exactly what they were shown last time — not a timestamp, so it's immune to the feed later rewriting the past. "Meaningful" is a z-score against the stock's own trailing volatility, scaled by how long the user's been away, with a per-symbol quiet/normal/loud override. Full diagram and schema: DECISIONS.md.

Project structure

backend/                 Express + TypeScript + Postgres
  src/market/            fault-injecting simulator + ingestor
  src/changes/           the engine — significance, ranking, digest (pure, unit-tested)
  src/routes/            HTTP layer
  src/db/migrations/     schema, applied on `npm run migrate`
  scripts/torture.ts     the invariant proof — see above
frontend/                Next.js + TypeScript + Tailwind
docs (repo root)          DECISIONS, RESILIENCE, DESIGN_SYSTEM, PITCH

Environment variables

Backend (backend/.env.example): DATABASE_URL, PORT (default 4000), TICK_MS, SIM_SEED, SIM_ADMIN (exposes fault-injection endpoint), STALE_AFTER_SECONDS, and the "meaningful" thresholds (Z_THRESHOLD, HISTORY_WINDOW, ABS_THRESHOLD_PCT, VOLUME_SPIKE_MULTIPLE, GAP_PCT) — all documented inline, all product decisions rather than magic numbers.

Frontend (frontend/.env.local): NEXT_PUBLIC_API_URL must point at the backend (default http://localhost:4000), NEXT_PUBLIC_USE_MOCK toggles the mock data layer, NEXT_PUBLIC_SIM_ADMIN shows the fault-injection dev panel.

Demo the resilience live

With both servers running:

curl -X POST localhost:4000/api/_sim/faults \
  -H "Content-Type: application/json" \
  -d '{"outage":true}'

Watch the UI degrade honestly (stale badges, feed status banner) instead of breaking or lying about freshness. Clear it with {"outage":false}.

Known limitations (deliberate — see DECISIONS.md)

No real authentication (X-User-Id header only), no WebSockets (polling + ETag by design — the problem is state-on-return, not live ticking), no real broker/exchange feed by default (the fault-injecting simulator is the point — it makes "unreliable dependency" demoable on command), no historical charts, no multi-user sharing.

About

Pulse — market on your fingertips. A per-user diff engine over a fault-injecting simulated market feed (Express/TS/Postgres + Next.js/TS/Tailwind). Built for Code, by Groww.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages