How mindful-ai-dude/gemini-bookwriter works
Project type and purpose
• This is a single-page React.js application (“Gemini BookWriter”) that serves as an AI-powered book-writing assistant.
• Its purpose is to guide users through defining a book description, generating an outline, drilling down into chapters/sections, generating content via Google’s Gemini 2.5 Pro API, and exporting the result as Markdown.
File structure
• Top-level files:
• package.json – Node/React dependencies and scripts
• public/index.html – HTML shell
• src/ – React source code
• .env (implied) for REACT_APP_GEMINI_API_KEY
• src/ directory:
• index.js & App.js – application entry and root component
• BookUtils.js – utility module for API calls, parsing, and export logic
• Description.js / Outline.js / ContentGeneration.js – feature components
• CSS files – styling for each component
• There is no backend folder: this is a purely client-side app that calls an external AI service.
README insights
• Stack: React.js frontend, Google Gemini API, Local browser storage for persistence.
• Workflow: four main steps (Description → Outline → Content → Export).
Main components and interactions
a. Components:
1. User (Browser)
2. React SPA (App.js)
• BookDescriptionComponent
• OutlineComponent
• ContentGenerationComponent
• ExportComponent
3. Service Layer (BookUtils.js)
4. Local Storage (Browser Web Storage)
5. External Google Gemini 2.5 Pro API
b. Relationships / Data flows:
• User interacts with components in the browser UI.
• Components invoke functions in BookUtils.js to:
• send requests to Gemini API
• parse outline responses
• generate parts & content
• assemble Markdown for export
• BookUtils stores intermediate state in Local Storage.
• Export triggers a download of Markdown files.
c. Architectural patterns / principles:
• Component-based UI with single responsibility.
• Unidirectional data flow (React state → UI → utils → API → state).
• Externalizing API calls to a Utils/service layer.
• Persistence via client-side storage.
d. Key technologies:
• React.js (functional components, hooks)
• fetch/Axios calls to Google Gemini via REST
• LocalStorage Web API
• Markdown generation logic (in-memory)
• Environment variable for API key