Skip to content

Infrastructure

Complete server architecture showing how every component in the Keshless platform communicates — clients, backend services, databases, storage, external integrations, and scheduled jobs.

System Overview


Network & DNS Routing

All traffic flows through HTTPS. Mobile apps and the dashboard never talk to the database directly — everything goes through the API.

DomainPoints ToPurpose
api.keshless.comCloud Run — keshless-apiProduction API
dev-api.keshless.comCloud Run — keshless-api-devDevelopment API
ussd.keshless.comCloud Run — keshless-ussdUSSD callbacks + Swazi Mobile proxy
dashboard.keshless.comCloudflare PagesAdmin dashboard (React)
keshless.comCloudflare PagesPublic website

Request Flow


Authentication Flows

Three distinct auth mechanisms for different client types, plus API key auth for partners.

User Authentication (Phone + OTP)

Vendor Authentication (Email + Password + Device)

Admin Authentication

Partner API Authentication


Data Flow: Payment Transaction

Every payment creates balanced double-entry accounting records. Here's a user-to-vendor payment:


KYC Verification Flow

Documents are stored in GCS with signed URLs — never public. Verification uses AWS for face matching and OCR.


Scheduled Jobs

Cloud Scheduler triggers jobs via authenticated HTTP calls to the API. Each job endpoint validates the X-Job-Secret header.

JobScheduleEndpointWhat It Does
PostgreSQL BackupDaily 2 AM/backup-jobs/backupFull database dump to GCS
Secrets BackupDaily 3 AM/backup-jobs/secretsExport GCP secrets (AES-256-GCM encrypted) to GCS
Sanctions SyncDaily 3 AM/sanctions-jobs/syncDownload UN sanctions list, fuzzy-match against users (80% threshold)
Report GenerationDaily 6 AM/report-jobs/generateFinancial, operational, and compliance reports
Backup CleanupDaily 7 AM/backup-jobs/cleanupDelete backups older than 30 days
Alert EscalationEvery 4 hours/jobs/alert-escalationEscalate unresolved AML alerts
Approval ExpiryEvery 30 minutes/jobs/approval-expiryExpire pending card/withdrawal approvals

GCP Project Layout

All infrastructure lives in a single GCP project with resources in europe-west1.

ResourceServiceName / IDPurpose
Cloud RunComputekeshless-apiProduction API
Cloud RunComputekeshless-api-devDevelopment API
Cloud RunComputekeshless-ussdUSSD server
Cloud SQLDatabasekeshless-postgresPostgreSQL instance (dev + prod DBs)
Cloud StorageStoragekeshless-documentsKYC photos, ID scans, selfies, vendor media
Cloud StorageStoragekeshless-backupsDatabase backups, secrets backups
Secret ManagerSecurityKESHLESS_* prefixedJWT secrets, DB URLs, API keys, encryption keys
Cloud BuildCI/CDTriggers on dev and prod branchesDocker build → Artifact Registry → Cloud Run
Artifact RegistryCI/CDDocker imagesContainer images for API and USSD
Cloud SchedulerJobs7 scheduled jobsBackups, sanctions sync, reports, escalation
Cloud LoggingObservabilityStructured JSON logsRequest logs, security events, audit trail

Deployment Pipeline

API (Cloud Run via Cloud Build)

Cloud Run Configuration:

  • CPU: 1 vCPU
  • Memory: 512 MB
  • Min instances: 1 (always warm)
  • Max instances: 20
  • Timeout: 300 seconds
  • Concurrency: 1000 requests per instance

Dashboard (Cloudflare Pages)

Mobile Apps (Manual Build)


USSD & Telecom Integration

The USSD server is a separate Cloud Run service that handles telco callbacks and proxies airtime requests.

The USSD server acts as a bridge — it receives USSD menu inputs from MTN, manages session state, and proxies requests to the main API for wallet operations and to Swazi Mobile for airtime top-ups (the Swazi Mobile ERS360 API sits on a private IP, so the USSD server on Cloud Run acts as the public-facing proxy).


Storage Architecture

Key rules:

  • All KYC documents accessed via signed URLs only (never public)
  • Max upload size: 10 MB per file
  • Backups encrypted with AES-256-GCM before storage
  • Backup retention: 2 years (PostgreSQL and secrets)
  • Cleanup job deletes backups older than 30 days (daily), keeps monthly/yearly snapshots

External Service Dependencies

ServiceProviderPurposeProtocolAuth
Notification ServiceEneza (shared)OTP delivery, transaction alertsHTTPS RESTX-API-KEY header
Face MatchingAWS RekognitionSelfie vs ID photo comparisonAWS SDKIAM access keys
ID OCRAWS TextractExtract text from ID documentsAWS SDKIAM access keys
OCR FallbackGoogle GeminiBackup OCR processorHTTPS RESTAPI key
Sanctions ListUN (Azure Blob)PEP/sanctions screeningHTTPSPublic
SMS FallbackYeboLinkSMS when WhatsApp unavailableHTTPS RESTAPI key
MTN AirtimeMTN ERS360Airtime top-up via USSDSOAP/XMLCredentials
Swazi AirtimeSwazi Mobile ERS360Airtime top-up (private IP)SOAP/XMLCredentials

Internal use only - Keshless Payment Platform