← Back to architecture

Data Tier — Payments DB, Credit Store & FX/Stablecoin Data Access

Persistence and data access layer: relational databases → document stores → caching → search indexes → file storage · handles all CRUD, querying, and data integrity across domains

Service layer
Credit Service
Payment Service
FX Service
User Service
AI Agents
Access patterns
TypeORM repositories
Mongoose models
Redis client
S3 SDK
ES client
Query patterns
OLTP (single row)
Batch reads
Aggregations
Full-text search
Time-series
Connection pools
PG pool
50
Mongo pool
30
Redis conns
100
Core tables
transactions
wallets
ledger_entries
payment_methods
settlements
refunds
FX & stablecoin
fx_rates
fx_orders
stablecoin_transfers
corridors
hedging_positions
liquidity_pools
User & accounts
users
kyc_records
subscriptions
notification_prefs
audit_logs
sessions
Infrastructure
Multi-AZ (primary + standby)
Read replicas (2x)
Automated backups (35d)
Point-in-time recovery
Encrypted at rest (KMS)
db.r6g.xlarge
Collections
credit_reports
score_history
dispute_cases
action_plans
bureau_responses
credit_factors
AI/ML data
llm_conversations
embeddings
prompt_history
model_predictions
feedback_signals
training_data
Document structure
Flexible schema
Nested credit items
Array of accounts
Versioned documents
TTL indexes (logs)
Compound indexes
Infrastructure
M40 cluster (3-node)
Sharded (user_id)
Auto-scaling storage
Change streams (CDC)
Atlas Search index
Encrypted (field-level)
Redis cache
Session store
Rate limit counters
API response cache
Feature flags
Pub/sub channels
Sorted sets (leaderboard)
Cache strategy
Cache-aside (default)
Write-through (session)
TTL: 5m (scores)
TTL: 1h (profiles)
TTL: 24h (rates)
Invalidation (event)
Elasticsearch
Transaction search
User search
Audit log search
Credit report FTS
Analytics aggregation
Vector search (RAG)
Infrastructure
ElastiCache (r6g.large)
Cluster mode: 3 shards
OpenSearch: 3 data nodes
Cross-AZ replication
Memory: 26GB Redis
Storage: 500GB ES
Buckets
kredete-documents
kredete-ml-artifacts
kredete-backups
kredete-logs-archive
kredete-static-assets
Document types
KYC identity docs
Credit report PDFs
Dispute letters
Compliance reports
Model checkpoints
Lifecycle rules
Standard → IA (30d)
IA → Glacier (90d)
Delete logs (365d)
Versioning enabled
Cross-region replication
Security
SSE-KMS encryption
Bucket policies (strict)
Pre-signed URLs (15m)
Access logging
Object lock (compliance)
Migrations
TypeORM migrations
Blue-green schema
Backward compatible
Rollback tested
CI/CD integrated
Backup & recovery
RDS: auto daily
Mongo: continuous
Redis: AOF persist
RPO: 5 minutes
RTO: 30 minutes
Monitoring
Query performance (slow log)
Connection pool health
Disk usage alerts
Replication lag
Deadlock detection
Compliance
PII encryption (field)
Right to deletion
Data retention policy
Access audit trail
SOC 2 controls
PostgreSQL
Size
340GB
Tables
62
QPS
8.2K
p95
12ms
MongoDB
Size
1.2TB
Collections
28
Ops/sec
5.4K
p95
18ms
Redis
Memory
18GB
Keys
12M
Hit rate
94%
p99
<1ms
S3
Storage
4.8TB
Objects
18M
GET/day
2.1M
Cost/mo
$420
Total data cost
Monthly
$3.2K
Growth: ~15% MoM