Skip to main content
All notes

How Anjeer Labs Built a Real-Time Analytics Dashboard for a Business Processing ₹20L/Month

Published · 5 min read · Updated

Anjeer Labs built a real-time analytics dashboard for a ₹20L/month business using Next.js, Node.js, Redis, PostgreSQL, and WebSockets. The system delivers sub-second, duplicate-free live metrics for revenue, users, and conversions. With a monolithic architecture, Redis pipelines, and scalable DigitalOcean infrastructure, founders get accurate, actionable data instantly—enabling faster decisions at scale.

How Anjeer Labs Built a Real-Time Analytics Dashboard for a Business Processing 20L/Month

What it takes to build a dashboard founders can actually trust — and act on.


The Problem With Most Analytics Dashboards

Most analytics dashboards lie — not with wrong data, but with old data.

By the time a founder opens their dashboard and sees a spike in drop-offs or a sudden revenue dip, the moment to respond has already passed. For businesses operating at scale, that delay isn't just inconvenient. It's costly.

When a client came to us processing over 20 lakhs in monthly transactions, they had exactly this problem. They were flying blind in near-real-time watching metrics that were always minutes or hours behind, unable to trust whether the numbers were even accurate.

They needed a live analytics dashboard:

  • Real active user counts
  • Real revenue figures
  • Real conversion rates
  • Updating as events happened, not after the fact

This is how we built it.


Starting With Strategy, Not Code

Before any architecture decisions, we defined what success looked like:

  • Live metrics with sub-one-second latency
  • Reliable data with no duplicate counting
  • A system that could scale without a full rebuild

We also established:

  • Weekly client updates
  • Working prototypes from day one

This isn't just good communication — it's good engineering. Catching a flawed data model or a broken tracking assumption in a prototype costs a fraction of fixing it after full implementation.

Every major technical decision was tested against a real business requirement. That discipline shaped everything that followed.


The Technology Stack — And Why Each Choice Was Made

Frontend: Next.js (React + TypeScript)

We chose Next.js for the dashboard interface because it gives us:

  • Fast initial loads via server-side rendering
  • A rich, dynamic client experience after hydration

For a dashboard that business teams open first thing every morning, first-load performance matters.

The UI displays live charts — active users, revenue, conversions using responsive components designed to stay smooth even as data updates continuously.


Backend: Node.js (Monolithic Architecture)

We deliberately chose a monolithic Node.js backend over microservices.

For this project, that meant:

  • Faster development
  • Simpler testing
  • Easier deployment
  • No cross-service latency

We centralized:

  • Caching logic
  • API layer
  • Real-time event handling

The structure still allows future extraction into services if needed, but the monolith gave us speed and stability without unnecessary complexity.


Data Layer: PostgreSQL + Redis

We used two data stores, each for a specific purpose.

PostgreSQL → Persistent & Historical Data

Used for:

  • Historical reports
  • Aggregated summaries
  • Complex time-range queries

Configured with:

  • Managed PostgreSQL
  • PgBouncer connection pooling
  • Support for thousands of concurrent requests

Redis → Real-Time Data

Used for:

  • Pageviews
  • Active sessions
  • Click events
  • Revenue counters

All stored as in-memory hashes, updated per event, retrievable in milliseconds.

We use Redis pipelines to batch dashboard queries into a single round trip, enabling always-current metrics with minimal overhead.


Real-Time Updates: WebSockets

Instead of polling every few seconds, we maintain a persistent WebSocket connection.

When new data arrives:

  • A purchase happens
  • A session starts
  • A conversion fires

The server pushes updates instantly to all connected dashboards.

Charts move. Counters tick. No refresh. No delay.


Infrastructure: DigitalOcean

We deployed the system on DigitalOcean using:

  • Droplets for compute
  • Managed PostgreSQL
  • Load balancers with WebSocket sticky sessions

Services are containerized with Docker, enabling:

  • Autoscaling during traffic spikes
  • Reliable deployments
  • Cost-effective operation at scale

For this volume, we needed infrastructure that is stable, quiet, and predictable.


How Real-Time Data Actually Flows

From user action to dashboard update:

  1. Tracking Library
    A lightweight client script captures events (page view, click, purchase).
    Each user gets a persistent ID + session ID to prevent double-counting.
    Events are batched and sent to the API.

  2. Event Ingestion
    The backend receives the event and increments the correct Redis counter.
    Example:

    • Purchase → revenue hash for today
    • Page view → session counter
  3. Aggregation
    On dashboard request, Redis pipelines fetch all relevant counters in one batch.
    The backend computes:

    • Totals
    • Trends
    • Period-over-period comparisons
  4. Live Delivery
    New events trigger WebSocket pushes to connected clients.
    The UI updates instantly.

Result: fast, accurate, duplicate-proof metrics stakeholders can trust.


Quality, Testing, and What Happens After Launch

We test every feature before release:

  • Unit tests (Jest) → API logic & data computation
  • End-to-end tests (Cypress) → Real dashboard user flows
  • Continuous performance monitoring →
    • Slow queries
    • API latency
    • Runtime errors

Post-launch, we provide:

  • Performance tuning
  • Security updates
  • Feature expansion

At Anjeer Labs, we build for the long term and stay accountable to outcomes — not just deliverables.

10+ projects delivered. 98% client satisfaction.


What This Means for Founders

The best analytics tools aren't just fast — they're trustworthy.

When a number changes on your dashboard, you should be able to act immediately, knowing it reflects what is happening right now in your business.

We built a system where:

  • Latency is measured in milliseconds
  • Accuracy is built into the architecture
  • Infrastructure scales quietly as the business grows

If your business is operating at scale and your data can't keep up, you're not just behind on metrics — you're behind on decisions.

Anjeer Labs builds high-performance web applications and analytics systems for founders who need software that works at scale.
Get in touch →


Tags

Analytics Dashboard Real-Time Data Next.js Node.js Redis WebSockets Startup Tech SaaS Development Anjeer Labs

More notes