A microservices-based collaboration platform with real-time chat, authentication, and workspace management.
This is a monorepo containing multiple services and shared libraries:
- auth - Authentication service (Fastify + Prisma + PostgreSQL)
- chat - Real-time chat service (Fastify + WebSocket + RabbitMQ + Redis)
- storage - File storage service
- analytics - Analytics service
- @collab/prisma - Shared Prisma client with database models
- @collab/plugins - Shared plugins (Prometheus metrics)
- @collab/events - Event envelope types
- @collab/types - Shared TypeScript types
- @collab/redis-utils - Redis utilities and key helpers
- Runtime: Node.js
- Framework: Fastify
- Database: PostgreSQL (via Prisma)
- Message Queue: RabbitMQ
- Cache: Redis
- Metrics: Prometheus
- TypeScript: Full type safety across services
- Monorepo: Yarn workspaces
- Node.js 18+
- Docker & Docker Compose
- PostgreSQL
- Redis
- RabbitMQ
# Install dependencies
yarn install
# Generate Prisma clients
yarn workspace @collab/prisma prisma:generate
# Start infrastructure (PostgreSQL, Redis, RabbitMQ)
docker-compose -f infra/docker/docker-compose.yml up -d
# Set up environment variables
cp .env.example .env
# Edit .env with your configuration
# Run migrations
yarn workspace @collab/prisma prisma:migrate dev# Run auth service
yarn workspace auth dev
# Run chat service
yarn workspace chat devEach service requires specific environment variables. See .env.example files in each service directory.
Common variables:
DATABASE_URL- PostgreSQL connection stringREDIS_URL- Redis connection stringRABBITMQ_URL- RabbitMQ connection stringJWT_SECRET- Secret for JWT token signingREFRESH_SECRET- Secret for refresh tokens
- User registration and login
- JWT-based authentication
- Refresh token rotation
- Rate limiting
- Prometheus metrics
- Real-time WebSocket messaging
- Channel-based chat
- Message replay on reconnect
- Typing indicators
- Read receipts
- RabbitMQ message distribution
- Redis offset tracking
collab-platform/
├── libs/ # Shared libraries
│ ├── prisma/ # Database client and schemas
│ ├── plugins/ # Fastify plugins (metrics)
│ ├── events/ # Event types
│ ├── types/ # TypeScript types
│ └── redis-utils/ # Redis utilities
├── services/ # Microservices
│ ├── auth/ # Authentication service
│ ├── chat/ # Chat service
│ ├── storage/ # Storage service
│ └── analytics/ # Analytics service
├── infra/ # Infrastructure configs
│ └── docker/ # Docker compose and configs
└── tsconfig/ # TypeScript configurations
All services expose Prometheus metrics at /metrics:
- HTTP request duration and counts
- WebSocket connection metrics
- RabbitMQ message metrics
- Database query metrics
- Authentication metrics
- Custom business metrics
POST /register- Register new userPOST /login- User loginPOST /refresh- Refresh access tokenPOST /logout- Logout userGET /me- Get current userGET /health- Health checkGET /metrics- Prometheus metrics
GET /ws- WebSocket connection endpointGET /channels/:id/messages- Get channel messagesGET /health- Health checkGET /metrics- Prometheus metrics
- Type Safety: All code is TypeScript with strict mode enabled
- Code Style: Follow existing patterns and use ESLint
- Testing: Write tests for new features
- Documentation: Update README and add JSDoc comments
- Commits: Use conventional commit messages
MIT