# dishaa-patni/mern_bookstore_project architecture

> Architecture diagram of the GitHub repository dishaa-patni/mern_bookstore_project, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-07-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/dishaa-patni/mern_bookstore_project
- Repository: https://github.com/dishaa-patni/mern_bookstore_project

## Overview

##### Project type and purpose
- This is a full-stack CRUD web application for managing books.
- The backend is a Node.js + Express REST API (in /backend) that uses Mongoose models to interact with a MongoDB.
- The frontend is a React application (in /frontend) built with Vite and styled with Tailwind CSS, providing pages and components for creating, reading, updating, and deleting books.

##### File structure
- Top-level: two main directories, backend and frontend, each with its own package.json and build/config files.
- backend/ models, routes, and index.js imply an MVC-style REST API:
- models/bookModel.js – Mongoose schema for Book
- routes/bookRoute.js – Express endpoints (CRUD)
- index.js – server setup and route mounting
- frontend/ is a Vite + React project:
- src/pages – each page matches a CRUD view (Home, CreateBook, EditBook, ShowBook, DeleteBook)
- src/components – reusable UI pieces (cards, modals, spinner, back button)
- public, index.html – static assets and HTML entry point
- config: vite.config.js, tailwind.config.js, postcss.config.js

##### README
- (Empty in this case.) Use file tree to infer tech stack and architecture.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Frontend Layer
    subgraph "Frontend Layer"
        direction TB
        Browser["Browser"]:::external
        StaticHost["Vite Dev Server / Static Host"]:::tooling
        ReactSPA["React SPA"]:::frontend
        subgraph "Pages" 
            direction TB
            HomePage["Home Page"]:::frontend
            CreateBookPage["Create Book Page"]:::frontend
            EditBookPage["Edit Book Page"]:::frontend
            ShowBookPage["Show Book Page"]:::frontend
            DeleteBookPage["Delete Book Page"]:::frontend
        end
        subgraph "Reusable UI Components"
            direction TB
            BackButton["Back Button"]:::frontend
            Spinner["Spinner"]:::frontend
            BookModal["Book Modal"]:::frontend
            BooksCard["Books Card"]:::frontend
            BooksSingleCard["Single Book Card"]:::frontend
            BooksTable["Books Table"]:::frontend
        end
        subgraph "Tooling & Config"
            direction TB
            ViteConfig["vite.config.js"]:::tooling
            TailwindConfig["tailwind.config.js"]:::tooling
            PostCSSConfig["postcss.config.js"]:::tooling
            FEPackage["package.json"]:::tooling
            FEESLint[".eslintrc.cjs"]:::tooling
            FEGitignore[".gitignore"]:::tooling
        end
    end

    %% Backend Layer
    subgraph "Backend Layer"
        direction TB
        ExpressServer["Express API Server"]:::backend
        subgraph "Controllers (Routes)"
            direction TB
            BookRoute["bookRoute.js"]:::backend
        end
        subgraph "Models"
            direction TB
            BookModel["bookModel.js"]:::backend
        end
        subgraph "Tooling & Config"
            direction TB
            BEPackage["package.json"]:::tooling
            BEGitignore[".gitignore"]:::tooling
        end
    end

    %% Database
    MongoDB["MongoDB"]:::database

    %% Connections
    Browser -->|loads index.html| StaticHost
    StaticHost -->|serves SPA| ReactSPA
    ReactSPA -->|GET /books<br/>POST /books<br/>PUT /books/:id<br/>DELETE /books/:id| ExpressServer
    ExpressServer -->|routes requests| BookRoute
    BookRoute -->|uses schema| BookModel
    BookModel -->|queries| MongoDB
    MongoDB -->|documents| BookModel
    BookModel -->|returns data| BookRoute
    BookRoute -->|sends JSON| ExpressServer
    ExpressServer -->|responses| ReactSPA

    %% Click Events
    click ReactSPA "https://github.com/dishaa-patni/mern_bookstore_project/tree/main/frontend/"
    click HomePage "https://github.com/dishaa-patni/mern_bookstore_project/blob/main/frontend/src/pages/Home.jsx"
    click CreateBookPage "https://github.com/dishaa-patni/mern_bookstore_project/blob/main/frontend/src/pages/CreateBook.jsx"
    click EditBookPage "https://github.com/dishaa-patni/mern_bookstore_project/blob/main/frontend/src/pages/EditBook.jsx"
    click ShowBookPage "https://github.com/dishaa-patni/mern_bookstore_project/blob/main/frontend/src/pages/ShowBook.jsx"
    click DeleteBookPage "https://github.com/dishaa-patni/mern_bookstore_project/blob/main/frontend/src/pages/DeleteBook.jsx"
    click BackButton "https://github.com/dishaa-patni/mern_bookstore_project/blob/main/frontend/src/components/BackButton.jsx"
    click Spinner "https://github.com/dishaa-patni/mern_bookstore_project/blob/main/frontend/src/components/Spinner.jsx"
    click BookModal "https://github.com/dishaa-patni/mern_bookstore_project/blob/main/frontend/src/components/home/BookModal.jsx"
    click BooksCard "https://github.com/dishaa-patni/mern_bookstore_project/blob/main/frontend/src/components/home/BooksCard.jsx"
    click BooksSingleCard "https://github.com/dishaa-patni/mern_bookstore_project/blob/main/frontend/src/components/home/BooksSingleCard.jsx"
    click BooksTable "https://github.com/dishaa-patni/mern_bookstore_project/blob/main/frontend/src/components/home/BooksTable.jsx"
    click ViteConfig "https://github.com/dishaa-patni/mern_bookstore_project/blob/main/frontend/vite.config.js"
    click TailwindConfig "https://github.com/dishaa-patni/mern_bookstore_project/blob/main/frontend/tailwind.config.js"
    click PostCSSConfig "https://github.com/dishaa-patni/mern_bookstore_project/blob/main/frontend/postcss.config.js"
    click FEPackage "https://github.com/dishaa-patni/mern_bookstore_project/blob/main/frontend/package.json"
    click FEESLint "https://github.com/dishaa-patni/mern_bookstore_project/blob/main/frontend/.eslintrc.cjs"
    click FEGitignore "https://github.com/dishaa-patni/mern_bookstore_project/blob/main/frontend/.gitignore"
    click ExpressServer "https://github.com/dishaa-patni/mern_bookstore_project/blob/main/backend/index.js"
    click BookRoute "https://github.com/dishaa-patni/mern_bookstore_project/blob/main/backend/routes/bookRoute.js"
    click BookModel "https://github.com/dishaa-patni/mern_bookstore_project/blob/main/backend/models/bookModel.js"
    click BEPackage "https://github.com/dishaa-patni/mern_bookstore_project/blob/main/backend/package.json"
    click BEGitignore "https://github.com/dishaa-patni/mern_bookstore_project/blob/main/backend/.gitignore"

    %% Styles
    classDef frontend fill:#D0E8FF,stroke:#0366d6,stroke-width:1px
    classDef backend fill:#DFF2BF,stroke:#4F8A10,stroke-width:1px
    classDef database fill:#FFE4B5,stroke:#CC8400,stroke-width:1px,shape:cylinder
    classDef tooling fill:#F0F0F0,stroke:#666,stroke-width:1px,stroke-dasharray: 2 2
    classDef external fill:#E2E2E2,stroke:#999,stroke-width:1px
```
