Skip to content

Latest commit

Β 

History

History
468 lines (380 loc) Β· 23.6 KB

File metadata and controls

468 lines (380 loc) Β· 23.6 KB

System Architecture

Kovra: Cross-Border Payment Infrastructure Layer

Arsitektur Kovra dirancang sebagai abstraction layer untuk fintech & platforms - mirip "Stripe Treasury + Wise Engine" tapi fokus corridor EU/UK/ID + B2B batch.

Key Design: API-first, modular regional adapters, orthogonal compliance, standalone mode.

For detailed component specs, see 02_COMPONENTS.md.
For compliance architecture, see 03_COMPLIANCE.md.
For deployment details, see 04_DEPLOYMENT.md.


Design Principles

Orthogonal Separation

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    KOVRA PLATFORM                           β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                             β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”           β”‚
β”‚  β”‚  PAYMENT DOMAIN   β”‚      β”‚ COMPLIANCE DOMAIN β”‚           β”‚
β”‚  β”‚                   β”‚      β”‚                   β”‚           β”‚
β”‚  β”‚ β€’ Quote Service   β”‚      β”‚ β€’ KYC/AML         β”‚           β”‚
β”‚  β”‚ β€’ Transfer Svc    │◄────►│ β€’ Risk Scoring    β”‚           β”‚
β”‚  β”‚ β€’ Wallet Service  β”‚Event β”‚ β€’ Audit Trail     β”‚           β”‚
β”‚  β”‚ β€’ Batch Service   β”‚Bus   β”‚ β€’ Screening       β”‚           β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜           β”‚
β”‚           β”‚                          β”‚                      β”‚
β”‚           β”‚     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”‚                      β”‚
β”‚           └────►│   Kafka      β”‚β—„β”€β”€β”€β”€β”˜                      β”‚
β”‚                 β”‚  (Events)    β”‚                            β”‚
β”‚                 β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                            β”‚
β”‚                                                             β”‚
β”‚  Principle: Change one domain without affecting the other   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Independence

  • No mandatory external APIs: Core platform works standalone
  • Optional enhancements: External feeds (FX rates, sanctions) = cache + async updates
  • Interface contracts: Services communicate via interfaces, not concrete implementations

Tech Stack

Component Technology Purpose
Backend Go 1.25+ API services, business logic
Main DB PostgreSQL 18 Tenants, transfers, audit
Ledger TigerBeetle Double-entry accounting, balance tracking
Cache Redis 8.4 Rate limiting, FX rate lock, session
Job Queue River Webhook delivery, scheduled jobs, retry logic
Event Streaming Kafka Transfer events, audit trail, notifications
Compliance OxCaml 90% + Python 10% KYC/AML core in OxCaml, ML bridge in Python (see 03_COMPLIANCE.md)

High-Level System Diagram

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                           B2B CLIENTS                                       β”‚
β”‚         (E-commerce Platforms / Corporate Treasury Systems)                 β”‚
β”‚                                                                             β”‚
β”‚   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”       β”‚
β”‚   β”‚ Tokopedia   β”‚  β”‚ Bukalapak   β”‚  β”‚ Corp ERP    β”‚  β”‚ Treasury    β”‚       β”‚
β”‚   β”‚ Integration β”‚  β”‚ Integration β”‚  β”‚ (SAP/Odoo)  β”‚  β”‚ Management  β”‚       β”‚
β”‚   β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜       β”‚
β”‚          β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜              β”‚
β”‚                                    β”‚                                        β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                     β”‚
                                     β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                          API GATEWAY                                        β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”        β”‚
β”‚  β”‚ Rate Limit  β”‚  β”‚ Auth (JWT/  β”‚  β”‚ Request     β”‚  β”‚ Idempotency β”‚        β”‚
β”‚  β”‚ (per tier)  β”‚  β”‚ API Key)    β”‚  β”‚ Validation  β”‚  β”‚ Check       β”‚        β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜        β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                     β”‚
                                     β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                          CORE SERVICES                                      β”‚
