How anishsaha46/doodleflow works
Project type and purpose
• This is a full-stack, single-page web application: “DoodleFlow” is a React + TypeScript drawing app with real-time, multi-user collaboration.
• Frontend: Vite-bundled React app using HTML5 Canvas, Tailwind CSS.
• Backend: A simple Node.js server (server.js) providing a Socket.io endpoint for real-time sync.
• Persistence: Browser localStorage for save/load; PNG export; no external database.
File structure
• Top level
• package.json / package-lock.json: dependencies (React, Socket.io, Vite, TS, Tailwind, etc.)
• server.js: Node.js + Socket.io server entry point
• index.html + public/: static assets served at root
• vite.config.ts, tsconfig*.json, tailwind.config.js, eslint.config.js: build and lint config
• src/
• main.tsx, App.tsx: React entry and root component
• index.css: global Tailwind imports
• vite-env.d.ts: type declarations
• No “backend/” folder—backend lives in server.js at project root.
Extract insights from README
• Tech stack: React, TS, Tailwind, Socket.io, Canvas API
• Runtime: “npm run dev” (Vite dev server) + “node server.js” (Socket.io server).
Main components
a. Frontend client
• Vite Dev Server / Static host
• React App
• State Management (useState, useRef)
• Canvas Rendering module
• Export module (PNG)
• LocalStorage Adapter
• Socket.io Client
b. Backend server
• Node.js + Express (if any) or raw HTTP server
• Socket.io Server
• Event broadcaster (in memory)
c. External connections
• Browser’s localStorage
• WebSocket (Socket.io) channel
Relationships and interactions
• User → React UI → Canvas API
• UI actions → State updates → Canvas re-render
• “Save” / “Load” → localStorage read/write
• “Export” → Canvas → PNG blob → download
• React <→> Socket.io client ↔ WebSocket ↔ Socket.io server → broadcast to other clients
• HTTP/WS handshake at app startup:
• Client connects to server.js on port e.g. 3001
• Server acknowledges, joins room
Architectural patterns & principles
• Separation of concerns:
• Presentation (React + Canvas)
• State management (hooks)
• Networking (Socket.io layer)
• Persistence (localStorage adapter)
• Event-driven, pub/sub style for collaboration