Skip to content

About

Live AI Spend Audit Platform for startups. Audits SaaS spend deterministically with 100% precision and secures tenant data using Supabase Row Level Security (RLS).

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

30 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SpendSight

Audit AI/SaaS tool spend for startup engineering teams and surface where seats and plans are overpaying — with deterministic, finance-defensible math.

Live: spentsight.vercel.app

Problem

Startups often stack Cursor, Copilot, Claude, ChatGPT, Gemini, Windsurf, and vendor APIs without a clear view of seat utilisation versus list pricing. Finance teams need numbers they can defend; LLM-invented prices break that trust. SpendSight was built as a lead-generation audit for Credex: show the savings first, then capture a lead.

Features

  • Multi-tool audit across common AI coding and chat products (plans, seats, usage inputs)
  • Deterministic pricing engine — recommendations map to a hardcoded pricing registry, not model guesses
  • Optional short narrative summary via Gemini (with a deterministic fallback when no API key is set)
  • Shareable audit result pages persisted in Supabase
  • Email capture after results (Resend), not before — value before the ask
  • Zustand form state with persist so mid-flow reloads keep progress
  • Jest coverage for the audit engine

Architecture

flowchart LR
  Browser -->|form + Zustand persist| NextApp[Next.js App Router]
  NextApp -->|POST /api/audit/create| AuditAPI
  AuditAPI --> Engine[AuditEngine TypeScript]
  Engine --> Registry[PRICING_REGISTRY]
  AuditAPI -->|optional summary| Gemini[Gemini 2.0 Flash]
  AuditAPI --> Supabase[(Supabase Postgres)]
  NextApp -->|POST /api/leads/create| LeadsAPI
  LeadsAPI --> Resend[Resend email]
  LeadsAPI --> Supabase
Loading

Client uses the Supabase anon key (RLS). Server routes use the service-role client for writes. Rate limiting is in-memory (per instance) — fine for MVP, not a global Redis limit.

Tech stack

Layer Choice
App Next.js 16 (App Router), React 19, TypeScript
UI Tailwind CSS 4, Radix/shadcn-style components
State Zustand (persist)
Forms react-hook-form + Zod
Data Supabase (Postgres)
Email Resend
Narrative LLM Gemini 2.0 Flash (optional)
Tests Jest + ts-jest

Key engineering decisions

  1. Zero AI for the money math. AuditEngine is pure TypeScript over PRICING_REGISTRY. An LLM hallucinating a list price would destroy product trust. AI is only used for a short summary paragraph.
  2. Results before email. The email gate sits after the savings hero so users have already seen value.
  3. Split Supabase clients. Browser anon vs server service-role — never mix them.
  4. In-memory rate limits. Simpler than Redis for MVP; resets on cold start. Documented trade-off for later Upstash/Redis.

Getting started

Prerequisites

  • Node.js 20+
  • A Supabase project
  • Optional: GEMINI_API_KEY, RESEND_API_KEY

Setup

git clone https://github.com/darkNIGHT669/spentsight.git
cd spentsight
npm install

Create .env.local (names only — fill with your own values):

NEXT_PUBLIC_SUPABASE_URL=
NEXT_PUBLIC_SUPABASE_ANON_KEY=
SUPABASE_SERVICE_ROLE_KEY=
GEMINI_API_KEY=
RESEND_API_KEY=
NEXT_PUBLIC_BASE_URL=http://localhost:3000
npm run dev

Open http://localhost:3000.

Tests

npm test

Project structure

spentsight/
├── app/                 # App Router pages + API routes
│   ├── api/audit/       # Create audit + optional LLM summary
│   ├── api/leads/       # Lead capture + email
│   └── audit/[auditId]/ # Shareable results
├── components/          # Form + results UI
├── lib/
│   ├── audit-engine.ts  # Deterministic pricing logic
│   ├── pricing-registry.ts
│   └── supabase/        # client vs server clients
├── store/               # Zustand audit form store
└── __tests__/           # Audit engine unit tests

Testing / quality

  • Unit tests focus on AuditEngine recommendation behaviour (__tests__/audit-engine.test.ts)
  • npm run lint via ESLint (Next config)

Deployment

Push to main — Vercel auto-deploys via GitHub integration. Set the same env var names in the Vercel project settings. Ensure NEXT_PUBLIC_BASE_URL matches the production host for share links.

About

Live AI Spend Audit Platform for startups. Audits SaaS spend deterministically with 100% precision and secures tenant data using Supabase Row Level Security (RLS).

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages