# kalpadas599/book_store_website architecture

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

- Interactive diagram: https://gitdiagram.com/kalpadas599/book_store_website
- Repository: https://github.com/kalpadas599/book_store_website

## Overview

##### Project type and purpose
- This is a full-stack web application (“Bookstore Website”) with a React/Tailwind CSS frontend and a Node.js/Express backend.
- The frontend provides user-facing UIs (book listing, signup/login, course info, free books, etc.).
- The backend exposes REST endpoints for managing users and books, persisting data in a MongoDB database.

##### File structure
- Top-level: “Frontend” and “Backend” directories.
- Frontend:
- Vite-powered React app (vite.config.js, index.html).
- Tailwind (tailwind.config.js, postcss.config.js).
- src/components for UI, src/context/AuthProvider for auth state, src/courses and src/home routes.
- public/list.json for static data.
- Backend:
- index.js bootstraps an Express app.
- controller/*.controller.js implements request handlers (user, book).
- route/*.route.js defines Express routes.
- model/*.model.js defines Mongoose schemas.
- .env holds configuration.
- vercel.json hints at Vercel deployment.

##### Key architectural insights from the README
- Standard npm install and run commands for each tier.
- Frontend runs on localhost:5175 (dev server).
- Backend runs on default port (configured in .env).

##### Diagramming conventions
- Use rectangles for components (Browser, Frontend, Backend, Database).
- Blue for frontend/UI
- Green for backend/services
- Orange for database/external services

##### Detail
- Subcomponents: e.g., under Frontend, show “AuthProvider,” “Cards,” “Courses Component.”
- Under Backend, annotate “Route → Controller → Model.”
- Environment config (.env) feeding into the Express app.
- If time permits, show static asset hosting (public/list.json) and any middleware (CORS, bodyParser).

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Client
    Browser["Browser / Client"]:::external

    %% Frontend Layer
    subgraph "Frontend (React + Vite + Tailwind)" 
        direction TB
        Main["main.jsx"]:::frontend
        App["App.jsx (Routes)"]:::frontend
        Auth["AuthProvider.jsx"]:::frontend
        Banner["Banner.jsx"]:::frontend
        Cards["Cards.jsx"]:::frontend
        CourseComp["Course.jsx"]:::frontend
        Freebook["Freebook.jsx"]:::frontend
        Navbar["Navbar.jsx"]:::frontend
        Footer["Footer.jsx"]:::frontend
        Login["Login.jsx"]:::frontend
        Signup["Signup.jsx"]:::frontend
        Logout["Logout.jsx"]:::frontend
        CoursesPage["Courses.jsx"]:::frontend
        HomePage["Home.jsx"]:::frontend
        StaticData["list.json"]:::frontend
        ViteConfig["vite.config.js"]:::frontend
        TailwindConfig["tailwind.config.js"]:::frontend
    end

    %% Backend Layer
    subgraph "Backend API (Node.js + Express)"
        direction TB
        Bootstrap["index.js"]:::backend
        EnvFile[".env"]:::backend
        RoutesSub["Routes"]:::backend
        UC["user.route.js"]:::backend
        BC["book.route.js"]:::backend
        ControllersSub["Controllers"]:::backend
        UController["user.controller.js"]:::backend
        BController["book.controller.js"]:::backend
        ModelsSub["Models"]:::backend
        UModel["user.model.js"]:::backend
        BModel["book.model.js"]:::backend
        VercelCfg["vercel.json"]:::backend
    end

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

    %% Deployment
    Vercel["Vercel Hosting"]:::external

    %% Connections
    Browser -->|"loads SPA"| Main
    Main -->|imports| App
    App -->|renders| Auth
    App -->|routes| Banner
    App -->|routes| Cards
    App -->|routes| CourseComp
    App -->|routes| Freebook
    App -->|routes| Navbar
    App -->|routes| Footer
    App -->|routes| Login
    App -->|routes| Signup
    App -->|routes| Logout
    App -->|routes| CoursesPage
    App -->|routes| HomePage
    App -->|fetches static| StaticData
    App -->|uses configs| ViteConfig
    App -->|uses configs| TailwindConfig

    Main -->|"HTTP REST"| Bootstrap
    Bootstrap -->|loads env| EnvFile
    Bootstrap -->|uses routes| UC
    Bootstrap -->|uses routes| BC
    UC -->|invoke| UController
    BC -->|invoke| BController
    UController -->|access| UModel
    BController -->|access| BModel
    Bootstrap -->|deploys| VercelCfg

    Bootstrap -->|"Mongoose"| MongoDB
    MongoDB -->|responds| BController
    MongoDB -->|responds| UController

    Bootstrap -->|"deployed on"| Vercel
    Main -->|"deployed on"| Vercel

    %% Click Events Frontend
    click Main "https://github.com/kalpadas599/book_store_website/blob/master/Frontend/src/main.jsx"
    click App "https://github.com/kalpadas599/book_store_website/blob/master/Frontend/src/App.jsx"
    click Auth "https://github.com/kalpadas599/book_store_website/blob/master/Frontend/src/context/AuthProvider.jsx"
    click Banner "https://github.com/kalpadas599/book_store_website/blob/master/Frontend/src/components/Banner.jsx"
    click Cards "https://github.com/kalpadas599/book_store_website/blob/master/Frontend/src/components/Cards.jsx"
    click CourseComp "https://github.com/kalpadas599/book_store_website/blob/master/Frontend/src/components/Course.jsx"
    click Freebook "https://github.com/kalpadas599/book_store_website/blob/master/Frontend/src/components/Freebook.jsx"
    click Navbar "https://github.com/kalpadas599/book_store_website/blob/master/Frontend/src/components/Navbar.jsx"
    click Footer "https://github.com/kalpadas599/book_store_website/blob/master/Frontend/src/components/Footer.jsx"
    click Login "https://github.com/kalpadas599/book_store_website/blob/master/Frontend/src/components/Login.jsx"
    click Signup "https://github.com/kalpadas599/book_store_website/blob/master/Frontend/src/components/Signup.jsx"
    click Logout "https://github.com/kalpadas599/book_store_website/blob/master/Frontend/src/components/Logout.jsx"
    click CoursesPage "https://github.com/kalpadas599/book_store_website/blob/master/Frontend/src/courses/Courses.jsx"
    click HomePage "https://github.com/kalpadas599/book_store_website/blob/master/Frontend/src/home/Home.jsx"
    click StaticData "https://github.com/kalpadas599/book_store_website/blob/master/Frontend/public/list.json"
    click ViteConfig "https://github.com/kalpadas599/book_store_website/blob/master/Frontend/vite.config.js"
    click TailwindConfig "https://github.com/kalpadas599/book_store_website/blob/master/Frontend/tailwind.config.js"

    %% Click Events Backend
    click Bootstrap "https://github.com/kalpadas599/book_store_website/blob/master/Backend/index.js"
    click UC "https://github.com/kalpadas599/book_store_website/blob/master/Backend/route/user.route.js"
    click BC "https://github.com/kalpadas599/book_store_website/blob/master/Backend/route/book.route.js"
    click UController "https://github.com/kalpadas599/book_store_website/blob/master/Backend/controller/user.controller.js"
    click BController "https://github.com/kalpadas599/book_store_website/blob/master/Backend/controller/book.controller.js"
    click UModel "https://github.com/kalpadas599/book_store_website/blob/master/Backend/model/user.model.js"
    click BModel "https://github.com/kalpadas599/book_store_website/blob/master/Backend/model/book.model.js"
    click EnvFile "https://github.com/kalpadas599/book_store_website/blob/master/Backend/.env"
    click VercelCfg "https://github.com/kalpadas599/book_store_website/blob/master/Backend/vercel.json"

    %% Styles
    classDef frontend fill:#E0F7FA,stroke:#00796B,stroke-width:1px
    classDef backend fill:#E8F5E9,stroke:#2E7D32,stroke-width:1px
    classDef database fill:#FFF3E0,stroke:#FB8C00,stroke-width:1px
    classDef external fill:#F3E5F5,stroke:#6A1B9A,stroke-width:1px
```
