B2B Commodity Trading Platform
Back to Projects

B2B Commodity Trading Platform

Full-stack replacement for a legacy .NET trading platform, now live in production. 227 components, 212 REST endpoints, and a 3.7M-row migration to PostgreSQL.

2026Live
Product
Lot
ID
Grade
Qty
Period
Bid
Ask
Actions
Premium Blend A
2847
PBA-119
A+
500
Q2
$42.50
$45.00
BIDBUY
Standard Mix 12
3102
SM-2204
A
1,200
Q2
$31.20
$33.80
BIDBUY
Reserve Select
1893
RS-0087
AA
250
Q3
$78.00
$82.50
BID
Commodity Grade
4521
CG-3380
B+
3,000
Q2
$18.90
$20.10
BIDBUY
Export Certified
2210
EC-1156
A
800
Q3
$55.00
$58.25
BID
Small Batch 09
0917
SB-0441
AA
120
Q2
$92.00
$97.00
BIDBUY
Industrial Spec
5503
IS-7892
B
5,000
Q4
$12.40
$13.80
BUY
Organic Cert.
0334
OC-2281
AA
340
Q3
$88.00
$91.50
BIDBUY
12 listings3 active bids
Last update: 09:15:22

Results

227
React Components
Custom UI + 40 shadcn/ui base
212
API Endpoints
287 operations, OpenAPI 3.1.0 validated
3.7M
Rows Migrated
Plus 64,533 media files to S3
179
E2E Tests
Playwright multi-role suites

The Problem

The client's B2B commodity trading platform was running on aging .NET/SQL Server infrastructure with no documentation and no migration path.

At stake:

  • 3.7 million rows of transaction history, product data, and user accounts
  • 125 GB of compliance files:certificates of analysis, licenses, trade confirmations
  • 1,735 companies and 4,815 users on the platform
  • 39,748 active product listings

The engagement had two mandates: preserve every byte of production data, then build a modern replacement from scratch.

Architecture

Four workstreams ran in parallel: data preservation, backend API, frontend application, and infrastructure.

What Was Built

Frontend

A large-surface trading application (50+ routed views across admin, broker, and trader roles) with 227 custom React components, real-time WebSocket state, and role-aware UI across every screen.

  • Order Book:Live buy/sell depth with real-time updates. Orders are matched, locked, and negotiated through a multi-step proposal flow.
  • Trade Book:Full trade history with counterparty details, filterable by date, product type, grade, and status.
  • Matching Engine UI:Walks both counterparties through proposal, counteroffer, and confirmation. Lot-level locking prevents double-allocation.
  • Product Listings:Card grid and hierarchical tree views. Clients submit products through a broker-mediated approval pipeline.
  • Admin Panel:User/company management, data import, system settings, editable role-permission matrix with audit trail, and audit logs with bulk operations.
  • Alias Mode:Brokers operate on behalf of any client without re-authentication.
  • Multi-Domain Branding:Subdomain-based UI switching between admin and client interfaces.
  • Demo Environment:Full API mocking layer with five demo accounts for stakeholder reviews.
  • E2E Coverage:179 Playwright specs across 20+ suites: auth, admin, trading lifecycle, cross-role, regression, and smoke.

Backend

212 REST endpoints (287 operations) with OpenAPI 3.1.0 validation, deployed to EC2 via SSM with CI/CD health checks.

  • Matching Engine:Core business logic pairing BUY and SELL orders with lot locking, counteroffers, partial fills, and multi-round negotiation.
  • Deal & Confirmation Pipeline:Trade execution triggers PDF generation and automated email dispatch to both parties.
  • Multi-tenant RBAC:Seven role tiers from GUEST to ADMIN, with permissions scoped per company and license type.
  • Real-time Events:Socket.IO backed by PostgreSQL NOTIFY. Order book changes, trade confirmations, and admin actions push instantly to connected clients.
  • Security Layer:JWT with rotating refresh tokens, rate limiting, session management via Redis, and brute-force prevention.

Data Migration

Data preservation was the first workstream. It started before any platform code was written, and it never fully stopped: the client periodically refreshes the platform against fresh source data.

  • 3.7M rows extracted from SQL Server binary backups and transformed through a 12-stage ETL pipeline into PostgreSQL, respecting foreign key dependencies across 43 source tables.
  • 111 GB of media (64,533 files) migrated to S3: COAs, lab results, licenses, trade confirmations, and product imagery.
  • 29 transformation scripts (25 SQL phase/backfill scripts + 4 Python ETL scripts) handling schema mapping, data type conversion, and referential integrity validation across the full legacy-to-modern schema translation.
  • Schema drift enforcement: a CI gate blocks any PR that alters a migration-target table unless the drift is explicitly acknowledged in a machine-readable allowlist, so the migration pipeline and the live schema can't silently diverge.

Infrastructure & Release Process

  • CI/CD:GitHub Actions deploys the frontend to AWS Amplify and the backend to EC2 via SSM, with post-deploy health checks.
  • Three-tier release gate:changes flow dev (internal sandbox) → qa (client-facing staging) → main (production), and production is never reached without the client's named stakeholders signing off against qa first.
  • Daily Backups:Automated PostgreSQL exports to S3 with encryption and email notification. Sub-10-minute disaster recovery.
  • Regression guards:the highest-risk flows (trade execution, listings display, the migration pipeline itself) are protected by dedicated Playwright/unit suites that must pass before any touching PR merges.

Technical Highlights

Legacy Platform Analysis

No documentation existed for the legacy system's business logic. I conducted a thorough platform analysis, mapping every workflow, data relationship, and edge case across order matching, trade settlement, permissions, and compliance. That analysis produced 13 feature specifications that became the blueprint for the rebuild.

Regulatory Compliance

Every product listing carries certificates of analysis, government license references, and compliance documentation. The RBAC system enforces visibility rules tied to license types. Different participant categories see different data based on their regulatory role. Lot-level traceability is maintained end-to-end.

Live Stakeholder Validation

The platform is past internal QA: it now runs on a recurring cadence of client-facing review. Client-reported issues are triaged, built, merged, and verified against the deployed staging environment the same day, with same-day cycles clearing a dozen-plus tickets at a time. Production releases require explicit sign-off from the client's named QA stakeholders against staging before promotion: not an automated gate, a human one.

AI-Assisted Development

Built across dozens of focused development sessions spanning many months, using specialized AI agent teams working in parallel: database architects, frontend developers, security auditors, and code reviewers coordinating simultaneously on different subsystems.

By the Numbers

MetricValue
React components227 custom + 40 base
API endpoints212 paths / 287 operations (OpenAPI validated)
Database tables61
Database migrations138
E2E tests179 (Playwright)
Backend test suites167 (Vitest)
Rows migrated3.7M
Media migrated64,533 files (111 GB)
ETL scripts29
RBAC role tiers7

The largest project in this portfolio by every measure: from legacy data preservation to a full trading platform now running in production for a regulated commodity market, under a live client validation cadence.