Syntra brings communities, channels and private conversations into one application. The challenge is to deliver live updates to the right people while keeping message history, membership permissions and authentication consistent across HTTP requests and long-lived WebSocket connections.
Case studyCommunities & real-time messaging
Syntra.
A full-stack community and messaging application with live conversations, presence and typing indicators, powered by Socket.IO over WebSocket.
- Project status
- In progress
- Scope
- Full-stack application
Context & problem
What I built
- 01
Communities, channels, categories and role-based administration
- 02
Channel messaging and private conversations with live updates
- 03
Message editing, deletion, replies, mentions and reactions
- 04
Live presence and typing indicators
- 05
Unread counters and in-app reaction notifications
- 06
Verified-email authentication and membership-aware real-time access
Architecture
A pnpm/Turborepo monorepo connects a Next.js frontend to a NestJS API and Socket.IO gateway. The client uses WebSocket transport with session cookies. Prisma and PostgreSQL persist messages, memberships and conversations, while Better Auth verifies sessions. A shared package provides TypeScript event payloads and Zod validation for API inputs. Presence and connection tracking currently live in memory within a single API instance.
- Socket.IO / WebSocket
- Better Auth sessions
- Shared TypeScript / Zod
Technical decisions
Persist message changes through the HTTP API before publishing Socket.IO events to authorized recipients.
Authenticate the WebSocket handshake with Better Auth session cookies, then revalidate identity on incoming events.
Check community membership and conversation participation before joining private rooms or sending typing events.
Disconnect sockets when their session is revoked and remove room access when membership changes.
Count active connections per user so presence remains accurate across multiple tabs and disconnects.
Share TypeScript payloads and Zod API validation; keep the current gateway and presence state within one API instance.
Challenges
Real-time access can change while a connection is still open. Syntra must handle multiple connections per user, revoked sessions, membership changes and disconnects without exposing private events or marking an active user offline. Persisted message changes and live updates also need to stay aligned across channels and direct conversations.
Outcome
Syntra combines communities, private messaging, message editing, replies, reactions, unread tracking and live presence in a full-stack application. Its current real-time implementation uses authenticated sessions and membership-aware event delivery on a single API instance.