β”‚                                                                             β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”‚
β”‚  β”‚    Quote     β”‚  β”‚   Transfer   β”‚  β”‚   Recipient  β”‚  β”‚    Wallet    β”‚    β”‚
β”‚  β”‚   Service    β”‚  β”‚   Service    β”‚  β”‚   Service    β”‚  β”‚   Service    β”‚    β”‚
β”‚  β”‚              β”‚  β”‚              β”‚  β”‚              β”‚  β”‚              β”‚    β”‚
β”‚  β”‚ β€’ FX rates   β”‚  β”‚ β€’ Orchestrateβ”‚  β”‚ β€’ Validate   β”‚  β”‚ β€’ Balance    β”‚    β”‚
β”‚  β”‚ β€’ Lock rate  β”‚  β”‚ β€’ State mgmt β”‚  β”‚ β€’ Store bank β”‚  β”‚ β€’ Hold/Releaseβ”‚   β”‚
β”‚  β”‚ β€’ Margin calcβ”‚  β”‚ β€’ Retry logicβ”‚  β”‚ β€’ IBAN check β”‚  β”‚ β€’ Multi-curr β”‚    β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚
β”‚         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜            β”‚
β”‚                                    β”‚                                        β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                      β”‚
β”‚  β”‚    Batch     β”‚  β”‚  Compliance  β”‚  β”‚   Webhook    β”‚                      β”‚
β”‚  β”‚   Service    β”‚  β”‚   Service    β”‚  β”‚   Service    β”‚                      β”‚
β”‚  β”‚              β”‚  β”‚              β”‚  β”‚              β”‚                      β”‚
β”‚  β”‚ β€’ Bulk ops   β”‚  β”‚ β€’ KYC/AML    β”‚  β”‚ β€’ Delivery   β”‚                      β”‚
β”‚  β”‚ β€’ Scheduling β”‚  β”‚ β€’ Screening  β”‚  β”‚ β€’ Retry      β”‚                      β”‚
β”‚  β”‚ β€’ Validation β”‚  β”‚ β€’ Audit      β”‚  β”‚ β€’ JWS sign   β”‚                      β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜                      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
          β”‚                 β”‚                 β”‚
          β”‚    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”‚
          β”‚    β”‚       Kafka Topics      β”‚    β”‚
          β”‚    β”‚  β€’ transfer.events      β”‚    β”‚
          β”‚    β”‚  β€’ compliance.events    β”‚    β”‚
          β”‚    β”‚  β€’ audit.trail          β”‚    β”‚
          β”‚    β”‚  β€’ webhook.dlq          β”‚    β”‚
          β”‚    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚
          β”‚                                   β”‚
          β–Ό                                   β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                       REGIONAL ADAPTERS                                     β”‚
β”‚                                                                             β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”             β”‚
β”‚  β”‚   EU Adapter    β”‚  β”‚   UK Adapter    β”‚  β”‚   ID Adapter    β”‚             β”‚
β”‚  β”‚  (SEPA/PSD2)    β”‚  β”‚  (FPS/CHAPS)    β”‚  β”‚  (BI-FAST/SNAP) β”‚             β”‚
β”‚  β”‚                 β”‚  β”‚                 β”‚  β”‚                 β”‚             β”‚
β”‚  β”‚ β€’ SEPA Instant  β”‚  β”‚ β€’ Faster Pay    β”‚  β”‚ β€’ BI-FAST       β”‚             β”‚
β”‚  β”‚ β€’ SCT           β”‚  β”‚ β€’ CHAPS         β”‚  β”‚ β€’ RTGS          β”‚             β”‚
β”‚  β”‚ β€’ ISO 20022     β”‚  β”‚ β€’ ISO 20022     β”‚  β”‚ β€’ SNAP Auth     β”‚             β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜             β”‚
β”‚           β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Positioning: Infrastructure Layer

Kovra bukan bank atau neobank replacement. Kovra adalah infrastructure layer yang dipakai oleh fintech lain.

Bukan Target Kovra:

  • ❌ End-user exporters (langsung) - indirect via fintech partners
  • ❌ Bank konvensional (CIMB, BCA) - sales cycle panjang
  • ❌ Korporasi besar (Unilever, Astra) - treasury system existing

Target Kovra:

  • βœ… Fintech platforms (Xendit, Midtrans) - API integration cepat
  • βœ… Payment aggregators - Tambah corridor tanpa rebuild
  • βœ… Digital commerce - Batch payout + ERP integration

Integration Pattern

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    FINTECH PARTNER                          β”‚
β”‚  (Xendit, Midtrans, Bank Jago, etc.)                        β”‚
β”‚                                                             β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”         β”‚
β”‚  β”‚   Mobile    β”‚  β”‚   Web       β”‚  β”‚   API       β”‚         β”‚
β”‚  β”‚   App       β”‚  β”‚   Dashboard β”‚  β”‚   Endpoints β”‚         β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜         β”‚
β”‚         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜              β”‚
β”‚                           β”‚                                 β”‚
β”‚                           β–Ό                                 β”‚
β”‚              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                     β”‚
β”‚              β”‚  KOVRA API (REST)     β”‚                     β”‚
β”‚              β”‚  β€’ Quotes             β”‚                     β”‚
β”‚              β”‚  β€’ Transfers          β”‚                     β”‚
β”‚              β”‚  β€’ Webhooks           β”‚                     β”‚
β”‚              β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                           β”‚
         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
         β”‚                 β”‚                 β”‚
         β–Ό                 β–Ό                 β–Ό
   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
   β”‚  Backend β”‚     β”‚Complianceβ”‚     β”‚  Ledger  β”‚
   β”‚  (Go)    β”‚     β”‚(OxCaml+Py) β”‚    β”‚(TB)      β”‚
   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Value: Fintech partner bisa fokus pada UX & customer acquisition, Kovra handle complex cross-border infrastructure.


