Case study · Data & analytics APIs

SmartFinancial: analytics APIs for an insurance marketplace

I build the publisher portal API for SmartFinancial, a US insurance marketplace that matches shoppers with carriers and agents. My work centers on the lead and call analytics that staff and publishers use every day, served from Amazon Redshift over millions of records without slowing the production databases.

Role
Senior Software Engineer
When
Where
Remote · California, USA

SmartFinancial is my current employer. This page describes my work in general terms and leaves out internal names, code and business figures.

Analytics dashboards built
4
Admin and publisher, for leads and for calls
Analytics freshness
15–30 min
Scheduled Redshift rollups, with a freshness API
Test layers I set up
3
Unit, API smoke on a real database, live Redshift
On this page
  1. Architecture
  2. Context
  3. What I owned
  4. What the dashboards do
  5. Hard problems
  6. Stack
  7. Outcomes
  8. What this shows

Architecture

Where the analytics come fromAdmin dashboards to Publisher portal API: JWT · roles. Publisher dashboards to Publisher portal API: scoped access. CI on pull requests to Publisher portal API: every change. Publisher portal API to Amazon Redshift: analytics SQL. Publisher portal API to MySQL read replicas: lookups. Publisher portal API to MySQL primaries: writes. Publisher portal API to Redis · BullMQ: jobs. Scheduled rollups to Amazon Redshift: refreshJWT · rolesscoped accessevery changeanalytics SQLlookupswritesjobsrefreshAdmin dashboards (client)Admin dashboardsstaff · managersanalystsPublisher dashboards (client)Publisher dashboardsscoped to each partnerCI on pull requests (tool)CI on pull requestsunit · smoke · RedshiftAI reviewPublisher portal API (service)Publisher portal APINode 20 · TypeScriptExpress 5 · AWS ECSAmazon Redshift (data)Amazon Redshiftanalytics rollupsMySQL read replicas (data)MySQL read replicasreporting lookupsMySQL primaries (data)MySQL primariesaccounts · campaignspayoutsRedis · BullMQ (queue)Redis · BullMQscheduled reportsjobsScheduled rollups (worker)Scheduled rollupsrefresh every 15–30 min
Where the analytics come from. Labels are generic on purpose. Dashboards read from Redshift rollups and read replicas, so heavy queries never hit the databases that take live traffic.
Diagram as text
  • Admin dashboards → Publisher portal API: JWT · roles
  • Publisher dashboards → Publisher portal API: scoped access
  • CI on pull requests → Publisher portal API: every change
  • Publisher portal API → Amazon Redshift: analytics SQL
  • Publisher portal API → MySQL read replicas: lookups
  • Publisher portal API → MySQL primaries: writes
  • Publisher portal API → Redis · BullMQ: jobs
  • Scheduled rollups → Amazon Redshift: refresh

Context

SmartFinancial runs a marketplace that matches insurance shoppers with carriers and agents across all 50 states. Publishers, the affiliate partners who send traffic, track their leads, calls and payouts in the publisher portal, and staff use it to manage campaigns and quality.

The portal needs fast, trustworthy analytics at a scale where heavy queries on the transactional databases would slow down everything else.

What I owned

  • Backend
  • Analytics SQL
  • Data modeling
  • Testing
  • CI
  • Built the admin and publisher analytics APIs for leads and calls: stat cards, graphs, data tables and CSV exports.
  • Write the large analytical SQL behind them on Amazon Redshift.
  • Set up the API's test infrastructure and AI-assisted code review in CI.

What the dashboards do

  • Stat cards, graphs and data tables for leads and calls, for staff and for each publisher.
  • Configurable group-bys (time buckets, campaigns, sources, states and consumer attributes), with multi-column sorting.
  • Compare-to periods paired bucket by bucket, and time-gap filling so charts never skip an hour or a day.
  • Anomaly alerts for the current hour, day and month.
  • CSV exports that follow each user's saved column preferences.
  • Grand totals that add up across every group-by.

Hard problems

01

Analytics without loading the production databases

Analytics freshness
15–30 min
Scheduled Redshift rollups, with a freshness API

Problem

Dashboard queries scan large volumes of lead, call and visit data. Running them against the transactional MySQL databases would slow the systems that take live traffic.

Approach

  • Analytics read from Amazon Redshift rollups that refresh every 15–30 minutes, and a data-freshness endpoint tells each dashboard how current its numbers are.
  • Reporting lookups moved to MySQL read replicas, and some activity-log lookups to Redshift.
  • Listings that kept timing out moved onto Redshift, and slow queries are logged with pool wait split from query time.

Result

The dashboards stay quick while the primary databases serve live traffic.

02

Numbers that agree on every page

Grouped totals
Reconciled
Every group-by adds up to the ungrouped view

Problem

Totals drifted between views: a grouped table didn't always add up to the ungrouped dashboard, and revenue per lead was divided differently on different pages.

Approach

  • Made every group-by add up to the ungrouped totals, and broke sort ties on the grouping key so pages are stable.
  • Unified metric definitions such as qualified leads, sold leads and revenue per lead across the dashboards, campaign lists and campaign summaries.

Result

Staff and publishers see the same numbers wherever they look.

03

Confidence to change revenue-critical code

Test layers I set up
3
Unit, API smoke on a real database, live Redshift

Problem

Dashboard math and payout logic touch money, and every change needed to be checked across many endpoints.

Approach

  • Set up the Jest test infrastructure: in-process unit tests, API smoke tests against a real database, and an opt-in live Redshift suite.
  • Added Claude-powered pull request review to CI.

Stack

Backend
  • Node.js 20
  • TypeScript
  • Express 5
  • Zod
  • Swagger / OpenAPI
Data
  • Amazon Redshift
  • MySQL
  • Read replicas
  • Memcached
  • Redis
  • BullMQ
Infrastructure
  • AWS ECS
  • AWS S3
  • GitHub Actions
  • Docker
Testing
  • Jest
  • Supertest
  • Claude code review

Outcomes

  • Four analytics dashboards (admin and publisher, leads and calls) served from one consistent API.
  • Heavy analytics moved off the transactional databases.
  • A test setup with unit, API smoke and live Redshift suites.

What this shows

For teams hiring an AI Engineer or Forward Deployed Engineer:

  • Comfortable inside a large, revenue-critical production system and its data.
  • SQL and data modeling at scale on Amazon Redshift and MySQL.
  • Testing and AI-assisted review built into how the team ships.