# shubham996633/kuber-webstore architecture

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

- Interactive diagram: https://gitdiagram.com/shubham996633/kuber-webstore
- Repository: https://github.com/shubham996633/kuber-webstore

## Overview

##### Project Type and Purpose
- This is a full-stack, Kubernetes-based e-commerce provisioning platform (“Kuber WebStore”).
- Purpose: Provide a React dashboard and REST API to spin up isolated WooCommerce/WordPress stores on demand in a K8s cluster, using a Helm chart for deployment.

##### File Structure
- Top-level dirs:
- backend/ – Node.js + Express API in TypeScript, including routes, services (provisioner, recovery, guardrails, WooCommerce/Medusa integrations), K8s client wrappers, SQLite migrations.
- dashboard/ – React + Vite + TS + Tailwind UI, with components, API client, hooks.
- docker/ – Dockerfiles for API & dashboard, nginx.conf.
- helm/kuber-platform/ – Helm chart (templates for API & dashboard deployments, services, ingress, PVCs, RBAC, namespace).
- scripts/ – setup-local.sh, teardown.sh for k3d cluster orchestration.
- Key configs: Dockerfiles, helm/values-*.yaml, tsconfig.json, Vite/tailwind configs.

##### README for Additional Insights
- Architecture: Single-cluster multi-tenant pattern: one API+dashboard in “kuber-system” namespace, per-store dynamic namespaces (“store-<id>”) containing WordPress & MySQL pods + PVC + Ingress + NetworkPolicy.
- Tech stack: React 19, Node.js 22, Express 4, TypeScript, SQLite, @kubernetes/client-node, Helm 3, Traefik ingress.

##### Elements
- Rectangle (UI & API) in blue

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User-Facing Layer
    subgraph "User-Facing Layer"
        direction TB
        Browser["End User\n(Web Browser)"]:::external
        DashboardUI["Dashboard UI\n(React + Vite)"]:::frontend
        APIServer["API Server\n(Node.js + Express)"]:::backend
        SQLiteDB["SQLite\n(Metadata & Audit Logs)"]:::db
    end

    %% Orchestration Layer
    subgraph "Orchestration Layer"
        direction TB
        HelmChart["Helm Chart\n(platform & store templating)"]:::helm
        K8sCluster["Kubernetes Cluster"]:::k8s
        subgraph "Control Plane" 
            direction TB
            K8sAPI["K8s API Server"]:::k8s
        end
        subgraph "Dynamic Store Namespace\n(store-<id>)" 
            direction TB
            WPPod["WordPress + WooCommerce Pod"]:::workload
            MySQLPod["MySQL Pod"]:::workload
            PVC["PVC"]:::k8s
            ServiceObj["Service"]:::k8s
            IngressObj["Ingress"]:::k8s
            SecretsNP["Secrets & NetworkPolicy"]:::k8s
        end
    end

    %% Traefik Ingress outside cluster
    Traefik["Traefik Ingress Controller"]:::ingress

    %% Connections
    Browser -->|"HTTPS"| DashboardUI
    DashboardUI -->|"REST API"| APIServer
    APIServer -->|"SQL Queries"| SQLiteDB
    APIServer -->|"K8s Client Calls"| K8sAPI
    K8sAPI -->|"Control Plane Actions"| HelmChart
    HelmChart -->|"Templated Deployment"| K8sAPI
    K8sAPI -->|"Creates Resources"| WPPod & MySQLPod & PVC & ServiceObj & IngressObj & SecretsNP
    Traefik -->|"Routes store-<id>.domain.com"| WPPod
    WPPod -->|"DB Traffic"| MySQLPod

    %% Click Events for component mapping
    click DashboardUI "https://github.com/shubham996633/kuber-webstore/tree/main/dashboard/"
    click APIServer "https://github.com/shubham996633/kuber-webstore/blob/main/backend/src/index.ts"
    click HelmChart "https://github.com/shubham996633/kuber-webstore/tree/main/helm/kuber-platform/"
    click SQLiteDB "https://github.com/shubham996633/kuber-webstore/blob/main/backend/src/db/connection.ts"

    %% Styles
    classDef external fill:#F0F8FF,stroke:#333,stroke-width:1px
    classDef frontend fill:#CCE5FF,stroke:#333,stroke-width:1px
    classDef backend fill:#E0E0E0,stroke:#333,stroke-width:1px
    classDef db fill:#DFF2BF,stroke:#333,stroke-width:1px,stroke-dasharray: 5 5
    classDef k8s fill:#FFE5B4,stroke:#333,stroke-width:1px
    classDef helm fill:#FFD1DC,stroke:#333,stroke-width:1px,stroke-dasharray: 2 2
    classDef ingress fill:#FFEB99,stroke:#333,stroke-width:1px
    classDef workload fill:#FFF2CC,stroke:#333,stroke-width:1px
```
