Selected Work · Microservices
Konnect
Real-time chat across six services. A real-time chat platform across six microservices behind Traefik, with a Socket.IO gateway and an event-driven backbone on RabbitMQ and Kafka feeding an AI moderation pipeline.
Filed September 2025 · github.com/AnkitSinha0 ↗
- riaanyone up for the 9pm game?delivered
- devcount me in, bringing snacksdelivered
- anon_42██████ ██ ████held · pattern
- rialol you're so bad at thisflag · no action
Overview
Konnect is a real-time chat platform split across six microservices: a Next.js frontend, a Socket.IO WebSocket gateway, and backend services behind a Traefik reverse proxy that routes by host rule.
Services communicate through events rather than calling each other, and every chat message passes through an AI moderation pipeline before it can harm anyone.
The Problem
Chat is fan-out heavy and latency-sensitive, and a single slow dependency can stall every conversation if services call each other synchronously.
Moderation has the opposite failure mode: judging each message alone produces false positives that punish ordinary banter.
Konnect — Details & Assemblies
Six services · Sheet K-02 · Rev 0Fig. 1 — Gateway
Persistent duplex channel; one connection per client.
Fig. 2 — Proxy
Routes by host rule to six upstream services.
Fig. 3 — Topic
Ordered within a partition; consumers read by offset.
Fig. 4 — Window
Judges a pattern of messages, never one alone.
Fig. 5 — Dual Token
Private key signs; every service verifies with the public half.
Fig. 6 — Handshake
State token held in Redis; CSRF cannot forge the return.
Fig. 7 — Moderation
Suppresses false positives before a human ever sees them.
Fig. 8 — Service Plan
Each owns its data; none reaches into another’s store.
Key Features
- WebSocket gateway
- A persistent duplex Socket.IO channel, one connection per client.
- Dual-token auth
- JWT RS256 access and refresh tokens: a private key signs, every service verifies with the public half.
- OTP & OAuth
- Email OTP verification plus Google and GitHub OAuth 2.0 with CSRF-protected state.
- Event backbone
- RabbitMQ and Apache Kafka decouple services; chat events route through topic-based consumers.
- AI moderation
- RoBERTa and Toxic-BERT classify messages behind a Flask inference server.
- Sliding-window judgement
- Redis aggregates flags over a sliding window, so the system judges a pattern of messages, never one alone.
Technical Decisions
- 01Events over RPC
- Services own their data and publish what happened; none reaches into another's store.
- 02RS256 over HS256
- With six services verifying tokens, asymmetric keys mean only the auth service can mint them.
- 03Kafka for ordered streams
- Ordered within a partition, consumers read by offset — the moderation pipeline can replay history.
- 04Aggregate before acting
- A sliding window in Redis suppresses one-off false positives before a human ever sees them.
Reliability
- A slow consumer no longer blocks the chat path; messages queue instead of timing out.
- Traefik isolates routing from services, so a service can restart without clients reconnecting elsewhere.
Lessons
Event-driven design moves complexity rather than removing it: ordering, idempotency and replay become explicit design questions.
Moderation accuracy came less from the model than from the aggregation around it.