Skip to content

PsymoNiko/ChatOnPayment

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

105 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ChatOnPayment Logo

ChatOnPayment 💬

Rust‑powered microservices platform for real‑time chat & TON blockchain payments

GitHub Stars GitHub Forks License Microservices TON Blockchain


🏗️ The Vision: A Self‑Hostable Platform, Not Just an App

ChatOnPayment is designed as a production‑grade platform – a blueprint for a horizontally scalable, observable, and secure microservices ecosystem. The final goal is a one‑command deployable system that provides real‑time chat and payment rails as a service.


🛠️ Tech Stack (by Category)

🦀 Languages & Frameworks

Rust Python JavaScript TypeScript React FastAPI Node.js

🗄️ Databases & Storage

PostgreSQL Redis MinIO Rustfs planned

🔄 Message Queue & Event Streaming

Kafka Zookeeper

🔭 Observability (Tracing, Metrics, Logs)

Jaeger Prometheus Grafana Sentry Elasticsearch Kibana Logstash

🔐 Authentication & Security

Keycloak JWT OAuth

🐳 Container & Orchestration

Docker Docker Compose Kubernetes planned NGINX


✨ Core Engineering Pillars

  • 🦀 True Microservices in Rust – Performance‑critical services (Accounts, Core) are written in Rust for maximum throughput and memory safety.
  • ⚡️ Hybrid Object Storage – Currently uses MinIO (S3‑compatible); planned migration to Rustfs (Rust‑native, up to 2.3x faster for small objects) for high‑performance media storage.
  • 🔭 Deep Observability – Jaeger (tracing), Prometheus (metrics), Grafana (visualisation), Sentry (error tracking), ELK (logs).
  • ⚖️ Event‑Driven Architecture – Apache Kafka for asynchronous communication between services, with Zookeeper for coordination.
  • 🔐 Enterprise AuthenticationKeycloak as identity provider, supporting JWT, OAuth 2.0, and social logins (Google, GitHub).
  • 🧩 Data Separation – Two PostgreSQL instances: one for application data, one for logs. Redis for caching and session clustering.

🗺 Platform Architecture & Evolution Roadmap

Phase Focus & Deliverables Key Tools & Patterns
Phase 1 ✅ MVP Launch Basic messaging, TON wallet, single‑instance.
Phase 2 ✅ (Current) Containerisation & Observability Docker Compose with Rust/Python/TS services, Jaeger, Prometheus, MinIO, Kafka, ELK, Sentry, and NGINX.
Phase 3 ⚙️ (In Progress) Production Hardening Kubernetes (EKS) + Helm, GitOps (ArgoCD), service mesh (Istio).
Phase 4 📈 Storage Migration Replace MinIO with Rustfs cluster; implement PostgreSQL master‑slave + Redis cluster.
Phase 5 🔮 Self‑Service Platform One‑command deployment CLI (ctpctl); fully self‑hostable appliance.

🛠️ Deep Dive: Current Tech Stack (Phase 2)

Service Language/Framework Responsibility
Accounts Service Rust (Actix‑web) Auth, JWT, OAuth (Google/GitHub via Keycloak), user profiles.
Chat Service Python (FastAPI) + WebSockets Real‑time messaging, room management.
Payment Service TypeScript (Node.js) TON blockchain interactions.
Core Service Rust (Tokio) Service discovery, orchestrator.
NGINX - Reverse proxy, SSL termination, load balancer.
Keycloak - Identity provider (JWT + OAuth).
Jaeger - Distributed tracing.
Prometheus + Grafana - Metrics collection & dashboards.
Sentry - Error tracking.
ELK (Elasticsearch, Logstash, Kibana) - Centralised logging (chat logs stored in separate PostgreSQL + ELK).
Kafka + Zookeeper - Event‑driven communication.
MinIO - S3‑compatible object storage (attachments, media).
PostgreSQL ×2 - Main database + logs database.
Redis - Session cache, pub/sub.

📌 Storage Evolution
Currently MinIO handles all object storage. In Phase 4, we will migrate to Rustfs – a Rust‑native, high‑performance object store designed for low‑latency media serving. Benchmarks show Rustfs outperforms MinIO by 2.3x for 4KB objects, making it ideal for chat attachments and transaction receipts.

🔐 Authentication
Keycloak provides JWT tokens and integrates with Google & GitHub OAuth. All services validate tokens via a shared public key.


🚀 Getting Started (You'll be live in minutes)

  1. Clone & Enter the Repository

    git clone https://github.com/PsymoNiko/ChatOnPayment.git
    cd ChatOnPayment
  2. Configure Environment

    cp .env.sample .env
    # Edit .env with your TON testnet keys, OAuth credentials, etc.
  3. Launch the Entire Ecosystem

    docker-compose up --build

    This starts all 15+ services (Rust, Python, Node, databases, message queue, observability stack).

  4. Access the Platform

    • Chat UI: http://localhost:8080
    • Jaeger Tracing: http://localhost:16686
    • Prometheus: http://localhost:9090
    • Grafana: http://localhost:3000 (admin/admin)
    • Kibana: http://localhost:5601
    • Sentry: http://localhost:9900
    • Keycloak Admin: http://localhost:8080/auth (admin/admin)

👩‍💻 For Platform Engineers & Contributors

Repository structure (monorepo):

ChatOnPayment/
├── services/
│   ├── accounts-service/   (Rust)
│   ├── chat-service/       (Python/FastAPI)
│   ├── payment-service/    (TypeScript/Node)
│   └── core-service/       (Rust)
├── infrastructure/
│   ├── docker-compose.yml  # Current orchestration
│   └── k8s/                (Coming soon)
├── config/
│   ├── keycloak/           # Realm export
│   └── prometheus/         # Prometheus config
└── docs/                   # Architecture diagrams

We welcome contributions in:

  • Rust microservices (performance optimisations, new features)
  • Kubernetes manifests (moving away from Docker Compose)
  • Rustfs integration (storage layer migration)
  • Load testing (k6 / Locust scripts)

📄 License

MIT © Ali Mohammadnia


Built with 🦀 & ☕ by Ali Mohammadnia
Platform Engineer • Infrastructure Architect • Open Source Contributor

About

Come on chat

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors