Architecture

How LedgerLens turns raw transaction streams into prioritized, evidence-backed findings.

System architecture

User browser

Analyst & client requests

Vercel / v0 frontend

Next.js App Router, edge-cached

Server Actions / API Routes

Server-side data access

Risk engine

Deterministic rule evaluation

Amazon Aurora PostgreSQL

System of record

Served from Aurora

Findings

Evidence-backed, scored

Reports

Compliance summaries

Evidence timeline

Reconstructable audit trail

Detection pipeline

Ingest

Events arrive via REST, stream, or warehouse sync and are normalized to a single schema.

Risk engine

A deterministic rule set scans each batch and emits evidence-backed findings with risk scores.

Persist

Events, findings, and evidence are stored in Amazon Aurora PostgreSQL for query and audit.

Triage

Analysts review findings, change status, and export reports — every action is audit-logged.

Why Amazon Aurora PostgreSQL?

The AWS database chosen as the system of record for LedgerLens.

  • Full PostgreSQL compatibility — standard SQL plus JSONB for flexible event payloads and rich indexing for fast analytical queries over millions of events.
  • Storage and compute scale independently; read replicas absorb dashboard and reporting traffic without slowing ingestion.
  • Continuous backup, point-in-time recovery, and Multi-AZ failover deliver the durability a financial-integrity product requires.
  • Aurora Serverless v2 scales capacity to match bursty transaction volume, keeping cost proportional to load.
  • IAM authentication and encryption in transit and at rest satisfy enterprise security and compliance reviews.
Data model

organizations

id, name, industry, plan

monitored_users

id, external_id, wallet_balance, risk_score, status

tx_events

id, external_id, type, amount, balance_before/after, device_hash

findings

id, rule_id, severity, risk_score, status, user_id

finding_evidence

id, finding_id, event_id, label, weight

reports

id, period, summary, metrics (jsonb)

audit_logs

id, actor, action, target, detail, created_at

The relational schema lives in lib/db/schema.sql. The demo runs on a deterministic in-memory dataset; swapping in Aurora is a matter of replacing the read functions in lib/demo-data.ts with the SQL queries in lib/db/aurora.ts — every type stays identical.

Detection rules (8)

DUPLICATE_TXN

Duplicate transaction ID

BALANCE_MISMATCH

Wallet balance mismatch

WITHDRAW_AFTER_BONUS

Withdrawal immediately after bonus claim

SHARED_DEVICE

Multiple accounts on one device

FAST_WITHDRAWAL

High-value deposit then fast withdrawal

REPEATED_FAILED_WITHDRAWALS

Repeated failed withdrawals

CHARGEBACK_AFTER_BONUS

Chargeback after bonus activity

NEGATIVE_BALANCE

Negative wallet balance

Built with v0