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
Consumers
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
1 Payments database — PostgreSQL (RDS)
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
2 Credit store — MongoDB Atlas (Document DB)
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)
3 Cache layer & search indexes
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
4 File & object storage (S3)
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)
5 Data operations & reliability
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
Capacity metrics
Total data cost
Growth: ~15% MoM