Back to Projects

AuraChat

Microservices + Real-Time5 min read

Real-time messaging with a phosphor-green terminal UI — DMs, groups, media, reactions, typing & read receipts. 4-service microservices (gateway, user, chat) + Socket.io, Email OTP + Google auth, Prisma on PostgreSQL, Docker Compose.

AuraChat - Image 1
Microservices + Real-Time
1 / 6

←Use arrow keys or swipe to navigate→

The Problem

Most chat apps look identical — rounded bubbles, purple gradients, and forgettable UX. Developers and students who live in terminals want something that feels intentional, but "retro" skins are usually cosmetic overlays on the same generic messenger. Meanwhile, building real chat at production depth means auth (OTP + OAuth), microservice boundaries, Socket.io presence, media uploads, read receipts, group semantics, and deployment — not a single Express monolith with socket.on('message').

AuraChat targets both gaps: a **distinct phosphor-green terminal identity** (CRT scanlines, monospace, bracket buttons, control deck) backed by a **real microservices stack** — gateway, user service, chat service, and Next.js frontend — with 30+ REST endpoints, 15+ socket events, and Docker Compose for one-command local runs.

My Role & Constraints

Solo Full-Stack Engineer, Architect & Product Owner — I designed and shipped AuraChat end-to-end.

**Frontend:** Next.js 15 + React 19 + TypeScript + Tailwind CSS 4. Built landing page (hero ASCII banner, features, how-it-works, live review terminal, CTA), login/signup/verify OTP flows, Google OAuth via @react-oauth/google, main /chat workspace (sidebar, DMs, groups, message thread, reactions, replies, edits, stars, search, drafts), profile editor, and /deck control deck (telemetry, syslog, service topology). Authored custom terminal design system: Window, BracketButton, PromptInput, AsciiBar, CrtOverlay, Typewriter, StatusBadge.

**Backend:** Three Node.js/Express 5 microservices + API gateway. **User service** — Email OTP (Brevo), Google token verify, JWT sessions, profiles, block/report, web push (VAPID). **Chat service** — messages, groups, drafts, media (Cloudinary + Multer), Socket.io server. **Gateway** — single REST entry + WebSocket proxy to chat. Prisma 6 on PostgreSQL (Neon) with separate user_service and chat_service schemas; Redis (Upstash) for OTP cache and rate limits.

**Ops:** Docker Compose for 4 containers, env-separated secrets, render.yaml-style deploy paths, health checks, and documented scale/capacity notes.

System Design / Architecture

AuraChat is a **4-service architecture** — browser → gateway → user/chat services.

bash
1$ Next.js 15 (Vercel) :3000
2$ │ REST │ Socket.io
3$ ▼ ▼
4$ ┌──────────────────────────────────────────┐
5$ │ Gateway :8090 │ REST proxy + WS upgrade
6$ └────────┬─────────────────────────┬───────┘
7$ ▼ ▼
8$ User service :5100 Chat service :5002
9$ auth · OTP · profiles messages · groups · media
10$ │ │
11$ │ └──▶ Cloudinary
12$ ├──▶ Brevo (OTP email)
13$ ├──▶ Upstash Redis (OTP TTL · rate limits)
14$ └────────┬────────────────┘
15$ ▼
16$ Neon PostgreSQL — user_service + chat_service schemas

