# parallax07/galactic-store architecture

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

- Interactive diagram: https://gitdiagram.com/parallax07/galactic-store
- Repository: https://github.com/parallax07/galactic-store

## Overview

- Authentication (with components like AuthProvider, PrivateRoute, and firebase.init.js)
- Customer Pages & Components (e.g., Home, AllProducts, Cart, OrderHistory)
- Admin Components (e.g., AddProduct, ManageOrders, EditProductModal, Stats)
- Shared Components (e.g., Navbar, Loader, Error404)
- Backend: Represent the Node.js server with its entry point (server.js) and configuration (package.json, vercel.json). Emphasize that it’s designed to handle API requests and connect to a MySQL database.
- External Services: Optionally, denote external services such as Firebase (for authentication and frontend hosting) and the deployment environment (Vercel for the backend when not running locally).

##### Relationships and Interactions
- For local development, note the use of XAMPP for running MySQL and Apache (if needed), with the corresponding configuration snippets from the README.

##### Architectural Principles and Patterns
- Separation of concerns:
- The React frontend deals with UI, routing, and user interactions.
- The Node.js backend handles API logic and interacts with the database.
- Use a modular design: The clear folder structure (with separate directories for Pages, Components, Auth, and hooks on the frontend, and a distinct backend folder) shows the componentized design.
- That authentication is managed via Firebase, which is an important integration point.
- That the project uses environment-specific configurations (as seen with alternative database connections and axios secure configuration adjustments for local development).

##### Specific Technologies and Frameworks
- Under the Frontend component, list React.js, Vite, Tailwind CSS, and Firebase.
- For the Backend component, list Node.js, Express (if applicable based on server.js structure), and mention its deployment on Vercel.
- Under the Database component, list MySQL and note the use of XAMPP for local testing.
- Optionally, detail that Firebase also covers aspects of real-time authentication and hosting.

## Diagram (Mermaid)

