# mihirlimbachiya02/ebookcreator architecture

> Architecture diagram of the GitHub repository mihirlimbachiya02/ebookcreator, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mihirlimbachiya02/ebookcreator
- Repository: https://github.com/mihirlimbachiya02/ebookcreator

## Overview

eBook Creator is a full-stack platform for authoring AI-assisted eBooks and managing uploaded books. The main workflow is to sign in, create a book, generate or edit its outline and chapters, manage its cover, then export or read it; a separate library workflow imports and manages existing files. The README documents Gemini, image-generation fallbacks, Cloudinary, Drive import, and PDF/DOCX export. Some UI and AI implementation files were not sampled, so their detailed internal call paths are not asserted.

Main entry points: [`frontend/src/App.jsx`](https://github.com/mihirlimbachiya02/ebookcreator/blob/main/frontend/src/App.jsx) (Route application), [`frontend/src/pages/EditorPage.jsx`](https://github.com/mihirlimbachiya02/ebookcreator/blob/main/frontend/src/pages/EditorPage.jsx) (Book editor), [`backend/controller/uploadedBookController.js`](https://github.com/mihirlimbachiya02/ebookcreator/blob/main/backend/controller/uploadedBookController.js) (Uploaded-book API), [`backend/controller/bookController.js`](https://github.com/mihirlimbachiya02/ebookcreator/blob/main/backend/controller/bookController.js) (Book management API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Web application"]
  node_app["Route application<br/>[App.jsx]"]
  node_authui["Authentication UI<br/>[LoginPage.jsx]"]
  node_dashboard["Unified dashboard<br/>[DashboardPage.jsx]"]
end

subgraph group_authoring["Book authoring"]
  node_create["Book creation"]
  node_editor["Book editor<br/>[EditorPage.jsx]"]
  node_details["Book details and cover<br/>[BookDetailsTab.jsx]"]
  node_chapter["Chapter editing"]
  node_viewbook["Created book reader<br/>[ViewBook.jsx]"]
end

subgraph group_library["Book library"]
  node_uploadui["Upload and import UI"]
  node_uploadedpage["Uploaded book reader"]
end

subgraph group_backend["API and domain"]
  node_ai["AI generation<br/>[aiController.js]"]
  node_bookapi["Book management API<br/>[bookController.js]"]
  node_export["PDF and DOCX export"]
  node_uploadedapi["Uploaded-book API"]
  node_authapi["Authentication API<br/>[authController.js]"]
  node_authguard["JWT authorization<br/>[authMiddleware.js]"]
  node_bookmodel[("Book records<br/>[Book.js]")]
  node_uploadmodel[("Uploaded-book records<br/>[UploadedBook.js]")]
end

subgraph group_services["Storage and integrations"]
  node_cloudinary["Cloudinary storage<br/>[cloudinary.js]"]
  node_gemini["Google Gemini"]
  node_imageai["Cover image services"]
  node_drive["Google Drive"]
  node_mongo[("MongoDB")]
  node_mail["Email delivery<br/>[emailService.js]"]
end

node_reader(("Reader / author"))

node_reader -->|"opens"| node_app
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_authui
node_app -->|"routes to"| node_editor
node_app -->|"routes to"| node_viewbook
node_app -->|"routes to"| node_uploadedpage
node_dashboard -.->|"starts creation"| node_create
node_create -->|"creates book"| node_bookapi
node_editor -->|"renders"| node_details
node_editor -->|"renders"| node_chapter
node_editor -.->|"loads and saves"| node_bookapi
node_chapter -.->|"requests drafting"| node_ai
node_details -.->|"generates cover"| node_imageai
node_bookapi -->|"reads and writes"| node_bookmodel
node_ai -.->|"generates text"| node_gemini
node_ai -.->|"generates covers"| node_imageai
node_editor -.->|"requests export"| node_export
node_export -->|"loads book"| node_bookmodel
node_reader -.->|"imports books"| node_uploadui
node_uploadui -.->|"uploads or imports"| node_uploadedapi
node_uploadedpage -->|"loads book"| node_uploadedapi
node_uploadedapi -->|"reads and writes"| node_uploadmodel
node_uploadedapi -->|"stores book files"| node_cloudinary
node_uploadui -.->|"imports from Drive"| node_drive
node_authapi -.->|"stores accounts"| node_mongo
node_bookapi -.->|"persists books"| node_mongo
node_uploadedapi -.->|"persists metadata"| node_mongo
node_authapi -->|"sends reset email"| node_mail
node_authguard -->|"checks user"| node_mongo

click node_app "https://github.com/mihirlimbachiya02/ebookcreator/blob/main/frontend/src/App.jsx"
click node_authui "https://github.com/mihirlimbachiya02/ebookcreator/blob/main/frontend/src/pages/LoginPage.jsx"
click node_dashboard "https://github.com/mihirlimbachiya02/ebookcreator/blob/main/frontend/src/pages/DashboardPage.jsx"
click node_create "https://github.com/mihirlimbachiya02/ebookcreator/blob/main/frontend/src/components/modals/CreateBookModal.jsx"
click node_editor "https://github.com/mihirlimbachiya02/ebookcreator/blob/main/frontend/src/pages/EditorPage.jsx"
click node_details "https://github.com/mihirlimbachiya02/ebookcreator/blob/main/frontend/src/components/editor/BookDetailsTab.jsx"
click node_chapter "https://github.com/mihirlimbachiya02/ebookcreator/blob/main/frontend/src/components/editor/ChapterEditorTab.jsx"
click node_ai "https://github.com/mihirlimbachiya02/ebookcreator/blob/main/backend/controller/aiController.js"
click node_bookapi "https://github.com/mihirlimbachiya02/ebookcreator/blob/main/backend/controller/bookController.js"
click node_export "https://github.com/mihirlimbachiya02/ebookcreator/blob/main/backend/controller/exportController.js"
click node_viewbook "https://github.com/mihirlimbachiya02/ebookcreator/blob/main/frontend/src/components/view/ViewBook.jsx"
click node_uploadui "https://github.com/mihirlimbachiya02/ebookcreator/blob/main/frontend/src/components/modals/UploadBookModal.jsx"
click node_uploadedpage "https://github.com/mihirlimbachiya02/ebookcreator/blob/main/frontend/src/pages/ViewUploadedBookPage.jsx"
click node_uploadedapi "https://github.com/mihirlimbachiya02/ebookcreator/blob/main/backend/controller/uploadedBookController.js"
click node_authapi "https://github.com/mihirlimbachiya02/ebookcreator/blob/main/backend/controller/authController.js"
click node_authguard "https://github.com/mihirlimbachiya02/ebookcreator/blob/main/backend/middlewares/authMiddleware.js"
click node_bookmodel "https://github.com/mihirlimbachiya02/ebookcreator/blob/main/backend/models/Book.js"
click node_uploadmodel "https://github.com/mihirlimbachiya02/ebookcreator/blob/main/backend/models/UploadedBook.js"
click node_cloudinary "https://github.com/mihirlimbachiya02/ebookcreator/blob/main/backend/config/cloudinary.js"
click node_mail "https://github.com/mihirlimbachiya02/ebookcreator/blob/main/backend/config/emailService.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_authui,node_dashboard toneBlue
class node_create,node_editor,node_details,node_chapter,node_viewbook toneAmber
class node_uploadui,node_uploadedpage toneMint
class node_ai,node_bookapi,node_export,node_uploadedapi,node_authapi,node_authguard,node_bookmodel,node_uploadmodel toneRose
class node_cloudinary,node_gemini,node_imageai,node_drive,node_mongo,node_mail,node_reader toneIndigo
```

## Components

### Web application

- [Route application](https://github.com/mihirlimbachiya02/ebookcreator/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Authentication UI](https://github.com/mihirlimbachiya02/ebookcreator/blob/main/frontend/src/pages/LoginPage.jsx): `frontend/src/pages/LoginPage.jsx`
- [Unified dashboard](https://github.com/mihirlimbachiya02/ebookcreator/blob/main/frontend/src/pages/DashboardPage.jsx): `frontend/src/pages/DashboardPage.jsx`

### Book authoring

- [Book creation](https://github.com/mihirlimbachiya02/ebookcreator/blob/main/frontend/src/components/modals/CreateBookModal.jsx): `frontend/src/components/modals/CreateBookModal.jsx`
- [Book editor](https://github.com/mihirlimbachiya02/ebookcreator/blob/main/frontend/src/pages/EditorPage.jsx): `frontend/src/pages/EditorPage.jsx`
- [Book details and cover](https://github.com/mihirlimbachiya02/ebookcreator/blob/main/frontend/src/components/editor/BookDetailsTab.jsx): `frontend/src/components/editor/BookDetailsTab.jsx`
- [Chapter editing](https://github.com/mihirlimbachiya02/ebookcreator/blob/main/frontend/src/components/editor/ChapterEditorTab.jsx): `frontend/src/components/editor/ChapterEditorTab.jsx`
- [Created book reader](https://github.com/mihirlimbachiya02/ebookcreator/blob/main/frontend/src/components/view/ViewBook.jsx): `frontend/src/components/view/ViewBook.jsx`

### Book library

- [Upload and import UI](https://github.com/mihirlimbachiya02/ebookcreator/blob/main/frontend/src/components/modals/UploadBookModal.jsx): `frontend/src/components/modals/UploadBookModal.jsx`
- [Uploaded book reader](https://github.com/mihirlimbachiya02/ebookcreator/blob/main/frontend/src/pages/ViewUploadedBookPage.jsx): `frontend/src/pages/ViewUploadedBookPage.jsx`

### API and domain

- [AI generation](https://github.com/mihirlimbachiya02/ebookcreator/blob/main/backend/controller/aiController.js): `backend/controller/aiController.js`
- [Book management API](https://github.com/mihirlimbachiya02/ebookcreator/blob/main/backend/controller/bookController.js): `backend/controller/bookController.js`
- [PDF and DOCX export](https://github.com/mihirlimbachiya02/ebookcreator/blob/main/backend/controller/exportController.js): `backend/controller/exportController.js`
- [Uploaded-book API](https://github.com/mihirlimbachiya02/ebookcreator/blob/main/backend/controller/uploadedBookController.js): `backend/controller/uploadedBookController.js`
- [Authentication API](https://github.com/mihirlimbachiya02/ebookcreator/blob/main/backend/controller/authController.js): `backend/controller/authController.js`
- [JWT authorization](https://github.com/mihirlimbachiya02/ebookcreator/blob/main/backend/middlewares/authMiddleware.js): `backend/middlewares/authMiddleware.js`
- [Book records](https://github.com/mihirlimbachiya02/ebookcreator/blob/main/backend/models/Book.js): `backend/models/Book.js`
- [Uploaded-book records](https://github.com/mihirlimbachiya02/ebookcreator/blob/main/backend/models/UploadedBook.js): `backend/models/UploadedBook.js`

### Storage and integrations

- [Cloudinary storage](https://github.com/mihirlimbachiya02/ebookcreator/blob/main/backend/config/cloudinary.js): `backend/config/cloudinary.js`
- **Google Gemini**
- **Cover image services**
- **Google Drive**
- **MongoDB**
- [Email delivery](https://github.com/mihirlimbachiya02/ebookcreator/blob/main/backend/config/emailService.js): `backend/config/emailService.js`

### Other components

- **Reader / author**

## Connections

- Reader / author → Route application: opens (evidence: `frontend/src/App.jsx`)
- Route application → Unified dashboard: routes to (evidence: `frontend/src/App.jsx`)
- Route application → Authentication UI: routes to (evidence: `frontend/src/App.jsx`)
- Route application → Book editor: routes to (evidence: `frontend/src/App.jsx`)
- Route application → Created book reader: routes to (evidence: `frontend/src/App.jsx`)
- Route application → Uploaded book reader: routes to (evidence: `frontend/src/App.jsx`)
- Unified dashboard → Book creation: starts creation
- Book creation → Book management API: creates book (evidence: `frontend/src/components/modals/CreateBookModal.jsx`)
- Book editor → Book details and cover: renders (evidence: `frontend/src/pages/EditorPage.jsx`)
- Book editor → Chapter editing: renders (evidence: `frontend/src/pages/EditorPage.jsx`)
- Book editor → Book management API: loads and saves
- Chapter editing → AI generation: requests drafting
- Book details and cover → Cover image services: generates cover
- Book management API → Book records: reads and writes (evidence: `backend/controller/bookController.js`)
- AI generation → Google Gemini: generates text
- AI generation → Cover image services: generates covers
- Book editor → PDF and DOCX export: requests export
- PDF and DOCX export → Book records: loads book (evidence: `backend/controller/exportController.js`)
- Reader / author → Upload and import UI: imports books
- Upload and import UI → Uploaded-book API: uploads or imports
- Uploaded book reader → Uploaded-book API: loads book (evidence: `frontend/src/pages/ViewUploadedBookPage.jsx`)
- Uploaded-book API → Uploaded-book records: reads and writes (evidence: `backend/controller/uploadedBookController.js`)
- Uploaded-book API → Cloudinary storage: stores book files (evidence: `backend/controller/uploadedBookController.js`)
- Upload and import UI → Google Drive: imports from Drive
- Authentication API → MongoDB: stores accounts
- Book management API → MongoDB: persists books
- Uploaded-book API → MongoDB: persists metadata
- Authentication API → Email delivery: sends reset email (evidence: `backend/controller/authController.js`)
- JWT authorization → MongoDB: checks user (evidence: `backend/middlewares/authMiddleware.js`)
