Chatter
Real-time messaging app built with Next.js 16, Express 5, WebSockets, and PostgreSQL
- Next.js 16
- React 19
- TypeScript
- Tailwind CSS v4
- Zustand
- Node.js
- Express 5
- WebSockets
- PostgreSQL
- JWT
- Vitest
- Biome
Hosted on a free tier — initial load may take 30–50s while the instance wakes up.

Full-stack real-time chat application with bidirectional WebSocket (ws) messaging, live online presence, and resilient session handling. The frontend follows Feature-Sliced Design (FSD) validated by Steiger in CI, while the Express 5 + PostgreSQL backend separates business services from data repositories tested with Vitest against in-memory repositories.
Key highlights
- Real-time bidirectional messaging and live online presence over WebSockets (ws) backed by Express 5 and PostgreSQL.
- Frontend organized with Feature-Sliced Design (FSD), enforced by Steiger CI checks and Biome linting.
- Layered backend separating services and repositories, tested in Vitest against in-memory repository implementations.
- Hardened WebSocket transport with strict 64KB payload validation, heartbeat pings, and authentication rate limiting.
Engineering challenges
Problem
Browsers blocking cross-site HttpOnly session cookies between the Vercel frontend and a separately hosted API server.
Solution
Configured a Next.js same-origin /api/* rewrite proxy so 30-day JWT sessions stay safely inside HttpOnly cookies on the primary origin.
Problem
Authenticating direct WebSocket connections from a Vercel-hosted client without exposing long-lived JWTs or relying on cross-site cookies.
Solution
Added short-lived 60-second WS auth tickets issued via POST /api/auth/ws-ticket alongside strict 64KB WebSocket payload validation.
Problem
Free-tier backend cold starts and dropped sockets during network switches or background tab suspension.
Solution
Implemented exponential backoff with jitter reconnects, heartbeat pings, tab/network visibility recovery, and missed-message resynchronization.