Confidential — Founder's Copy

Casset

Technical Platform Brief
Document Type
Founder's Technical Overview
Prepared
April 2026
Classification
Internal / Investor-Ready
94K
Lines of Code
130
API Endpoints
25+
Database Models
610
Source Files
Section 01

What You Have

A plain-language summary of what actually exists in this codebase — not what the product could do, but what is already built.

Casset is not a typical startup MVP. Typical seed-stage startups ship a Next.js app with Clerk auth, a Stripe Checkout redirect, and a database with 3–5 tables. Your codebase has 130 API endpoints, 25+ database models, 9 database migrations, a custom audio streaming infrastructure, a complete payment platform, and an autonomous campaign engine with fraud detection. This is 5–10x the scope of a typical MVP and closer in complexity to a Series A product.

Bottom line: If this were being built from scratch by a team of 3 senior engineers and a designer, it would take 5–7 months and cost roughly $500K–$800K in engineering time alone.

Technology Stack

Next.js 16 React 19 TypeScript PostgreSQL Prisma ORM Upstash Redis Stripe Connect Vercel (Serverless) Anthropic Claude Vercel Blob TanStack Query Framer Motion Radix UI Tailwind CSS Web Audio API Zod

This is a modern, well-chosen stack. Next.js App Router with serverless functions means you pay nothing when idle and scale automatically under load. PostgreSQL + Prisma gives you a typed, migration-safe database. Redis handles the real-time layer without overcomplicating the core.

Section 02

The Nine Systems

Every major system in the platform, what it does, how complex it is, and how long it would take to rebuild.

1. Audio Engine High
Custom streaming with signed tokens, server-side byte-range proxy, real-time frequency analysis, iOS Safari compatibility, cross-fade, preloading, lock-screen controls.
6–8 weeks · 1 senior engineer
2. Payments High
Stripe Connect (direct charges), Apple Pay, guest checkout, tips, refund/dispute revocation, idempotent webhooks for 6 event types.
5–7 weeks · 1 senior engineer
3. Campaign Drops Very High
Autonomous promotional campaigns with scoring algorithm, fraud detection, auto-finalization, tiered + performance payouts, AI intelligence, promoter reputation.
10–14 weeks · 1 staff engineer
4. Social Layer Med-High
Real-time presence (Redis), SSE streaming, comments, reactions, follows, activity inbox, superfan detection, referral tracking.
5–6 weeks · 1 senior engineer
5. Auth & Security Medium
JWT with session versioning, Redis-cached validation, Spotify + Apple OAuth, rate limiting, CSP/HSTS headers, Edge middleware.
2–3 weeks · 1 senior engineer
6. Artist Studio Medium
Full CMS: casset CRUD, track upload, media management, Stripe Connect onboarding, campaign management, analytics.
3–4 weeks · 1 senior engineer
7. Feed & Discovery Medium
Multiple feed iterations, trending, follow-based feed, drop racks, desktop + mobile shells. Evidence of significant product iteration.
4–5 weeks · 1 engineer + designer
8. UI & Visualizers Medium
50+ pages, iPod/cassette/GameBoy skins, 6+ audio visualizers, theming system, Framer Motion, dynamic OG images.
6–8 weeks · 1 engineer + designer
9. Infrastructure & DevOps Medium
PWA service worker (3-tier caching, LRU eviction, offline), Vercel deployment, Docker local dev, migration guards, adversarial test suite, perf auditing.
2–3 weeks · 1 senior engineer
Section 03

What Makes This Hard

The things in this codebase that would be non-obvious to someone who hasn't built them — and why they matter.

The Audio System Is a Real Streaming Server

Most music startups embed Spotify or SoundCloud and call it a day. Casset built a token-authenticated, byte-range-aware audio proxy that computes preview windows from bitrate estimation, validates redirect chains (preventing server-side request forgery), and serves content with correct HTTP semantics — 206 status codes for range requests, proper Content-Range headers, Accept-Ranges advertisement that iOS Safari requires for seeking.

A singleton audio element persists across every page navigation. Music never stops when the user browses. The system pre-fetches the next track's authentication token and preloads its bytes into the browser cache before the current track ends, so transitions are near-instant. Lock screen controls work on every platform.

The codebase has extensive workarounds for iOS Safari (audio context suspension, NaN duration before play resolves, background tab garbage collection) and in-app browsers (Instagram, TikTok). This is months of cross-browser debugging crystallized into production code.