Service Responsibilities (Summary)

Service Core Responsibility Independence
Quote Service FX rate fetch, margin calc, rate locking Can swap FX providers without affecting others
Transfer Service Orchestrate payment lifecycle, state management No dependency on compliance internals
Recipient Service Validate and store beneficiary details Can add new rails without touching core
Wallet Service Balance tracking, hold/release Uses TigerBeetle, isolated from business logic
Batch Service Bulk payment processing Independent queue processing
Compliance Service KYC/AML screening, risk scoring Orthogonal domain - see 03_COMPLIANCE.md
Webhook Service Event delivery to tenants Can be replaced with different queue system

Data Flow (Primary: EU→Indonesia)

B2B Client (Exporter)
    β”‚
    β–Ό
POST /quotes ────────────────────────────┐
    β”‚                                    β”‚
    β–Ό                                    β”‚
Quote Service ◄──FX rates───► Cache      β”‚
    β”‚                                    β”‚
    └──────────────► Quote {rate, expiry}β”˜
                                          β”‚
POST /transfers {quote_id, recipient}    β”‚
    β”‚                                    β”‚
    β–Ό                                    β”‚
Transfer Service                         β”‚
    β”‚                                    β”‚
    β”œβ”€β–Ί Compliance Check (via event bus) β”‚
    β”‚    See [03_COMPLIANCE.md]          β”‚
    β”‚                                    β”‚
    β”œβ”€β–Ί Wallet Hold (TigerBeetle)        β”‚
    β”‚                                    β”‚
    β”œβ”€β–Ί Collect EUR (EU Adapter)         β”‚
    β”‚                                    β”‚
    β”œβ”€β–Ί FX Conversion                    β”‚
    β”‚    EUR β†’ IDR (Two coordinated      β”‚
    β”‚    TigerBeetle chains)             β”‚
    β”‚                                    β”‚
    β”œβ”€β–Ί Payout IDR (ID Adapter)          β”‚
    β”‚                                    β”‚
    └─► Webhook: transfer.completed β—„β”€β”€β”€β”€β”˜

For detailed state machine and ledger design, see 02_COMPONENTS.md.


Multi-Tenancy

Tenant Isolation Flow

API Request
    β”‚
    β”œβ”€β–Ί API Key β†’ Tenant ID lookup (Redis)
    β”œβ”€β–Ί Rate limit check (per tenant tier)
    β”œβ”€β–Ί Tenant context injection
    β”œβ”€β–Ί All queries filtered by tenant_id
    └─► TigerBeetle accounts prefixed with tenant_id

Isolation Guarantees:
β€’ Tenant A cannot query Tenant B data
β€’ Tenant A cannot debit Tenant B wallet
β€’ Webhook signatures are tenant-specific

Tenant Tiers (Policy-Based)

Policy Starter Growth Enterprise
Rate Limit 100 req/min 500 req/min 2,000 req/min
Daily Volume $10,000 $100,000 $1,000,000+
FX Margin 150 bps 80 bps 30-50 bps

Implementation: Separate tables (pricing_policies, limit_policies) linked to tenants. Tier = derived from policies, not identity.


TigerBeetle Ledger (Summary)

Account Structure

LEDGER CODES (ISO 4217):
β”œβ”€β”€ 360 - IDR (Indonesian Rupiah)
β”œβ”€β”€ 840 - USD (US Dollar)
β”œβ”€β”€ 978 - EUR (Euro)
β”œβ”€β”€ 826 - GBP (British Pound)
β”œβ”€β”€ 752 - SEK (Swedish Krona)
└── 208 - Danish Krone)

ACCOUNT TYPES:
β”œβ”€β”€ TENANT_WALLET (per tenant, per currency)
β”œβ”€β”€ FEE_REVENUE (platform fees)
β”œβ”€β”€ FX_POSITION (internal FX operations)
β”œβ”€β”€ PENDING_INBOUND (funds being collected)
β”œβ”€β”€ PENDING_OUTBOUND (funds being sent)
└── REGIONAL_SETTLEMENT (per corridor)

ACCOUNT ID FORMAT:
[tenant_id: 64 bits] [account_type: 8 bits] [currency: 24 bits]

For detailed ledger design and transfer examples, see 02_COMPONENTS.md.


Inter-Service Communication

Event-Driven (Kafka)

Benefits over direct calls:
βœ“ Services don't know about each other
βœ“ No cascading failures
βœ“ Easy to add new consumers
βœ“ Audit trail built-in