```mermaid
graph TD
  subgraph "Frontend (React + Vite + Tailwind)"
    direction TB
    FE_Main["React App"]:::frontend

    subgraph "Auth Module"
      Auth["Authentication"]:::frontend
    end

    subgraph "Customer Pages"
      Home["Home"]:::frontend
      AllProducts["AllProducts"]:::frontend
      LoginForm["LoginForm"]:::frontend
      SignUpForm["SignUpForm"]:::frontend
      UpdateProfile["UpdateProfile"]:::frontend
      Root["Root"]:::frontend
      Cart["Cart"]:::frontend
      OrderHistory["OrderHistory"]:::frontend
    end

    subgraph "Admin Components"
      AddProduct["AddProduct"]:::frontend
      AllUsers["AllUsers"]:::frontend
      EditProductModal["EditProductModal"]:::frontend
      ManageOrders["ManageOrders"]:::frontend
      ManageProducts["ManageProducts"]:::frontend
      Stats["Stats"]:::frontend
      TotalStatsChart["TotalStatsChart"]:::frontend
    end

    subgraph "Shared Components"
      Navbar["Navbar"]:::frontend
      Error404["Error404"]:::frontend
      Loader["Loader"]:::frontend
      LoadingCard["LoadingCard"]:::frontend
      OrderTable["OrderTable"]:::frontend
      ProductCard["ProductCard"]:::frontend
      ProductDetails["ProductDetails"]:::frontend
      ReviewCard["ReviewCard"]:::frontend
      SearchBar["SearchBar"]:::frontend
    end

    subgraph "Environment & Config"
      Tailwind["tailwind.config.js"]:::frontend
      Vite["vite.config.js"]:::frontend
      FE_Package["package.json"]:::frontend
      PostCSS["postcss.config.js"]:::frontend
    end
  end

  subgraph "Backend (Node.js Server)"
    direction TB
    BE_Main["Node.js Server"]:::backend
    BE_Server["server.js"]:::backend
    BE_Package["package.json"]:::backend
    BE_Vercel["vercel.json"]:::backend
  end

  DB["MySQL Database\n(XAMPP & Schema)"]:::database

  subgraph "External Services"
    direction TB
    Firebase_Node["Firebase"]:::external
    Vercel_Node["Vercel Deployment"]:::external
  end

  %% Connections
  FE_Main -->|"APIcalls(HTTP)"| BE_Main
  BE_Main -->|"SQLqueries"| DB
  FE_Main -->|"Auth&Hosting"| Firebase_Node
  BE_Main -->|"Deployedon"| Vercel_Node

  %% Click Events
  click FE_Main "https://github.com/parallax07/galactic-store/tree/main/frontend/"
  click Auth "https://github.com/parallax07/galactic-store/tree/main/frontend/src/Auth/"
  click Home "https://github.com/parallax07/galactic-store/blob/main/frontend/src/Pages/Home.jsx"
  click AllProducts "https://github.com/parallax07/galactic-store/blob/main/frontend/src/Pages/AllProducts.jsx"
  click LoginForm "https://github.com/parallax07/galactic-store/blob/main/frontend/src/Pages/LoginForm.jsx"
  click SignUpForm "https://github.com/parallax07/galactic-store/blob/main/frontend/src/Pages/SignUpForm.jsx"
  click UpdateProfile "https://github.com/parallax07/galactic-store/blob/main/frontend/src/Pages/UpdateProfile.jsx"
  click Root "https://github.com/parallax07/galactic-store/blob/main/frontend/src/Pages/Root.jsx"
  click Cart "https://github.com/parallax07/galactic-store/blob/main/frontend/src/components/Customer/Cart.jsx"
  click OrderHistory "https://github.com/parallax07/galactic-store/blob/main/frontend/src/components/Customer/OrderHistory.jsx"
  click AddProduct "https://github.com/parallax07/galactic-store/blob/main/frontend/src/components/Admin/AddProduct.jsx"
  click AllUsers "https://github.com/parallax07/galactic-store/blob/main/frontend/src/components/Admin/AllUsers.jsx"
  click EditProductModal "https://github.com/parallax07/galactic-store/blob/main/frontend/src/components/Admin/EditProductModal.jsx"
  click ManageOrders "https://github.com/parallax07/galactic-store/blob/main/frontend/src/components/Admin/ManageOrders.jsx"
  click ManageProducts "https://github.com/parallax07/galactic-store/blob/main/frontend/src/components/Admin/ManageProducts.jsx"
  click Stats "https://github.com/parallax07/galactic-store/blob/main/frontend/src/components/Admin/Stats/Stats.jsx"
  click TotalStatsChart "https://github.com/parallax07/galactic-store/blob/main/frontend/src/components/Admin/Stats/TotalStatsChart.jsx"
  click Navbar "https://github.com/parallax07/galactic-store/blob/main/frontend/src/components/shared/Navbar.jsx"
  click Error404 "https://github.com/parallax07/galactic-store/blob/main/frontend/src/components/shared/Error404.jsx"
  click Loader "https://github.com/parallax07/galactic-store/blob/main/frontend/src/components/shared/Loader.jsx"
  click LoadingCard "https://github.com/parallax07/galactic-store/blob/main/frontend/src/components/shared/LoadingCard.jsx"
  click OrderTable "https://github.com/parallax07/galactic-store/blob/main/frontend/src/components/shared/OrderTable.jsx"
  click ProductCard "https://github.com/parallax07/galactic-store/blob/main/frontend/src/components/shared/ProductCard.jsx"
  click ProductDetails "https://github.com/parallax07/galactic-store/blob/main/frontend/src/components/shared/ProductDetails.jsx"
  click ReviewCard "https://github.com/parallax07/galactic-store/blob/main/frontend/src/components/shared/ReviewCard.jsx"
  click SearchBar "https://github.com/parallax07/galactic-store/blob/main/frontend/src/components/shared/SearchBar.jsx"
  click Tailwind "https://github.com/parallax07/galactic-store/blob/main/frontend/tailwind.config.js"
  click Vite "https://github.com/parallax07/galactic-store/blob/main/frontend/vite.config.js"
  click FE_Package "https://github.com/parallax07/galactic-store/blob/main/frontend/package.json"
  click PostCSS "https://github.com/parallax07/galactic-store/blob/main/frontend/postcss.config.js"
  click BE_Server "https://github.com/parallax07/galactic-store/blob/main/backend/server.js"
  click BE_Package "https://github.com/parallax07/galactic-store/blob/main/backend/package.json"
  click BE_Vercel "https://github.com/parallax07/galactic-store/blob/main/backend/vercel.json"
  click DB "https://github.com/parallax07/galactic-store/blob/main/galacticStore.sql"
  click Firebase_Node "https://github.com/parallax07/galactic-store/blob/main/frontend/firebase.json"
  click Vercel_Node "https://github.com/parallax07/galactic-store/blob/main/backend/vercel.json"

  %% Styles
  classDef frontend fill:#E0F7FA,stroke:#006064,stroke-width:2px;
  classDef backend fill:#E8F5E9,stroke:#2E7D32,stroke-width:2px;
  classDef database fill:#FFF9C4,stroke:#F9A825,stroke-width:2px;
  classDef external fill:#F3E5F5,stroke:#8E24AA,stroke-width:2px;
```
