How akhilathuluri/readmaster-ai works
Project type and purpose
• ReadMaster AI is a single‐page, client-side web application (no dedicated backend in the repo).
• It’s built in React + TypeScript and serves as an Intelligent Markdown Editor with AI-powered writing and analysis features.
File structure
• Top-level files:
– index.html, vite.config.ts, tsconfig*.json, tailwind.config.js (build/deploy config)
– package.json, package-lock.json (dependency & script definitions)
• src/: Core of the application
– src/main.tsx + src/index.css: Bootstraps the React app with Vite + global styles
– src/pages/: Route-level pages (LandingPage.tsx, EditorPage.tsx)
– src/components/: UI building blocks (Editor, Preview, Toolbar, AIPanel, WordStatsPanel, SmartSuggestions, etc.)
– src/hooks/: Custom hooks (useVersionManager.ts) for features like version history
– src/store/: Tiny “store” modules (editorStore, settingsStore, versionStore) implementing global state via hooks
– src/services/: External‐facing APIs (ai.ts wraps calls to the AI service)
– src/utils/: Pure helper functions (codeExecutor, contentAnalyzer, export, wordStats, etc.)
• Configuration files for linting (eslint.config.js), styling (postcss.config.js), and environment types (vite-env.d.ts)
README for architectural insights
• The “Technical Architecture” section confirms:
– Frontend only (React/TS + React Router)
– Custom hook–based state management
– Tailwind CSS for styling
– AI Integration (calls out to an external AI API)
– In-editor code execution (browser sandbox)
a. Browser/client
– Loads static assets (index.html, JS bundle, CSS) via Vite
– Renders React SPA
b. Pages & Routes
– LandingPage (marketing)
– EditorPage (core UI)
c. UI Components (inside EditorPage)
– Editor (Markdown input + syntax highlighting)
– Preview (live HTML render)
– Toolbar (actions: theme toggle, export, AI toggles)
– AIPanel (smart suggestions, SEO/readability analysis)
– WordStatsPanel (stats, word cloud, reading time)
– CodeExecutor (runs JS in‐browser)
d. State Management
– editorStore: holds current Markdown content, selection
– settingsStore: theme, preferences
– versionStore: version history, undo/redo
e. Services & Utils
– ai.ts → External AI API (REACT_APP_AI_API_KEY)
– codeExecutor.ts → in-browser JS sandbox
– various analyzers & formatters in utils/
f. External Dependencies
– AI Provider (OpenAI or similar) over HTTPS
Architectural patterns & design principles
• Component-based hierarchy (presentational vs. container)
• Unidirectional data flow: user action → store update → component render
• Separation of concerns: UI (components) / business logic (services & utils) / state (stores & hooks)
• Client-side only – no server component, all processing (analysis, code execution) done in browser, aside from AI calls