Topics:
β€’ transfer.events     - State changes, completions
β€’ compliance.events   - Screening results, alerts
β€’ audit.trail         - Immutable audit log
β€’ webhook.dlq         - Dead letter queue

Interface Contracts

// Payment Service doesn't know Compliance internals
type ComplianceChecker interface {
    Check(ctx context.Context, transfer Transfer) (ComplianceStatus, error)
}

// Can be implemented by:
// - Real compliance service
// - Mock (testing)
// - No-op (emergency mode)
// - Cached (performance mode)

Regional Adapters

Region Adapter Rails Key Specs
Indonesia ID Adapter BI-FAST (instant), RTGS (large) SNAP Auth, ISO 20022
EU EU Adapter SEPA Instant, SCT FAPI 2.0, PSD2, ISO 20022
UK UK Adapter Faster Payments, CHAPS UK FAPI, ISO 20022

For detailed adapter specs, see INTEGRATION.md.


Failure Handling Strategy

Scenario Detection Action
Quote expired State timeout (10min) Reject, user creates new quote
Compliance fail Screening service Block + flag for review
Insufficient funds Balance check Reject immediately
Rail timeout No ACK in 5min Mark PENDING_RAIL, retry with backoff
Rail rejection Negative ACK Mark RAIL_REJECTED, refund

For comprehensive failure handling, see 02_COMPONENTS.md.


Independence Mode

Standalone Operation

# Kovra can run 100% offline
mode: standalone
features:
  - sanctions_source: local_db      # No OFAC API calls
  - fx_rates_source: internal       # No XE/Fixer required
  - compliance_mode: rule_based     # No ML model required
  - audit_storage: local            # No external log aggregation

# External APIs = optional enhancements
enhancements:
  - sanctions_sync: async_daily     # Update local DB
  - fx_feeds: xe, fixer, bi_jisdor  # Better rates
  - ml_screening: optional          # Better accuracy

Competitive Advantage (2026)

Why Fintech Choose Kovra

1. Speed to Market

  • Traditional: 18-24 bulan build cross-border infrastructure
  • Kovra: 3-9 bulan POC β†’ production
  • API-first: Integration dalam minggu, bukan bulan

2. Corridor Spesialisasi

  • Fokus: EU/UK ↔ Indonesia (high-demand corridor)
  • Rails: SEPA Instant, FPS, BI-FAST (real-time)
  • FX: Internal calculation + external feeds (hybrid)

3. Architecture Modern

  • Orthogonal: Compliance evolve tanpa touch payment flow
  • Standalone: Works 100% tanpa external APIs
  • Event-driven: Kafka untuk async processing
  • Immutable ledger: TigerBeetle untuk audit trail

4. B2B Batch Optimized

  • Bulk payouts ke supplier global
  • Netting untuk optimize FX
  • ERP integration (SAP, Odoo)

Competitive Landscape

Player Approach Kovra Differentiation
Xendit Build sendiri, corridor luas Kovra: Deeper EU/UK/ID, faster integration
Wise Direct to consumer Kovra: B2B infrastructure, white-label
Traditional Banks Legacy systems Kovra: API-first, <50ms latency
Stripe US-focused Kovra: Indonesia/SEA focused

Performance Targets

Metric Target Notes
TPS 5,000 k6 load test
P50 latency < 15ms API response
P95 latency < 50ms API response (faster than traditional 200-500ms)
Success rate > 99.5% Completed transfers
Compliance screening < 500ms Fast fail for payment flow
Time to Integration < 4 minggu Untuk fintech API-ready

Data Residency

Data Location Compliance
IDR transfers Indonesia partition OJK
EUR/SEK/DKK EU partition GDPR
GBP UK partition FCA

Implementation: PostgreSQL LIST partitioning on compliance_region column.


Documentation Map

00_OVERVIEW.md (you are here)
    β”‚
    β”œβ”€β–Ί 01_ARCHITECTURE.md (high-level)
    β”‚       └─► 02_COMPONENTS.md (detailed implementation)
    β”‚
    β”œβ”€β–Ί 03_COMPLIANCE.md (KYC/AML domain)
    β”‚
    β”œβ”€β–Ί 04_DEPLOYMENT.md (infrastructure)
    β”‚
    β”œβ”€β–Ί INTEGRATION.md (external adapters)
    β”‚
    β”œβ”€β–Ί DATABASE.md (schema)
    β”‚
    └─► SECURITY.md (auth, encryption)

Next: 02_COMPONENTS.md for detailed component specs
Compliance: 03_COMPLIANCE.md for KYC/AML architecture
Deploy: 04_DEPLOYMENT.md for infrastructure setup


Last Updated: 2026-02-15 (Positioning Update: Infrastructure Layer untuk Fintech)