ClearPeak Trading
Trading Analytics SaaS Platform

01 // System Overview
What The System Does
ClearPeak Trading is a subscription-based financial analytics SaaS offering proprietary performance indicators, automated trade journaling, and paid access to analytical tools. Built for scalability, data isolation, and smooth monetization, ClearPeak provides traders with actionable metrics while ensuring secure subscriber authentication.
02 // Architecture & Data Flow
End-to-End System Design
Trader Browser / Client
│
▼ HTTPS
┌───────────────────────────────────────────────┐
│ Next.js Application (App Router) │
│ ├── Auth.js (Protected Routes & Sessions) │
│ └── Server Actions & Analytics APIs │
└───────┬───────────────────────────┬───────────┘
│ │
▼ Prisma Client ▼ REST API
┌──────────────────────────┐ ┌───────────────────────────┐
│ PostgreSQL Database │ │ Stripe Billing Engine │
│ (Neon Serverless) │ │ (Checkout & Subscriptions)
│ • Users & Sessions │ └─────────────┬─────────────┘
│ • Subscriptions & Logs │ │ Webhooks
│ • Trade Journals │ ▼ (HMAC Verified)
└──────────────────────────┘ ┌───────────────────────────┐
│ Next.js Webhook Handler │
│ (State Sync & Entitlement)│
└─────────────┬─────────────┘
│
▼ REST
┌───────────────────────────┐
│ Brevo Email API │
└───────────────────────────┘03 // Engineering Ownership
What I Personally Built
04 // Technical Problems Solved
Engineering Challenges & Solutions
Guaranteeing idempotent webhook processing when Stripe retries deliveries during transient network delays.
Created an EventLog table in PostgreSQL to record each incoming Stripe event ID inside a database transaction, rejecting already-processed events before modifying user entitlement records.
Protecting proprietary trading indicator calculations from unauthorized client extraction.
Kept all core mathematical calculations on the server inside isolated serverless API endpoints protected by session and subscription guard middleware.
Database connection limits under serverless Next.js edge and lambda function scaling.
Configured Prisma with Neon serverless connection pooling (pgBouncer), preventing connection pool exhaustion under sudden traffic bursts.
05 // Trade-offs
Key Architectural Decisions
- Selected PostgreSQL with Prisma for type-safe database schemas and predictable schema migrations.
- Chose Stripe Customer Portal to offload credit card updates, invoicing, and tax handling directly to Stripe's secure infrastructure.
- Utilized Brevo API for transactional email delivery decoupled from web server execution.
Technologies Used
Explore Other Work
Instasew
Fashion Marketplace Platform & Backend Architecture