How ishaan1013/axiom works
Project Type and Purpose
• This is a full-stack collaborative editor interface for “George” (a tool for logic and computation assignments). Users get an interactive, VSCode-like editor with real-time collaboration features (via workspaces and multiplayer editing) as well as advanced language support.
• The frontend is built using Next.js 14 with Typescript, enhanced by libraries such as Monaco Editor, Y.js, TailwindCSS, and Shadcn UI.
• The backend uses Express (with Node.js and Typescript), Socket.io for websockets, and Prisma as an ORM for database handling.
File Structure Insights
• The project is clearly separated into two main components via directories — “frontend” and “backend”.
– The “frontend” directory contains Next.js pages and application shell, UI components (for editor, settings, tabs, upload, etc.), hooks, and libraries organized by purpose.
– The “backend” directory holds the server logic: Express server logic, socket.io communication (in socketio.ts), and configuration for Prisma migrations and the database schema.
• The “george” directory includes several subdirectories filled with “.grg” files. These are likely static or importable domain files used by the editor to load assignments or examples.
• The presence of various config files (e.g., package.json, tsconfig.json, nodemon.json) confirms development and runtime setup.
a. Main Components:
– Frontend Client: Built with Next.js. Include subcomponents:
• The Editor Interface (with Monaco Editor for VSCode-like editing, tabs, sidebars, and panels).
• Collaboration and Workspace Components (managing real-time collaboration via Y.js and socket.io).
• UI Components: Buttons, dialogs, file uploaders, and other reusable shadcn UI elements.
– Backend Server: Built with Express and Node.js.
• HTTP API endpoints for authentication, file management, and collaboration.
• WebSocket Communication: Real-time data exchange using socket.io.
• Prisma Integration: Includes schema, migrations, and seeding functionalities to manage the DB.
– Database: Managed via Prisma (likely an SQLite file based on the “file:./dev.db” hint). Represents persisted state for users, workspaces, and file data.
– Integration/External Services:
• Third-Party Libraries: Y.js, Monaco Editor (frontend) and Socket.io (both in frontend and backend).
• “George” Files: The static assignment files that may be loaded into the editor, representing domain-specific content.
b. Relationships and Interactions:
– The Browser (client) runs the Next.js frontend. It makes HTTP requests and establishes WebSocket (socket.io) connections to the backend server.
– The frontend sends collaboration events (e.g., workspace updates and file changes) in real time to the backend.
– The backend, built on Express with socket.io, receives these events, processes them, and updates the database (through Prisma) or to synchronize changes among multiple users.
– The collaboration layer (Y.js) is integrated to manage real-time document changes in the frontend.
c. Architectural Patterns and Design Principles:
– MVC/Separation of Concerns: The clear separation between frontend (view and domain logic) and backend (API and real-time communication) demonstrates separation of concerns.
– Real-time Collaboration: Use of socket.io and Y.js highlights an event-driven architecture.
– Database Migrations: Use of Prisma for systematic schema evolution, seeding, and data exploration via Prisma Studio.
– Modular and Component-driven: The division of UI components and hooks in the frontend shows an emphasis on reusability and modular design.
d. Key Technologies and Frameworks:
– Frontend: Next.js 14, Typescript, Monaco Editor, Y.js, Socket.io (client side), TailwindCSS, Shadcn UI, Tanstack Query.
– Backend: Express, Typescript, Node.js, Socket.io (server side), and Prisma.
– Database: Likely a SQLite database or similar file-based DB indicated by the DATABASE_URL in the prisma config.