Rust‑powered microservices platform for real‑time chat & TON blockchain payments
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.
- 🦀 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 Authentication – Keycloak 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.
| 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. |
| 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
CurrentlyMinIOhandles 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
Keycloakprovides JWT tokens and integrates with Google & GitHub OAuth. All services validate tokens via a shared public key.
-
Clone & Enter the Repository
git clone https://github.com/PsymoNiko/ChatOnPayment.git cd ChatOnPayment -
Configure Environment
cp .env.sample .env # Edit .env with your TON testnet keys, OAuth credentials, etc. -
Launch the Entire Ecosystem
docker-compose up --build
This starts all 15+ services (Rust, Python, Node, databases, message queue, observability stack).
-
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)
- Chat UI:
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)
MIT © Ali Mohammadnia
Built with 🦀 & ☕ by Ali Mohammadnia
Platform Engineer • Infrastructure Architect • Open Source Contributor
