Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

70 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AetherPay – A Scalable, Event-Driven Microservices Payment Gateway & Subscription Management SaaS Platform (built entirely in Golang)

High-Level Architecture Overview (MVP)

Microservices (6 core services – each in its own Go module/repo or monorepo sub-folder):

  1. Auth Service – User/merchant onboarding, JWT + refresh tokens, multi-tenant isolation (tenant ID in claims), rate-limiting with Redis.

  2. Merchant Service – Merchant profiles, API keys, webhooks configuration.

  3. Billing Service – Subscription plans, invoices, pricing tiers (uses Postgres + Redis cache).

  4. Payment Service – Core transaction processing (mocked gateway), idempotency keys, 3DS simulation.

  5. Notification Service – Emails, webhooks, SMS (consumes queues).

  6. Analytics Service – Real-time + batch reporting (consumes Kafka events).

Cross-cutting concerns (shared libraries or sidecars):

  • API Gateway (custom Go service with Fiber/Gin + middleware or Traefik).

  • Internal communication: gRPC (with Protobuf) between services + Kafka for async events.

  • Observability: OpenTelemetry + Jaeger (tracing), Prometheus + Grafana (metrics), Zap (structured logging).

Tech Stack (exactly what you asked for + senior essentials):

| Component | Technology | Purpose |

|------------------------|-------------------------------------|--------|

| Language & Framework | Go 1.23+, Fiber/Gin + gRPC | High-performance APIs |

| Messaging (Queue) | RabbitMQ | Reliable background jobs (emails, webhooks, retries) |

| Messaging (Streaming) | Kafka (with Sarama or Franz-go) | Business events (PaymentSucceeded, SubscriptionCreated) for analytics & audit |

| Caching / Rate-limit | Redis (go-redis + Redis Cluster) | Session cache, rate limiting, idempotency store |

| Databases | PostgreSQL (per-service or schema-based multi-tenant) | Transactional data |

| Containerization | Docker + multi-stage builds | Each service + DB + brokers |

| Orchestration | Kubernetes (Helm charts or plain YAML) | Deployments, HPA, StatefulSets, Ingress, Secrets |

| Resilience | github.com/sony/gobreaker + retries + Outbox pattern | Circuit breaking & reliable events |

| Tracing & Metrics | OpenTelemetry + Jaeger + Prometheus | Full observability |

MVP Features (build this first – 4–6 weeks for a solid senior portfolio)

Core User Flows:

  1. Merchant registers → gets API key + tenant ID.

  2. Merchant creates subscription plans.

  3. Customer subscribes → Payment Service processes (mock success/failure).

  4. On success:

    • Payment Service publishes Kafka event (PaymentSucceeded).

    • Analytics Service consumes and updates dashboards.

    • Notification Service picks up RabbitMQ task → sends email + fires merchant webhook.

  5. Idempotent retry support (same payment request ID → no double charge).

  6. Basic merchant dashboard API (list subscriptions, revenue metrics).

Non-functional MVP requirements (what makes it senior):

  • Distributed Saga for subscription + payment (orchestrated via Kafka events + compensating actions).

  • Outbox Pattern in Payment/Billing services → guarantees events are published even if Kafka is down.

  • Horizontal scaling: each service can have 3+ pods.

  • Rate limiting (Redis) at gateway + per-tenant.

  • Graceful shutdown + zero-downtime deployments (K8s readiness/liveness probes).

  • Full observability: trace a single payment request across 5 services.

Full Project Architecture Details (MVP – Production Ready)

  1. Repository Structure (Monorepo recommended for ease)

    
    aetherpay/
    
    ├── services/
    
    │   ├── auth/          (Go module)
    
    │   ├── merchant/
    
    │   ├── billing/
    
    │   ├── payment/       ← heaviest service
    
    │   ├── notification/
    
    │   └── analytics/
    
    ├── infra/             ← k8s manifests + Helm
    
    ├── docker-compose.yml ← local dev (all brokers + DBs)
    
    ├── shared/            ← common libs (errors, otel, saga utils)
    
    └── deploy/            ← ArgoCD/GitOps optional for bonus points
    
    
  2. Docker + Kubernetes Setup

    • Every service has its own Dockerfile (multi-stage, < 50 MB images).

    • docker-compose.yml for local: includes Postgres (x6 schemas or separate), Redis Cluster, RabbitMQ, Kafka (with Zookeeper or KRaft), Kafka UI, RabbitMQ Management.

    • K8s manifests (or Helm chart):

      • Deployments + HPA (CPU/Memory based autoscaling).

      • StatefulSet for Postgres, Redis, Kafka.

      • ClusterIP Services + Ingress (Nginx or Traefik).

      • ConfigMaps + Secrets (or external-secrets operator).

      • NetworkPolicies for security.

  3. Messaging Strategy (why both RabbitMQ + Kafka)

    • RabbitMQ → Task queue (fire-and-forget jobs with dead-letter queues, retries with exponential backoff).

    • Kafka → Durable event log (replayable, exactly-once semantics with transactions, analytics & audit trail).

  4. Redis Usage (3 critical patterns)

    • Session + API key cache.

    • Distributed rate limiter (token bucket).

    • Idempotency store (payment request ID → result for 24h).

  5. Observability Stack (deploy in K8s)

    • Jaeger for distributed tracing.

    • Prometheus + Grafana dashboards (request latency, error rate, queue depth, Kafka lag).

    • Loki for logs (optional).

  6. Security & Senior Touches

    • mTLS between services (optional but impressive).

    • JWT with tenant isolation + OPA/Gatekeeper policies in K8s.

    • All external APIs behind API key + rate limit.

    • Audit logging via Kafka.

How to Build & Showcase It (Senior Portfolio Tips)

  • Local dev → docker-compose up.

  • Production-like → kubectl apply -f infra/ or Helm.

  • Write comprehensive README with:

    • Architecture diagram (draw.io or Excalidraw).

    • Saga flow explanation.

    • How you handled exactly-once delivery.

    • K8s scaling test results (locust or k6 load test).

  • Add CI/CD (GitHub Actions) → build, test, scan, push to kind/local cluster.

  • Bonus senior points: implement Chaos Engineering (chaos-mesh) to kill pods and show resilience.

This single project lets you speak confidently about every senior Go microservices topic: event-driven architecture, distributed transactions, cloud-native deployment, observability, resilience patterns, and scaling.

Build it, put it on GitHub with a killer README + architecture diagram, and you will stand out massively for Senior Go / Microservices / Backend Engineer roles (especially in fintech, payments, or high-scale SaaS companies).

Start with the Payment + Billing services + Kafka + RabbitMQ integration — that alone will already look senior. Good luck! If you want the exact folder structure, sample Dockerfiles, or Saga implementation skeleton, just ask.

About

No description or website provided.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages