Nestly

A Real-time chat application with features like DMs, Server/Channel-based messaging, voice and video chats, screen-sharing etc.

Overview

Nestly is a real-time community and messaging platform inspired by modern collaboration tools such as Discord. It allows users to create servers, organize conversations into channels, send direct messages, and communicate through voice and video calls.

The project initially started as a training project during my internship at TechySquad using MySQL and Sequelize. After the internship, I rebuilt the system as a personal project using PostgreSQL and modern backend tooling to improve scalability, maintainability, and overall architecture.

Nestly focuses on delivering a responsive real-time communication experience while maintaining a modular backend architecture capable of supporting messaging, presence tracking, and media interactions.

Problem

Real-time communication platforms combine multiple complex systems including messaging infrastructure, presence tracking, channel-based communities, and media communication.

While building real-time applications during my internship, I wanted to explore how systems like Discord manage:

  • real-time messaging
  • multi-server communities
  • presence and typing indicators
  • voice and video communication
  • scalable backend architecture

Nestly was built as a learning project to understand how a full real-time communication platform can be designed and implemented from the backend up.

Constraints

  • Real-time performance – messages and events must propagate instantly to connected users.
  • Multi-community architecture – the system must support multiple servers with isolated channels and membership.
  • Media communication complexity – voice, video, and screen sharing require reliable WebRTC infrastructure.
  • State synchronization – presence, typing indicators, and message updates must stay consistent across clients.
  • Maintainable backend architecture – the system must remain modular as features grow.

Key Engineering Decisions

Rebuilding the backend architecture

The initial version used MySQL and Sequelize during internship training. As the project evolved, maintaining schema consistency and type safety became difficult.

The system was later rebuilt using PostgreSQL and a modern TypeScript-based backend architecture.

Reason:
Improved schema design, stronger type safety, and easier maintainability.

Tradeoff:
Required rebuilding the database models, queries, and migration workflows.

WebSocket-based real-time messaging

Persistent WebSocket connections power the real-time layer for messaging, typing indicators, and presence updates.

Reason:
WebSockets provide low-latency bidirectional communication required for real-time collaboration systems.

Tradeoff:
Persistent connections require careful connection lifecycle management and resource handling.

Server and channel architecture

Communities are organized into servers that contain multiple channels.

Reason:
This model allows conversations to be grouped by context while supporting large communities with structured discussions.

Tradeoff:
Requires additional logic for permissions, membership management, and message routing.

Media communication using LiveKit

Voice calls, video calls, and screen sharing are implemented using LiveKit, a WebRTC-based media infrastructure.

Reason:
Building a reliable WebRTC media server from scratch is extremely complex. LiveKit allows focus on application logic while handling media routing and scaling.

Tradeoff:
Adds external infrastructure dependency.

Modular backend architecture

The backend is structured into domain modules such as:

  • authentication
  • servers
  • channels
  • messaging
  • presence
  • media

Reason:
A modular architecture improves maintainability and makes it easier to extend the platform with new features.

Tradeoff:
Requires additional upfront architectural design compared to a simple monolithic structure.

Results

  • Built a fully functional real-time messaging platform with instant message delivery.
  • Implemented server-based communities with structured channels and role-based access.
  • Enabled voice calls, video calls, and screen sharing through LiveKit.
  • Achieved sub-200ms latency for real-time messaging interactions.
  • Migrated the project from MySQL/Sequelize to PostgreSQL with a more maintainable backend architecture.

Takeaways

Building Nestly helped me understand the complexity behind real-time communication systems.

Key lessons:

  • Real-time systems require careful connection management and event synchronization.
  • Messaging platforms depend heavily on well-designed data models.
  • Media communication introduces unique infrastructure challenges compared to typical APIs.
  • Modular backend architecture significantly improves long-term maintainability.