CollabMatrix is an enterprise-grade, high-fidelity real-time collaboration workspace designed to unify the fragmented tools of modern engineering teams.
It exists to solve context switching. Todayβs teams track tasks in Jira, document architecture in Notion, and communicate in Slack. CollabMatrix bridges these silos by combining:
- Jira-style rigorous state management and SLA automation.
- Notion-style concurrent rich-text document editing.
- Slack-style low-latency, threaded messaging and code execution.
Driven by a distributed event architecture and WebSocket synchronization, CollabMatrix ensures that every keystroke, task movement, and message is propagated globally in sub-milliseconds.
Tip
Engineering Value Focus: Every feature in CollabMatrix is built with scale in mind, utilizing optimal data structures and asynchronous propagation patterns.
- Realtime Kanban Boards: Drag-and-drop task management. Engineering Value: Implements optimistic locking (
@Version) to prevent lost updates during concurrent edits. - Collaborative Rich Text Editing: Multi-user live editing. Engineering Value: Utilizes CRDTs (Conflict-free Replicated Data Types) to resolve distributed edit conflicts without central locking.
- Slack-Style Messaging: Channel-based and direct threaded messaging. Engineering Value: Backed by MongoDB for high-throughput, unstructured document appends.
- Activity Replay Timeline: Chronological system audit. Engineering Value: Powered by Kafka Change Data Capture (CDC) events streamed asynchronously.
- Smart Notifications: Context-aware alerts. Engineering Value: Uses Redis TTL queues to monitor SLA breaches efficiently without heavy database polling.
- WebSocket Sync Engine: Global state synchronization. Engineering Value: Horizontally scalable via a Redis Pub/Sub backplane.
- Kafka Event Streaming: Decoupled microservice communication. Engineering Value: Ensures eventual consistency and zero data loss using the Transactional Outbox Pattern.
- Redis Presence Tracking: Live user online/offline status. Engineering Value: Sub-millisecond read/write capabilities for high-frequency heartbeat pings.
- Multi-Tenant Workspaces: Organizational segregation. Engineering Value: Row-level security constructs and strict RBAC controls.
CollabMatrix utilizes a Modular Monolith backend architecture. This provides the deployment simplicity of a monolith while strictly enforcing microservice-level boundaries (domain isolation) to allow seamless extraction into independent microservices as the platform scales.
graph TD
Client[React/Vite Client] -->|HTTPS / REST| API[Spring Boot API Gateway]
Client -->|WSS / STOMP| WS[WebSocket Broker Node]
subgraph "Spring Boot Modular Monolith"
API --> Auth[collab-auth]
API --> Task[collab-task]
WS --> Chat[collab-chat]
WS --> Doc[collab-docs]
end
Auth --> Postgres[(PostgreSQL)]
Task --> Postgres
Chat --> Mongo[(MongoDB)]
Doc --> Mongo
WS -.->|Pub/Sub Sync| Redis[(Redis Backplane)]
Task -->|Outbox Events| Kafka[Apache Kafka]
Kafka --> Notif[Notification Consumer]
Kafka --> Audit[Audit Consumer]
Consistency vs. Availability Tradeoffs: CollabMatrix prioritizes Consistency (CP) for transactional task states (via Postgres Optimistic Locking) but shifts towards Availability/Eventual Consistency (AP) for chat, presence, and notifications (via Redis and Kafka).
| Layer | Technologies | Purpose |
|---|---|---|
| Frontend | React 18, TypeScript, Tailwind CSS, Zustand, Framer Motion, Yjs | High-performance, glassmorphic UI with CRDT-based local-first state resolution. |
| Backend Core | Java 17, Spring Boot 3, Spring Security (JWT), Spring Data JPA | Robust, enterprise-grade modular monolith handling REST and WebSocket traffic. |
| Data / Storage | PostgreSQL 15, MongoDB 6.0, Redis 7.0 | Polyglot persistence strategy separating transactional, document, and ephemeral data. |
| Event Streaming | Apache Kafka, Zookeeper | Async decoupling, CDC, and outbox event streaming. |
| DevOps / Infra | Docker, Docker Compose, Nginx, Prometheus, Grafana | Complete containerized orchestration and deep system observability. |
The repository is strictly organized into domain-driven modules:
collab-matrix/
βββ backend/ # Java 17 Spring Boot Modular Monolith
β βββ collab-auth/ # Identity, JWT, RBAC & Security definitions
β βββ collab-task/ # Kanban logic, SLA tracking, JPA Entities
β βββ collab-chat/ # WebSocket controllers, MongoDB messaging
β βββ collab-docs/ # Yjs CRDT synchronization handlers
β βββ collab-events/ # Kafka Producers/Consumers, Outbox pattern
β βββ collab-infra/ # Shared configs (SecurityConfig, ExceptionHandlers)
βββ frontend/ # React 18 SPA
β βββ src/features/ # Domain-driven feature slices (chat, tasks, docs)
β βββ src/store/ # Zustand global state (auth, websockets)
β βββ src/layouts/ # Complex UI shells (drawers, sidebars)
βββ docker-compose.yml # Orchestration for the 9-container infrastructure
Real-time interaction in CollabMatrix is driven by STOMP over SockJS (WebSockets).
Because WebSocket connections are stateful (bound to a single server instance), scaling out multiple backend nodes requires a synchronization layer. We utilize a Redis Pub/Sub Backplane.
- User A sends a message to Node 1 on
/app/chat.send. - Node 1 persists to MongoDB and publishes the payload to a Redis channel.
- Node 2 receives the Redis broadcast and pushes it down its established WebSocket connection to User B.
Presence Tracking: Clients send a heartbeat ping every 10 seconds. The backend updates a Redis key (user:presence:{id}) with a TTL of 15 seconds. If a node crashes or a user loses connection without cleanly disconnecting, the TTL expires automatically, gracefully updating global presence state.
CollabMatrix implements collaborative text editing using CRDTs (Conflict-free Replicated Data Types) via Yjs.
Unlike Operational Transformation (OT) which requires a central authoritative server to sequence operations, CRDTs allow mathematical merging of distributed states.
- Awareness State: Yjs awareness protocols handle ephemeral data like cursor positions and selection highlights without persisting them to the database.
- Auto-save Strategy: The backend subscribes to the Yjs document updates and periodically debounces snapshots into MongoDB for long-term persistence.
sequenceDiagram
participant C1 as Client 1 (Yjs)
participant WS as Spring WebSocket
participant C2 as Client 2 (Yjs)
C1->>WS: Send byte-array update (Insert 'A')
WS->>C2: Broadcast byte-array
C2->>C2: Yjs applies update (Conflict-free)
C2->>WS: Send awareness update (Cursor Pos)
WS->>C1: Broadcast awareness
To prevent tight coupling between domains, we utilize Apache Kafka implementing the Transactional Outbox Pattern.
When a user moves a Kanban task, the collab-task module updates PostgreSQL and inserts an event record into an outbox table within the same ACID transaction. A background relayer publishes this event to Kafka.
- Decoupling: The
collab-notificationmodule consumes this event to send WebSocket alerts independently of the HTTP request thread. - Resilience: If the notification service is down, Kafka retains the event. When the service recovers, it resumes processing from its last committed offset.
CollabMatrix embraces Polyglot Persistence, matching the exact database paradigm to the access pattern.
- PostgreSQL (Transactional): Users, Workspaces, and Tasks. We need strict schema validation, ACID transactions, and foreign key constraints to prevent orphaned data.
- MongoDB (Document): Chat messages and Document snapshots. Chat applications are incredibly write-heavy and hierarchically nested (threads). Mongo provides the schema flexibility and append-throughput required.
- Redis (Key-Value/PubSub): Short-lived, high-read ephemeral data (session states, typing indicators, presence).
- Stateless Authentication: JSON Web Tokens (JWT) are verified via asymmetric/symmetric cryptographic signatures at the API Gateway layer, removing session-lookup latency.
- RBAC (Role-Based Access Control): All users default to
ROLE_MEMBER. Privilege escalation toROLE_ADMINrequires direct database manipulation or authorized backend API calls (@PreAuthorize("hasRole('ADMIN')")). - Data Integrity:
@Versionannotations in JPA enforce Optimistic Locking, preventing race conditions (e.g., two users assigning the same task simultaneously).
- Frontend Virtualization: Long chat threads and massive kanban boards utilize DOM virtualization to only render visible items, maintaining a 60fps framerate.
- Lazy Loading & Code Splitting: Vite chunks the React application by route, ensuring lightning-fast initial Time-To-Interactive (TTI).
- Kafka Throughput: Partitioned Kafka topics allow horizontal scaling of consumer groups, capable of processing tens of thousands of system events per second.
Note
A full cinematic walkthrough of CollabMatrix is available in the demo video below. Screenshots cover all major UI surfaces.
https://github.com/Arbaz4Sayyad/Collab-Matrix/raw/main/Screenshots/collabmatrix_cinematic_demo.mp4
Click the link above to watch the full cinematic demo β or find the file at
Screenshots/collabmatrix_cinematic_demo.mp4
Get CollabMatrix running on your local machine in under 3 minutes.
- Docker Desktop (Compose v2)
- Node.js 20+
- Java 17
The entire infrastructure, backend, and database seeding is orchestrated via Docker Compose.
git clone https://github.com/Arbaz4Sayyad/Collab-Matrix.git
cd Collab-Matrix
# Build and boot the 9-container infrastructure
docker compose up -d --buildVITE_API_URL=http://localhost:8080/api
VITE_WS_URL=http://localhost:8080/wsThe docker-compose.yml provisions the following stack:
collab-frontend: Nginx serving the Vite build.collab-backend: Spring Boot executable JAR.collab-postgres: Relational data.collab-mongodb: Document data.collab-redis: Caching and Pub/Sub.collab-zookeeper: Kafka coordinator.collab-kafka: Event broker.collab-prometheus: Metrics scraper.collab-grafana: Telemetry visualization.
POST /auth/login
Content-Type: application/json
{
"username": "staff_architect",
"password": "SecurePassword123!"
}- Subscribe:
/topic/workspace.{workspaceId}.chat(Listen for incoming messages) - Subscribe:
/topic/user.{userId}.alerts(Listen for targeted SLA notifications) - Publish:
/app/chat.send(Send a message payload)
CollabMatrix is heavily instrumented using Spring Boot Actuator.
- Prometheus scrapes
/actuator/prometheusevery 15 seconds. - Grafana (accessible at
localhost:3000) provides pre-built dashboards monitoring JVM memory heaps, Kafka consumer lag, HTTP request latency percentiles, and active WebSocket connection counts.
- Backend: JUnit 5 + Mockito for unit testing business logic. Testcontainers for spinning up disposable Postgres/Kafka instances for integration tests.
- Frontend: Vitest + React Testing Library for component unit testing.
- Load Testing: Artillery/JMeter scripts to simulate thousands of concurrent WebSocket connections and validate Redis Pub/Sub bottleneck thresholds.
- AI Summarization: Integrate LLMs to auto-summarize long Slack threads.
- Collaborative Whiteboard: Implement an infinite canvas using Fabric.js/TLDraw synced via WebSockets.
- Offline Sync Queues: Utilize Service Workers and IndexedDB to allow full offline operation with optimistic background sync upon reconnection.
- Federation Support: Cross-workspace communication bridging.
Important
Why this project matters: CollabMatrix is not a standard CRUD application. It is a serious, production-grade distributed system.
It heavily demonstrates senior-level engineering concepts:
- Event-Driven Architecture: Solving distributed data consistency via Kafka.
- Concurrency Control: Handling massive concurrent edits via CRDTs and Optimistic Database Locking.
- Real-time Scaling: Bridging stateful WebSockets across stateless backend nodes using a Redis backplane.
- Polyglot Persistence: Architecting data models based on highly specific read/write access patterns rather than forcing a single DB.
We welcome contributions from the community!
- Fork the repository and create your branch from
main. - Branch Naming: Use
feature/issue-number-descriptionorfix/issue-number-description. - Commit Messages: Follow Conventional Commits (
feat: added Yjs sync,fix: resolved race condition in tasks). - Pull Requests: Ensure all TypeScript checks (
npm run build) and Java tests (mvn test) pass before requesting a review.
Released under the MIT License.
Architecture heavily inspired by engineering blogs from Linear, Notion, and Discord. Kubernetes scaling strategies adapted from Vercel's infrastructure principles.






