# sawsew467/vite-code-base architecture

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

- Interactive diagram: https://gitdiagram.com/sawsew467/vite-code-base
- Repository: https://github.com/sawsew467/vite-code-base

## Overview

##### Project type and purpose
- This is a front-end React application scaffold built with Vite and TypeScript. It provides a template for building modern web apps with:
- A responsive UI (Tailwind CSS + Radix UI)
- Organized feature modules (Redux Toolkit slices + RTK Query “baseApi”)
- Authentication via Clerk
- Routing (React Router)
- Code-style enforcement (ESLint, Prettier)

##### File structure
- Top-level config files:
- vite.config.ts, tsconfig.json, eslint.config.js, .prettierrc → build/tooling layer
- Assets: public/ & src/assets/ → static content
- Entrypoints: index.html → HTML shell; src/main.tsx → React root
- Providers: src/providers.tsx → Context providers (Redux store, Clerk)
- Routing: src/router.tsx → Client-side routes
- Redux layer: src/redux/ (baseApi.ts, store.ts) & feature slices under src/features/
- Feature modules:
- booking, student-management, teacher-management, landing-page → each with slice, service, types, UI components
- UI components: src/components/ui/ → buttons, inputs, cards, menus, etc.
- Shared/reusable: src/components/shared/
- Layouts: src/components/layouts/ → landing vs. dashboard layouts with header/footer/sidebar

##### README for additional insights
- Tech stack summary: Vite, React, TypeScript, Tailwind, Redux Toolkit, Clerk, Radix UI
- Emphasis on modular feature-based structure
- No backend code here—external APIs (Clerk auth, booking data) are consumed via RTK Query

a. Main components
- Build/Tooling Layer (Vite, TS, ESLint/Prettier)
- Static Host (public/) → serves index.html
- Browser
– HTML Shell (index.html)
– JavaScript Bundle (compiled by Vite)
- React app root (src/main.tsx → App)
- Providers
– Redux Store (src/redux/store.ts)
– Clerk Auth Provider
- Router (src/router.tsx) → defines page routes
- Layout Components
– LandingLayout (header, footer)
– DashboardLayout (sidebar, search, version switcher)
- Pages (home, sign-in, booking, dashboard/student & teacher pages)
- Feature Modules
– BookingSlice & BookingService (RTK Query)
– StudentManagementSlice, TeacherManagementSlice
– LandingPage components (hero, features, cta)
- UI Component Library (buttons, inputs, cards, etc.)
- External Services
– Clerk Authentication API
– (Optional) Booking backend API via RTK Query baseApi

b. Relationships & interactions
- Browser requests index.html → Vite dev server or static host
- main.tsx mounts App inside Providers
- Router dispatches to Page components
- Pages compose Layout + Feature UI components
- UI events dispatch Redux actions or RTK Query hooks
- RTK Query baseApi makes HTTP calls to external services (Clerk, booking API)
- Redux store holds slices of state for features & auth
- Components consume state via useSelector/useDispatch or useApi hooks

c. Architectural patterns & design principles
- Feature-based modularization (each “feature” folder = domain module)
- Container/presentation separation: pages/layouts vs. shared UI components
- Single source of truth via Redux Toolkit store
- Domain services via RTK Query (baseApi) for data fetching & caching
- Auth as a cross-cutting concern via a top-level provider

d. Key technologies/frameworks
- Vite → fast dev server & build
- React + Hooks → UI
- React Router → client routing
- Redux Toolkit & RTK Query → state + data layer
- Clerk → authentication
- Tailwind CSS & Radix UI → styling & accessible components

## Diagram (Mermaid)

