How kuntalmajee2557/excalidraw-project works
Main Components
• Frontend Applications:
• • “excalidraw-frontend”: A Next.js app that provides the primary interactive drawing interface.
• • “web”: Another Next.js based frontend (possibly with complementary or alternative UI features).
• Backend Services:
• • “http-backend”: The HTTP server handling RESTful API calls, authentication, or other server-side logic.
• • “ws-backend”: The WebSocket server enabling real-time collaborative drawing by managing persistent socket connections.
• Shared Packages:
• • “backend-common” and “common”: Utilities and shared methods used across both frontend and backend.
• • “db”: Contains the Prisma schema, migrations, and database integration code.
• • • “ui”: Shared UI components reused in both frontend applications.
• • • “eslint-config” and “typescript-config”: Shared configuration files to maintain consistent coding standards across packages.
• Tooling & Monorepo Artifacts:
• • “turbo.json”, “pnpm-workspace.yaml”: These indicate the use of Turbo Repo and pnpm workspaces to manage the monorepo.
Relationships & Interactions
• The frontend applications communicate with both backend services:
• • The HTTP backend handles initial data requests, user sessions, or API interactions.
• • The WebSocket backend handles bidirectional, real-time data exchange for collaborative drawing (e.g., sending canvas updates to multiple users).
• Both backend services and frontend applications utilize shared packages for common logic, UI components, and configurations.
• The database, managed through the “db” package (with Prisma), is accessed by the backend services to persist data.
Architectural Patterns and Design Principles
• Separation of Concerns: Clearly distinguish between UI (frontends), business logic (HTTP backend), and real-time interaction (WS backend).
• Modular Design & Reusability: The use of shared packages (common, backend-common, ui) promotes code reuse across multiple applications.
• Monorepo Structure: Utilizes Turbo Repo and pnpm workspace to orchestrate all modules and packages under one repository.
• Real-time Communication: The inclusion of a dedicated WebSocket backend shows the adoption of a microservices pattern for handling real-time updates.
Relevant Technologies and Frameworks
• Next.js for the frontends.
• TypeScript for type-safe development across all packages.
• WebSockets for real-time communication.
• Prisma for the database layer.
• Tools like ESLint and TypeScript configurations standardized across the codebase.
• Start from the client perspective showing multiple users accessing the drawing interface.
• Finally, illustrate the shared packages and the database, showing how they support both the frontends and the backends.