The Payment System Handles Real Money Safely

This is not "we redirect to Stripe Checkout." Casset uses Stripe Connect with direct charges — the most complex but most artist-favorable architecture, where payments go directly to the artist's connected account. The webhook handler covers 6 event types with idempotency guards on every write path (Redis SETNX locks), so Stripe retries never create duplicate purchases or payouts.

Access is immediately revoked on refund or chargeback. Guest users can purchase without an account and claim later. Tips flow through a separate payment pipeline with real-time notifications.

The Campaign Engine Is Fintech-Grade

The auto-finalization pipeline for promotional campaigns has a hard money assertion: if the sum of all payouts does not equal the prize pool down to the penny, the entire payout is blocked. Stripe transfers use four independent safety layers (idempotency key, database status pre-check, Redis distributed lock, Stripe's own idempotency). The fraud detection system catches both individual anomalies (suspicious engagement ratios, metric spikes) and coordinated attacks (same URL from different accounts, author handle rings).

This is the kind of defensive engineering you see in payment processors, not typical startup code.

The AI Layer Is Production-Hardened

The Claude integration is not "call an API and display the result." It sanitizes inputs (Unicode normalization, control character stripping), enforces daily cost caps via Redis, times out at 15 seconds, validates and bounds structured JSON output, rejects responses containing banned marketing jargon, and falls back to deterministic insights when anything fails. Every failure mode is handled.

Section 04

Architecture Overview

How the pieces fit together and the engineering patterns that hold them up.

┌─────────────────────────────────────┐ │ Client (Browser) │ │ React 19 · Next.js App Router · PWA│ │ Audio Engine · Visualizers · Feed │ └──────────┬──────────┬───────────────┘ │ │ API Routes │ │ Service Worker (130 endpoints) │ │ (offline cache) ▼ ▼ ┌───────────────────────────────────────────────────────────────┐ │ Vercel Serverless Edge │ │ ┌──────────┐ ┌──────────┐ ┌───────────┐ ┌────────────┐ │ │ │ Auth │ │ Audio │ │ Payments │ │ Campaigns │ │ │ │ (JWT/ │ │ (Proxy + │ │ (Stripe │ │ (Score + │ │ │ │ OAuth) │ │ Tokens) │ │ Connect) │ │ Finalize) │ │ │ └────┬─────┘ └────┬─────┘ └─────┬──────┘ └─────┬──────┘ │ │ │ │ │ │ │ │ ┌────▼──────────────▼──────────────▼───────────────▼──────┐ │ │ │ Shared Infrastructure │ │ │ │ Prisma ORM · Rate Limiter · Presence · Alerts · Logger │ │ │ └──────┬────────────────┬─────────────────────┬───────────┘ │ └──────────┼────────────────┼─────────────────────┼─────────────┘ │ │ │ ┌───────▼──────┐ ┌─────▼──────┐ ┌───────────▼──────────┐ │ PostgreSQL │ │ Redis │ │ External Services │ │ (25+ models) │ │ (Upstash) │ │ Stripe · Claude · │ │ 760-line │ │ Presence, │ │ Vercel Blob · IPFS │ │ schema │ │ Rate limit,│ │ │ │ │ │ Locks, SSE │ │ │ └───────────────┘ └────────────┘ └──────────────────────┘

Key Engineering Patterns

Idempotency Everywhere

Every webhook handler, every payout, every notification uses database upserts or Redis SETNX locks. Stripe can retry any event 10 times and the system produces the same result once. This is critical for handling real money.

Graceful Degradation

Every Redis call is wrapped in try/catch with documented fallback behavior. If Redis goes down: rate limiting falls back to in-memory, presence returns empty, session validation hits the database directly. No endpoint returns 500 when Redis is unavailable.

Singleton Resources

The audio element, Stripe client, Redis client, and Prisma client are all singletons that survive across serverless invocations (via globalThis) and React component unmounts. This prevents resource leaks that plague serverless deployments.

Feature Flags

Drop limits, drop time windows, ambient social, and purchase gating are all controlled via environment variables. You can enable or disable any of these in production without deploying code.

Fail-Closed on Money

The payout system requires a Redis lock before executing a Stripe transfer. If Redis is down, the payout is deferred, not skipped. It runs on the next cron cycle. Money never moves without all safety layers active.

Database-Level Business Rules

Unique constraints enforce invariants: one purchase per user per item, one follow per pair, one payout per winner per rank, one submission score per algorithm version. These cannot be violated regardless of application-level bugs.

Section 05

Data Model

25+ interconnected models across user identity, commerce, content, social, campaigns, and intelligence.

Core Identity

Content

Commerce

Campaigns

Intelligence & Growth

Section 06

Build Estimate

What it would cost to rebuild this from zero with a competent team.

Per-System Breakdown

System Complexity Weeks Who Builds It
Audio Engine & ProxyHigh6–8Senior frontend/audio engineer
Payments & CommerceHigh5–7Senior backend (Stripe expertise)
Campaign DropsVery High10–14Staff backend engineer
Social LayerMedium-High5–6Senior full-stack
Auth & SecurityMedium2–3Senior backend
Artist StudioMedium3–4Senior full-stack
Feed & DiscoveryMedium4–5Senior frontend + designer
UI, Themes, VisualizersMedium6–8Senior frontend + designer
Infrastructure & DevOpsLow-Medium2–3Senior infrastructure
Total (sequential)43–58

With a Team of 3 Engineers + 1 Designer (Parallel)

3.5–4 mo
Optimistic (tight scope, no pivots)
5–6 mo
Realistic (normal iteration, QA)
6–7 mo
Conservative (product discovery + polish)

Dollar Equivalent

48–65 engineer-weeks at senior US market rates ($150–180/hr) = $480K–$780K in engineering cost alone. This excludes design, product management, and infrastructure spend.

Critical Path

The Campaign Drops system (10–14 weeks) is the critical path. It depends on the payments infrastructure being in place, so it can't start from day one. The audio engine and UI work can proceed fully in parallel. Auth and infrastructure are foundations that start in the first 2–3 weeks.

What This Means for You

You are not sitting on a prototype. You are sitting on a functioning, production-grade platform that represents roughly half a million dollars of equivalent engineering investment. The codebase shows evidence of 4+ major product iterations (multiple feed versions, multiple landing pages, multiple player skins), suggesting the actual calendar time invested is significantly longer than the pure engineering time — meaning real product learning has happened here, not just code output.

Section 07

Honest Assessment

What's production-ready, what needs work, and what a new engineer would need to know.

What's Production-Ready

What's Built But May Need Iteration

What Doesn't Exist Yet

Section 08

Why This Is Hard to Copy

The technical moats that would slow down any well-funded competitor.

1. Cross-Browser Audio Is an Iceberg

Any team that tries to build a music platform with instant playback will hit the same iOS Safari bugs, the same WebKit AudioContext quirks, the same byte-range edge cases with in-app browsers. Your codebase has already solved these. The playback-state.ts file alone is 830 lines of hard-won edge case handling. A competitor would underestimate this by months.

2. Stripe Connect Takes Time

Setting up Stripe Connect with direct charges requires Stripe's review and approval process. Building webhook idempotency, refund revocation, dispute handling, and Apple Pay on top of it is not a weekend project. Your payment infrastructure is already live and tested with real transactions.

3. The Campaign Engine Creates a Data Moat

Every campaign that runs generates scoring data, fraud signals, and promoter reputation scores. The intelligence layer uses this historical data to make better recommendations. A new entrant would start with zero data and zero reputation graphs. Your system gets smarter with each campaign.

4. The Promoter Network Is a Two-Sided Marketplace

The promoter reputation system (streak tracking, trust badges, platform-specific stats, win rates) creates identity and status for promoters. Once promoters have established reputations on Casset, switching costs are real — they'd lose their history, tier, and credibility.


Section 09

Recommended Next Steps

Where to focus engineering effort for maximum impact.

If Hiring Engineers

Quick Wins (< 1 week each)

Medium-Term (1–3 months)

Summary

The Bottom Line

You are not working with a prototype. You are working with a production-grade platform that represents roughly $500K–$800K of equivalent engineering investment across 9 interconnected systems.

The audio infrastructure, payment platform, and campaign engine are each individually substantial. Together, they form a technical foundation that would take a funded competitor 6+ months with a skilled team to replicate — and that's before accounting for the cross-browser debugging, the edge case handling, and the product iterations that are embedded in this code.

The foundation is real. The depth is genuine. What's needed now is focus: consolidate the product iterations, activate the features that are built but dormant, and run real campaigns to prove the model.

Key Numbers
94K
Lines of code
~$600K
Rebuild cost (mid-range)
5–6 mo
Rebuild time (3 engineers)