SYSTEMS & DATA2026-08 · TECHNICAL CASE

Arbitrium FX — SaaS Trading & LMS Platform

End-to-end freelance development of an institutional trading SaaS academy built with Next.js 16, Supabase, and Bunny Stream. Multi-bitrate HLS adaptive streaming with HMAC-SHA256 tokens, strict concurrent session controls, Notion-like rich note-taking (BlockNote), server-evaluated anti-cheat quizzes, real-time market feeds, and Discord community automation.

Next.js 16React 19SupabaseTailwind CSS v4Bunny.netTradingViewUpstash RedisDiscord API

Executive Summary: Problem, Solution & Technical Status

Dimension Project Insight
Role Performed Solo Freelance Full-Stack Engineer (Sole developer: end-to-end architecture, frontend, backend, and external integrations).
Client Problem Trading academy operating on a fragile, bloated WordPress instance. Manual video uploads to external panels, rampant account sharing cannibalizing revenue, fragmented student support, and risk of fraudulent certificate claims.
Engineering Solution Custom-built SaaS platform in Next.js 16 (React 19) and Supabase (PostgreSQL) featuring direct resumable TUS video uploads, HMAC-SHA256 signed HLS streaming, single-session token invalidation, asynchronous Discord bots, and RPC-graded evaluations.
Project Status Complete & Functional MVP in Staging / Demo Mode: Built and reported to the client up to the agreed functional milestone. The source codebase has not been handed over yet, remaining under my custody while the client defines the date to resume and connect live payment gateways.

1. Context: Moving from Fragile WordPress to a Proprietary SaaS

Arbitrium FX initially operated on a fragile WordPress setup overloaded with third-party plugins that regularly broke during routine updates. The client suffered four critical operational pain points:

  1. Severe video upload friction: For every single lesson, instructors had to leave WordPress, log into the Bunny.net web console, upload files, wait for transcoding, copy GUIDs manually, and navigate back into WordPress hoping the embedded player would not glitch.
  2. Revenue loss from rampant account sharing: The system lacked any concurrency safeguards. Multiple students routinely shared single credentials across different cities, cannibalizing recurring subscriptions.
  3. Disconnected community and support: VIP roles on their private Discord server were assigned manually, and students’ trading questions were buried in chat channels without timestamp context.
  4. Lack of academic rigor: The platform had no validated assessment engine or anti-cheat mechanisms, leaving the door open for students to claim trading certificates without studying the material.

I was contracted as a solo freelance engineer to independently design and build an independent, protected, modern SaaS academy from scratch, replacing their legacy CMS entirely.


Production Tech Stack & Architecture

Arquitectura de Software
Next.js
Next.jsv16.3.3

App Router, Zod-validated Server Actions, server-only Data Access Layer (DAL), and Feature-Driven Design.

React
Reactv19.2.8

React 19 with Server Components by default, async transitions, and Suspense streaming.

Supabase
Supabasev2.112.3

PostgreSQL database with strict Row Level Security (RLS), Auth, Storage, triggers, and SECURITY DEFINER RPCs.

bunny.net
Bunny.net StreamAPI v2 / TUS

Direct resumable TUS uploads, adaptive HLS multi-bitrate encoding (.m3u8), and short-lived HMAC-SHA256 token auth.

TradingView
TradingView Chartsv5.2.1

Embedded interactive technical charting engine displaying live Japanese candlesticks powered by financial APIs.

Redis
Upstash Redisv1.38.0

Distributed edge rate limiting (`@upstash/ratelimit`), brute-force mitigation, and batch pipeline queues.

Discord
Discord Bot & APIv10 Rest

Bi-directional VIP role synchronization, course forum generation, and timestamp-referenced doubt threads.

Python
BlockNote (Mantine)v0.51.4

Notion-like rich-text block editor embedded in the lecture room with bi-directional video timestamp links.

Stripe
Stripe & Square ReadyWebhooks

Decoupled billing architecture with idempotent webhooks, MRR analytics, and dispute suspension handlers.

Tailwind CSS
Tailwind CSSv4.0

Cinematic Dark Mode design system with gold and graphite palette, Lenis smooth scrolling, and micro-interactions.


2. Technical Decisions & Architectural Patterns

To deliver a scalable and maintainable product, the codebase was structured following clean architectural boundaries and resilient engineering patterns:

2.1 Feature-Driven Design & Server Data Access Layer (DAL)

The application is organized around independent domain modules (features/courses, features/announcements, etc.):

  • Server-Only Data Access: Database interactions are encapsulated within server-only DAL modules (dal/queries.ts, dal/mutations.ts), ensuring service-role keys and business logic are never bundled into client assets.
  • Zod-Enforced Server Actions: All state mutations run through strictly typed Server Actions that validate input payloads against Zod schemas and verify active user sessions and role permissions.

