How rohanshrma222/scalable-chat-app works
Project type and purpose
• This is a monorepo (Turborepo) hosting a full-stack TypeScript application.
• It comprises two primary “apps” under apps/:
• server: a Node/TypeScript backend, using Kafka for messaging and WebSockets for real-time communication.
• web: a Next.js frontend.
• It also includes shared “packages” under packages/ for database access (db with Prisma), UI components (ui), ESLint configs, and TypeScript configs.
File structure
• Top level:
• docker-compose.yml for orchestrating local services (Postgres, Kafka, etc.)
• pnpm-workspace.yaml & turbo.json for Turborepo configuration
• apps/server:
• src/index.ts—entry point for HTTP/WebSocket server
• src/services/kafka.ts—Kafka producer/consumer setup
• src/services/socket.ts—WebSocket server logic
• apps/web:
• Next.js app in app/ folder with React components and global styles
• context/SocketProvider.tsx—wraps app with WebSocket client logic
• packages/db:
• Prisma schema & generated client for database ORM
• packages/ui:
• Reusable React components (Button, Card, Code)
• packages/eslint-config & packages/typescript-config:
• Centralized linting and TS compiler settings
Key architecture insights from README & files
• Monorepo using Turborepo’s task pipeline and caching
• Shared code is pulled via workspace imports (e.g., @repo/ui, @repo/db)
• Docker Compose bootstraps supporting services (Postgres, Kafka) for both apps
Detail
• Package directory as a component if it contains runtime logic (e.g., packages/db → representing Prisma).
• How docker-compose.yml ties the services together in local dev.