Cybersecurity / FinTech
Real-Time Fraud Detection Platform
Real-time fraud detection and risk scoring platform
Quick Summary / TL;DR
a FinTech risk platform needed a high-performance, real-time risk scoring platform to prevent transaction abandonment caused by latency and false positives. ERPStack engineered a decoupled edge risk-analysis platform with ClickHouse and Redis, reducing checkout latency to under 50ms and blocking $2.4M+ in annual fraud.
- Fraud blocked annually
- $2.4M+
- Compliance findings
- Zero
- False positive rate
- <0.1%
- Checkout latency
- <50ms
One transaction, five gates, under 50 milliseconds
Every checkout request travels the same path. Each gate has a latency budget it is not allowed to exceed — the numbers below are the production figures per stage.
- 01<10ms
Edge Intake
Geolocated IP reputation check at the edge
Vercel Edge / Workers
- 02~1ms
Schema Gate
Zod parse rejects malformed payloads at the border
Zod strict schemas
- 034ms
Risk Cache
Active consumer risk profile lookup
Redis + V8 edge execution
- 048ms
Rolling Window
Append-only event scan over rolling risk windows
ClickHouse OLAP
- 05<25ms
Verdict + Ledger
ACID write of limits and administrative state
PostgreSQL + Drizzle ORM
Where 380 milliseconds went — and where 48 remain
The legacy monolith spent its checkout window on database lock contention and analytics queries running against transactional tables. Splitting OLAP from OLTP recovered an 87% latency reduction.
- DB lock contention210ms
- OLAP on OLTP tables120ms
- Sync rule engine50ms
- Edge + schema gate11ms
- Redis risk profile4ms
- ClickHouse window8ms
- Postgres verdict25ms
⚠ The challenge
a FinTech risk platform required a high-performance fraud detection platform to analyze user actions in real time. Their legacy system caused checkout delays and false positives, leading to significant transaction abandonment. They needed a solution that would score transactions within milliseconds without compromising user experience or security.
✓ The architecture
We built a multi-layered risk analysis platform that evaluates behavioral and network signals in real time. The solution integrates ClickHouse for sub-millisecond fraud queries, Redis for caching risk factors, and Drizzle ORM on PostgreSQL for secure transactional history. The entire system is built with strict TypeScript and runs on AWS Healthcare cloud infrastructure with end-to-end data encryption. Automated compliance generators produce SOC2-compliant logging on every request.
Signals scored per transaction
- IP / network reputation
- Device fingerprint
- Behavioral patterns
- Transaction history
- Velocity windows
- Geolocation deltas
- Log ingestion
- 10,000 logs/s
- DB lock reduction
- 95%
- False positives
- <0.1%
engineering runbook · full write-up
Case Study: Real-Time Fraud Detection Platform Real-Time Security
Executive Summary
This document outlines the architecture, implementation methodology, and operational outcomes of Real-Time Fraud Detection Platform—a real-time cybersecurity platform designed to evaluate and mitigate transaction-level fraud. Before this engagement, a FinTech risk platform struggled with an aging monolithic application that suffered from high database locking contention, leading to an average transaction latency of 380ms and a 4.2% checkout abandonment rate due to false-positive fraud flags. Over a four-month engineering cycle, we migrated the critical risk-scoring path to a decoupled serverless edge layout powered by Next.js, Redis, and ClickHouse.
The Business Challenge
In digital commerce, fraud detection is a race against the clock. When a consumer clicks the checkout button, the application has at most 150ms to verify network reputation, device fingerprints, transaction history, and behavioral patterns. Any delay beyond this threshold directly impacts conversion rates. a FinTech risk platform's legacy system utilized a single relational database for both transactional processing (OLTP) and analytics queries (OLAP). This architectural bottleneck led to severe thread contention under peak loads, causing checkout processes to time out. The false-positive rate stood at 1.8%, locking out legitimate users and draining administrative resources in manual review cycles.
System Architecture
Real-Time Fraud Detection Platform utilizes a modern Strangler Fig migration pattern to intercept incoming API requests at the edge. The system is split into three main architectural layers:
- Edge Routing Layer (Vercel Edge & Cloudflare Workers): Captures incoming transaction metadata and executes initial geolocated IP reputation checks in under 10ms.
- Real-time Analytics Engine (ClickHouse & Redis): Clicking events and transaction volumes are logged into ClickHouse. Redis acts as a low-latency cache storing the active risk profile of all consumers.
- Core Transactional Database (PostgreSQL & Drizzle ORM): Manages account limits, limits tracking, and administrative state changes with ACID transactional guarantees.
[Edge Layer] ──(API Route)──> [Redis Cache / ClickHouse Logs]
│
└─────────(Drizzle ORM)──> [PostgreSQL Database]
Key Engineering Decisions
- Choosing ClickHouse for Logging: Relational databases are poorly suited for high-throughput append-only logs. ClickHouse allows the system to ingest up to 10,000 logs per second while maintaining query performance for rolling risk windows.
- Adopting strict TypeScript schemas with Zod: Every incoming API payload is parsed at the edge using Zod schemas. This ensures malformed attacks are rejected at the application border before eating database connections.
- Terraform for Infrastructure-as-Code: Every resource, from VPC subnets to RDS read replicas, is defined in version-controlled Terraform scripts, assuring consistent staging and production deployments.
Database Schema & Optimization
We leveraged Drizzle ORM to build a typed schema representing transaction histories and risk indexes. To prevent table scan degradation, we established indexes on composite keys:
- Indexing
(user_id, status, created_at)allows instant lookup of a user's recent successful transactions. - Partitioning the transactional log table by month avoids performance degradation as the record count grows into the millions.
Security & Compliance Controls
Titan was built from the ground up to achieve SOC 2 Type II and PCI-DSS Level 1 compliance:
- AES-256 Envelope Encryption: All personally identifiable information (PII) is encrypted at the application level using KMS keys.
- Immutable Audit Trail: Log entries in ClickHouse are marked read-only and replicated to secure AWS Glacier vaults with worm (Write Once, Read Many) policies.
- Semgrep SAST Integration: Security scans run automatically on every pull request, preventing cross-site scripting (XSS) and SQL injection vulnerabilities from reaching the master branch.
Results & Retrospective
The deployment of Real-Time Fraud Detection Platform delivered immediate improvements across all core metrics:
- Average check-out transaction latency dropped from 380ms to 48ms (an 87% reduction).
- False positive rates fell to under 0.1%, restoring merchant trust and increasing overall transaction volume.
- The system successfully passed its annual PCI-DSS Level 1 compliance audit with zero findings.
- Administrative manual review tasks were reduced by 80% through automated rule triggers.
Engineered capabilities
- Real-time behavioral and network security monitoring
- Multi-dimensional risk scoring
- API integrations for external platforms
- Automated compliance reporting
- SOC 2-ready and GDPR-aligned security standards
- Secure encryption key management
- Active application firewall protection
- Immutable log storage