2.2 Protected Video Streaming with TUS & HMAC Tokens

  • Direct Resumable Uploads: Instructors upload large lesson videos (1 to 4 GB) directly from the custom admin dashboard to Bunny.net via the TUS protocol, preventing application web server bandwidth saturation.
  • Anti-Piracy & Hotlink Protection: No raw video URLs are ever exposed. When a student opens a lecture, the backend dynamically generates a signed URL using a secret key and an HMAC-SHA256 signature expiring in 1 hour (manifestUrl and embedUrl), preventing unauthorized video link sharing on external forums.

2.3 Single-Session Token Pattern (Anti-Account Sharing)

To eliminate unauthorized credential sharing:

  • The database tracks an active current_session_id per user in the profiles table.
  • Upon login, a unique cryptographic session identifier is generated, stored in a secure httpOnly cookie, and recorded in the database.
  • The classroom layout (src/app/(app)/layout.tsx) verifies on every navigation that the client cookie matches the database record. If another user signs in from a different browser or device, the previous session is immediately invalidated, redirecting the duplicate user to a session-terminated screen.

2.4 Synchronized Notion-Like Notes (BlockNote)

Trading students need to document technical setups without switching windows. I integrated an interactive block editor (Notion-style) inside a co-located slide-over drawer:

  • Supports formatted text, structured checklists, warning callouts, and trade screenshots.
  • Automatically captures the current video playback timestamp when creating a note, allowing students to click any note to jump straight to that second of the video.
  • Asynchronously auto-saves note documents to Supabase with debounced network calls to optimize database transactions.

3. Resilience, Observability & Incident Handling

The platform incorporates active safeguards to protect infrastructure stability and maintain high availability:

3.1 Distributed Rate Limiting & Brute-Force Defense

  • Edge Protection with Upstash Redis: Sliding-window rate limiters guard sensitive surfaces (authentication endpoints, discount coupon redemption, and public API routes).
  • Batch Optimization: To eliminate Redis round-trip latency overhead, operations were optimized using batch pipelines (mget and multi-key del), reducing credential verification response times to under 40ms.

3.2 Asynchronous Decoupling of External APIs (Discord Queues)

Third-party community platforms like Discord enforce strict rate limits (HTTP 429 Too Many Requests). To prevent community activity surges from blocking the web platform:

  • Community events (generating doubt discussion threads, syncing member roles, and computing daily study streaks) do not execute inline.
  • They are queued inside PostgreSQL and processed by background worker routines (discord-queue-processor and discord-streaks-batch) in controlled batches adhering to external API budgets.

3.3 Database Security Audit & Anti-Cheat Assessment Engine

Following a deep technical audit of the Supabase schema, strict defenses were instituted to secure academic evaluation:

  • Securing Evaluation Data: Correct quiz answers (quiz_options.is_correct) were completely removed from public/anonymous reading using sanitized SQL views.
  • Server-Side Grading: Quiz submission is restricted exclusively to a SECURITY DEFINER RPC function (submit_quiz_attempt), making it impossible for students to forge passing scores from the client.
  • Anti-Brute Force Guards: The engine applies randomized question/option shuffling and strict cooldown timers between failed attempts to block trial-and-error guessing.
  • Atomic Verifiable Certification: The issue_certificate routine verifies server-side that all lessons were completed sequentially and that the final exam was genuinely passed, issuing an authentic alphanumeric credential publicly searchable at /verificar/[code].

3.4 Fault-Tolerant Market Data Aggregation

The dashboard ticker and Japanese candlestick charts aggregate live financial quotes using Promise.allSettled across three market providers:

  • Kraken API: Major Forex currency pairs (EUR/USD, GBP/USD).
  • Binance API: Cryptocurrencies (BTC/USDT).
  • Yahoo Finance: Equity indices and commodities (S&P 500, Nasdaq 100, Gold).
  • Resilient Fallback: If any external provider experiences latency or timeout failures, the endpoint gracefully delivers cached fallback candles under a 60-second Incremental Static Regeneration cache (revalidate = 60), guaranteeing zero UI crashes.

4. Current Project Status & Freelance Key Takeaways

  • Current Status & Client Notification: The project was engineered entirely by myself as the sole developer and is fully functional in a staging/demo environment. I formally notified the clients that the platform is 100% built and verified up to this milestone. The source code remains under my custody and has not been handed over yet, pending the clients’ decision to resume the project, connect live payment keys (Stripe/Square), and initiate commercial rollout.
  • Senior Engineering Takeaways:
    • Digital asset protection is foundational in SaaS: Safeguarding media with HMAC-signed streaming and blocking concurrent logins directly protects the client’s subscription value proposition.
    • Asynchronous queues for third-party rate limits: Integrating community bots requires designing background queues to buffer external rate limits without degrading web application latency.
    • Evaluation logic belongs on the server: In educational platforms issuing accredited certificates, client-side grading invalidates institutional trust; evaluation must remain strictly enforced within server-side transactions.