**Topology:** - **Frontend** (:3000) — Next.js App Router; all REST via NEXT_PUBLIC_API_URL (gateway); Socket.io client connects to gateway /socket.io - **Gateway** (:8090) — proxies /api/v1/login|verify|google|me|user/*|push/* → user service; /api/v1/chat/*|message/*|draft/* → chat service; upgrades WebSocket to chat Socket.io - **User service** (:5100) — auth, profiles, social (block/report), push subscriptions; Brevo OTP emails; Redis OTP TTL (5 min); JWT HS256 (15-day) - **Chat service** (:5002) — chats, messages, groups, drafts, media; Socket.io rooms; calls user service for last-seen

**Auth flows:** 1. **Email OTP:** POST /api/v1/login → 6-digit code emailed via Brevo, stored in Redis → /verify → JWT cookie + redirect /chat 2. **Google OAuth:** credential JWT → POST /api/v1/google → auto-register if new → JWT cookie 3. **Session:** token cookie + Authorization: Bearer on API; shared JWT_SECRET across user + chat (critical for chat 401 avoidance)

**Real-time:** Client joins chat rooms via joinChat; server broadcasts newMessage, messageEdited, messageDeleted, messageReaction, messagesSeen, userTyping, userLastSeen, getOnlineUser. Handshake passes userId query param.

**Data models:** User, BlockedUser, PushSubscription (user_service); Chat, ChatParticipant, Message, Draft (chat_service).

**External:** Neon PostgreSQL, Upstash Redis, Brevo, Cloudinary, Google OAuth, VAPID web push.

Key Engineering Decisions

  • •Split into gateway + user + chat microservices instead of one monolith — independent deploy/scale; chat Socket.io can scale separately from auth traffic.
  • •Dual Prisma schemas (`user_service` + `chat_service`) on one Neon instance — schema isolation without multi-DB ops overhead for portfolio/MVP scale.
  • •Email OTP on every login via Brevo + Redis cache — no password storage; 30-second resend rate limit prevents abuse.
  • •Gateway WebSocket proxy — browser only talks to `:8090`; chat service stays internal; simplifies CORS and production URL config.
  • •Custom terminal design system (12+ components) instead of shadcn defaults — phosphor-green CRT aesthetic is the product differentiator, not an afterthought theme.
  • •JWT shared secret enforced across user + chat — documented as #1 troubleshooting item because mismatch causes login success + chat 401.
  • •Media through Cloudinary + Multer — images, video, audio, PDF inline in threads without self-hosted object storage.
  • •Web push (VAPID) for notifications when tab is closed — completes messenger feature parity beyond in-app sockets.
  • •Docker Compose one-command stack — recruiter/local dev can run full system without juggling 4 terminals.

Business / Product Thinking

AuraChat sits in the **distinctive UX + real backend depth** wedge — not competing with WhatsApp scale, but proving you can ship a polished messenger with microservices, real-time, and a memorable brand.

**Positioning:** *Your chat, stripped to the shell* — terminal aesthetic for developers who want personality; full feature set (DMs, groups, reactions, media, stars, search) for credibility.

**Go-to-market:** live at aura-chat-mauve-tau.vercel.app → demo video → GitHub → dev communities that appreciate CLI/retro UI.

**Scale honesty (documented):** hobby tier 10–500 concurrent users on single instances; horizontal path via Redis Socket.io adapter + multiple chat replicas. Brevo free tier (~300 emails/day) is the first external bottleneck.

Results & Impact

Live at aura-chat-mauve-tau.vercel.app with source at github.com/subhm2004/AuraChat.

**Shipped (product):** phosphor-green terminal landing · Email OTP + Google auth · DMs + group chats · real-time Socket.io delivery · typing indicators · read receipts · emoji reactions · reply · edit · star · search · drafts · pin/mute · media (image/video/audio/PDF) · profiles (name/bio/status) · block/report · web push · control deck /deck · CRT overlay design system.

**Shipped (platform):** 4 microservices (frontend, gateway, user, chat) · 30+ REST endpoints · 15+ WebSocket events · 7 Prisma models across 2 schemas · Redis OTP cache · Brevo transactional email · Cloudinary CDN · Docker Compose · JWT 15-day sessions · provider badges in people list.

**Demo:** Watch full walkthrough on Google Drive — landing, OTP login, Google sign-in, sidebar, and terminal UI.

What I'd Do Differently

Add @socket.io/redis-adapter before scaling past ~500 concurrent users on one chat instance. Archive old messages to cold storage when Neon approaches storage limits. Host /deck telemetry with real service metrics instead of simulated syslog. End-to-end encryption for DMs would be a v2 trust feature. Keep CLI Resume as a separate npm product — AuraChat replaces it in the portfolio projects grid but both demonstrate terminal-native thinking.

Tech Stack

Next.js
React
TypeScript
Tailwind CSS
Socket.IO
Node.js
Express
Prisma
PostgreSQL
Redis
Google OAuth
Cloudinary
Docker
Vercel
GitHub

Want to see more?

View All Projects