# sujalkrg/bookstore-mern-stack architecture

> Architecture diagram of the GitHub repository sujalkrg/bookstore-mern-stack, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sujalkrg/bookstore-mern-stack
- Repository: https://github.com/sujalkrg/bookstore-mern-stack

## Overview

##### Project type and purpose
- From the README and file tree, this is a full-stack MERN (MongoDB, Express, React, Node.js) BookStore application.
- Purpose: provide a responsive UI for users to Create, Read, Update, and Delete books; backend exposes REST API; deployed on Vercel (frontend) and Render (backend).

##### File structure
- Top level splits into `frontend/` and `backend/`.
- `backend/` contains:
- config.js (env + DB connection)
- index.js (Express app entry)
- routes/booksRoute.js (CRUD endpoints)
- models/bookModel.js (Mongoose schema)
- package.json (dependencies: express, mongoose, cors, dotenv)
- `frontend/` contains:
- Vite-based React app in `src/`
- Components (modals, cards, tables), pages (Home, Create, Edit, Delete)
- Axios for HTTP, Notistack for alerts, TailwindCSS for styling
- Public/index.html, main.jsx (app bootstrap)
- Root `package.json` likely orchestration or workspace, plus `.gitignore`.

##### README for additional insights
- Confirms tech stack, CI/CD plans, deployment URLs, environment variables.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "Frontend on Vercel"
        direction TB
        FE1["main.jsx"]:::frontend
        FE2["index.html"]:::frontend
        FE3["components/"]:::frontend
        FE4["pages/"]:::frontend
        FE5["index.css"]:::frontend
        FE6["vite.config.js"]:::frontend
        FE7["eslint.config.js"]:::frontend
        FE8["package.json"]:::frontend
    end

    subgraph "Backend on Render"
        direction TB
        BE1["index.js"]:::backend
        BE2["config.js"]:::backend
        BE3["booksRoute.js"]:::backend
        BE4["bookModel.js"]:::backend
    end

    subgraph "Repository Root"
        direction TB
        RM1["package.json"]:::meta
        RM2["package-lock.json"]:::meta
        RM3["README.md"]:::meta
        RM4[".gitignore"]:::meta
    end

    DB["MongoDB Atlas"]:::database
    GH["GitHub"]:::external

    GH -->|"CI/CD"| RM1
    RM1 -->|"orchestrates"| FE1
    RM1 -->|"orchestrates"| BE1

    FE1 -->|"HTTP/JSON"| BE1
    FE1 -.->|"CORS"| BE1
    BE1 -->|"Mongoose queries"| DB

    FE1 --> FE3
    FE1 --> FE4

    click FE1 "https://github.com/sujalkrg/bookstore-mern-stack/blob/main/frontend/src/main.jsx"
    click FE2 "https://github.com/sujalkrg/bookstore-mern-stack/blob/main/frontend/index.html"
    click FE3 "https://github.com/sujalkrg/bookstore-mern-stack/tree/main/frontend/src/components/"
    click FE4 "https://github.com/sujalkrg/bookstore-mern-stack/tree/main/frontend/src/pages/"
    click FE5 "https://github.com/sujalkrg/bookstore-mern-stack/blob/main/frontend/src/index.css"
    click FE6 "https://github.com/sujalkrg/bookstore-mern-stack/blob/main/frontend/vite.config.js"
    click FE7 "https://github.com/sujalkrg/bookstore-mern-stack/blob/main/frontend/eslint.config.js"
    click FE8 "https://github.com/sujalkrg/bookstore-mern-stack/blob/main/frontend/package.json"
    click BE1 "https://github.com/sujalkrg/bookstore-mern-stack/blob/main/backend/index.js"
    click BE2 "https://github.com/sujalkrg/bookstore-mern-stack/blob/main/backend/config.js"
    click BE3 "https://github.com/sujalkrg/bookstore-mern-stack/blob/main/backend/routes/booksRoute.js"
    click BE4 "https://github.com/sujalkrg/bookstore-mern-stack/blob/main/backend/models/bookModel.js"
    click RM1 "https://github.com/sujalkrg/bookstore-mern-stack/blob/main/package.json"
    click RM2 "https://github.com/sujalkrg/bookstore-mern-stack/blob/main/package-lock.json"
    click RM3 "https://github.com/sujalkrg/bookstore-mern-stack/blob/main/README.md"
    click RM4 "https://github.com/sujalkrg/bookstore-mern-stack/blob/main/.gitignore"

    classDef frontend fill:#cce5ff,stroke:#004085,color:#004085
    classDef backend fill:#d4edda,stroke:#155724,color:#155724
    classDef database fill:#fff3cd,stroke:#856404,color:#856404
    classDef external fill:#e2e3e5,stroke:#6c757d,color:#6c757d,stroke-dasharray: 5 5
    classDef meta fill:#f8d7da,stroke:#721c24,color:#721c24
```
