Conceptual Architecture

Architecture guide

The NFM Payment Gateway is a modern, microservices-based payment system built using a serverless-first approach. This overview introduces the key concepts and architecture of the system.

Core Principles

Our system is built on these fundamental principles:

  • Serverless First: Utilizing GCP Cloud Functions/Cloud Run for event-driven, stateless services
  • API-Driven: All communication via well-defined APIs
  • Event-Driven: Using GCP Pub/Sub for asynchronous communication
  • Managed Services: Leveraging managed services to reduce operational overhead
  • Security by Design: Implementing multi-layer security

Architecture Overview

The system is composed of decoupled microservices, each with specific responsibilities:

Frontend Applications

  • Management Platform: Next.js-based interface for House administration and Agent operations
  • Deployment: Google Cloud Run with SSR capabilities

Core Services

  • User & Agent Management: Handles user accounts, profiles, and permissions
  • Device Management: Manages device registration and status tracking
  • Transaction Processing: Handles recharge and payout operations
  • Reporting: Provides comprehensive transaction analytics

Key Technologies

Tech Stack Highlights

  • Frontend: Next.js with TypeScript & Tailwind CSS
  • Backend: Node.js with TypeScript
  • Database: PostgreSQL (Cloud SQL) & Firestore
  • Message Bus: Google Cloud Pub/Sub
  • Authentication: Firebase Authentication

System Context

System Context

The system interacts with several external actors:

  • House Administrators
  • Agents
  • Payment Devices
  • External Banking Systems

Data Flow Examples

Recharge Workflow

  1. Agent device fecthing recharge transaction data
  2. Transaction is validated and processed
  3. Fees are calculated
  4. Notifications are sent to relevant parties
  5. Transaction is recorded for reporting

Payout Workflow

  1. Agent initiates payout request
  2. Request is validated against balance/limits
  3. Appropriate device is selected for automation
  4. Payout is executed and status tracked
  5. Transaction is recorded and notifications sent
Previous
Technical Solutions