```mermaid
flowchart TB
  %% Build & Tooling Layer
  subgraph "Build & Tooling" 
    direction TB
    VITE["vite.config.ts"]:::tool
    TSC["tsconfig.json"]:::tool
    ESL["eslint.config.js"]:::tool
    PRET[".prettierrc"]:::tool
  end

  %% Static Host & Shell
  subgraph "Static Host" 
    direction TB
    PUBLIC["public/"]:::infra
    HTML["index.html"]:::infra
  end
  
  %% Browser & Bundle
  BROWSER["Browser"]:::external
  PUBLIC -->|serves| HTML
  BROWSER -->|loads| HTML
  HTML -->|"loads JS bundle"| BUNDLE["JS Bundle (Vite)"]:::infra
  
  %% React App Entry
  BUNDLE -->|executes| MAIN["src/main.tsx"]:::frontend
  click VITE "https://github.com/sawsew467/vite-code-base/blob/main/vite.config.ts"
  click TSC "https://github.com/sawsew467/vite-code-base/blob/main/tsconfig.json"
  click ESL "https://github.com/sawsew467/vite-code-base/blob/main/eslint.config.js"
  click PRET "https://github.com/sawsew467/vite-code-base/blob/main/.prettierrc"
  click PUBLIC "https://github.com/sawsew467/vite-code-base/tree/main/public/"
  click HTML "https://github.com/sawsew467/vite-code-base/blob/main/index.html"
  click MAIN "https://github.com/sawsew467/vite-code-base/blob/main/src/main.tsx"

  %% React App Structure
  subgraph "React App" 
    direction TB
    PROVIDERS["Providers\n(src/providers.tsx)"]:::frontend
    ROUTER["Router\n(src/router.tsx)"]:::frontend
    PROVIDERS --> ROUTER
    click PROVIDERS "https://github.com/sawsew467/vite-code-base/blob/main/src/providers.tsx"
    click ROUTER "https://github.com/sawsew467/vite-code-base/blob/main/src/router.tsx"
    
    %% Layouts
    subgraph "Layouts" 
      direction TB
      LLAYOUT["LandingLayout"]:::frontend
      DLAYOUT["DashboardLayout"]:::frontend
      click LLAYOUT "https://github.com/sawsew467/vite-code-base/blob/main/src/components/layouts/landing/layout.tsx"
      click DLAYOUT "https://github.com/sawsew467/vite-code-base/blob/main/src/components/layouts/dashboard/layout.tsx"
    end
    
    %% Pages
    subgraph "Pages" 
      direction TB
      subgraph "Public Pages"
        direction TB
        HOME["Home Page"]:::frontend
        SIGNIN["Sign-In Page"]:::frontend
        BOOKPG["Booking Page"]:::frontend
        click HOME "https://github.com/sawsew467/vite-code-base/blob/main/src/pages/home/index.tsx"
        click SIGNIN "https://github.com/sawsew467/vite-code-base/blob/main/src/pages/sign-in/index.tsx"
        click BOOKPG "https://github.com/sawsew467/vite-code-base/blob/main/src/pages/booking/index.tsx"
      end
      subgraph "Dashboard Pages"
        direction TB
        STUPG["Student Mgmt Page"]:::frontend
        TEAPG["Teacher Mgmt Page"]:::frontend
        click STUPG "https://github.com/sawsew467/vite-code-base/blob/main/src/pages/dashboard/student-management/index.tsx"
        click TEAPG "https://github.com/sawsew467/vite-code-base/blob/main/src/pages/dashboard/teacher-management/index.tsx"
      end
    end
    
    %% Connect Router to Layout+Pages
    ROUTER -->|routes to| LLAYOUT
    ROUTER -->|routes to| DLAYOUT
    LLAYOUT --> HOME
    LLAYOUT --> SIGNIN
    LLAYOUT --> BOOKPG
    DLAYOUT --> STUPG
    DLAYOUT --> TEAPG
  end
  
  %% Feature Modules
  subgraph "Feature Modules" 
    direction TB
    subgraph Booking
      BSLC["BookingSlice"]:::state
      BSVC["BookingService"]:::state
      BTYPE["BookingTypes"]:::state
      BCOMP["BookingArea Component"]:::frontend
      click BSLC "https://github.com/sawsew467/vite-code-base/blob/main/src/features/booking/slice.ts"
      click BSVC "https://github.com/sawsew467/vite-code-base/blob/main/src/features/booking/service.ts"
      click BTYPE "https://github.com/sawsew467/vite-code-base/blob/main/src/features/booking/types.ts"
      click BCOMP "https://github.com/sawsew467/vite-code-base/blob/main/src/features/booking/components/booking-area.tsx"
    end
    subgraph Student
      SSLC["StudentSlice"]:::state
      SCOMP["StudentView Component"]:::frontend
      click SSLC "https://github.com/sawsew467/vite-code-base/blob/main/src/features/student-management/slice.ts"
      click SCOMP "https://github.com/sawsew467/vite-code-base/blob/main/src/features/student-management/components/student-view.tsx"
    end
    subgraph Teacher
      TSLC["TeacherSlice"]:::state
      TCOMP["TeacherView Component"]:::frontend
      click TSLC "https://github.com/sawsew467/vite-code-base/blob/main/src/features/teacher-management/slice.ts"
      click TCOMP "https://github.com/sawsew467/vite-code-base/blob/main/src/features/teacher-management/components/teacher-view.tsx"
    end
    subgraph Landing
      HCOMP["Hero Component"]:::frontend
      FCOMP["Features Component"]:::frontend
      CCOMP["CTA Component"]:::frontend
      click HCOMP "https://github.com/sawsew467/vite-code-base/blob/main/src/features/landing-page/components/hero.tsx"
      click FCOMP "https://github.com/sawsew467/vite-code-base/blob/main/src/features/landing-page/components/features.tsx"
      click CCOMP "https://github.com/sawsew467/vite-code-base/blob/main/src/features/landing-page/components/cta.tsx"
    end
  end
  
  %% UI Library & Shared
  subgraph "UI Component Library" 
    direction TB
    BUTTON["Button"]:::frontend
    INPUT["Input"]:::frontend
    CARD["Card"]:::frontend
    MENU["DropdownMenu"]:::frontend
    LABEL["Label"]:::frontend
    SEP["Separator"]:::frontend
    SHEET["Sheet"]:::frontend
    SIDEBAR_UI["Sidebar"]:::frontend
    SKEL["Skeleton"]:::frontend
    TOOLTIP["Tooltip"]:::frontend
    BREAD["Breadcrumb"]:::frontend
    click BUTTON "https://github.com/sawsew467/vite-code-base/blob/main/src/components/ui/button.tsx"
    click INPUT "https://github.com/sawsew467/vite-code-base/blob/main/src/components/ui/input.tsx"
    click CARD "https://github.com/sawsew467/vite-code-base/blob/main/src/components/ui/card.tsx"
    click MENU "https://github.com/sawsew467/vite-code-base/blob/main/src/components/ui/dropdown-menu.tsx"
    click LABEL "https://github.com/sawsew467/vite-code-base/blob/main/src/components/ui/label.tsx"
    click SEP "https://github.com/sawsew467/vite-code-base/blob/main/src/components/ui/separator.tsx"
    click SHEET "https://github.com/sawsew467/vite-code-base/blob/main/src/components/ui/sheet.tsx"
    click SIDEBAR_UI "https://github.com/sawsew467/vite-code-base/blob/main/src/components/ui/sidebar.tsx"
    click SKEL "https://github.com/sawsew467/vite-code-base/blob/main/src/components/ui/skeleton.tsx"
    click TOOLTIP "https://github.com/sawsew467/vite-code-base/blob/main/src/components/ui/tooltip.tsx"
    click BREAD "https://github.com/sawsew467/vite-code-base/blob/main/src/components/ui/breadcrumb.tsx"
  end
  
  SHARED["Shared Component"]:::frontend
  click SHARED "https://github.com/sawsew467/vite-code-base/blob/main/src/components/shared/reusable-component.tsx"
  
  %% Pages to Features & UI
  HOME -->|uses| HCOMP
  HOME -->|uses| FCOMP
  HOME -->|uses| CCOMP
  BOOKPG -->|uses| BCOMP
  STUPG -->|uses| SCOMP
  TEAPG -->|uses| TCOMP
  
  %% Redux & RTK Query
  subgraph "State & Data Layer"
    direction TB
    STORE["Redux Store\n(src/redux/store.ts)"]:::state
    BASEAPI["RTK Query BaseApi\n(src/redux/baseApi.ts)"]:::state
    click STORE "https://github.com/sawsew467/vite-code-base/blob/main/src/redux/store.ts"
    click BASEAPI "https://github.com/sawsew467/vite-code-base/blob/main/src/redux/baseApi.ts"
  end
  
  %% Hooks, Utils, Styles
  HOOK1["Redux Hooks\n(src/hooks/redux.ts)"]:::util
  HOOK2["Mobile Hook\n(src/hooks/use-mobile.ts)"]:::util
  UTILS["Utils\n(src/lib/utils.ts)"]:::util
  STYLES["Global Styles\n(src/index.css)"]:::util
  click HOOK1 "https://github.com/sawsew467/vite-code-base/blob/main/src/hooks/redux.ts"
  click HOOK2 "https://github.com/sawsew467/vite-code-base/blob/main/src/hooks/use-mobile.ts"
  click UTILS "https://github.com/sawsew467/vite-code-base/blob/main/src/lib/utils.ts"
  click STYLES "https://github.com/sawsew467/vite-code-base/blob/main/src/index.css"
  
  %% External Services
  subgraph "External Services"
    direction TB
    CLERK["Clerk Auth API"]:::external
    BOOKAPI["Booking Backend API"]:::external
  end
  
  %% Data Flow Connections
  PROVIDERS -->|provides store| STORE
  PROVIDERS -->|provides auth| CLERK
  ROUTER -->|renders pages| HOME
  HOME -->|dispatches| STORE
  BOOKPG -->|RTK hook| BASEAPI
  BCOMP -->|RTK hook| BASEAPI
  SSLC -->|reads/writes| STORE
  TSLC -->|reads/writes| STORE
  BASEAPI -->|HTTP+JSON| CLERK
  BASEAPI -->|HTTP+JSON| BOOKAPI
  
  %% Component to UI Library
  BCOMP -->|renders| BUTTON
  BCOMP -->|renders| CARD
  SCOMP -->|renders| INPUT
  TCOMP -->|renders| MENU
  
  %% Class Definitions
  classDef tool fill:#f2f2f2,stroke:#ccc
  classDef infra fill:#e6e6e6,stroke:#bbb
  classDef frontend fill:#cce5ff,stroke:#3399ff
  classDef state fill:#d5f5e3,stroke:#27ae60
  classDef external fill:#fde2c7,stroke:#e67e22
  classDef util fill:#f9e79f,stroke:#b7950b
```
