# aztektr/vue-parking-simulator architecture

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

- Interactive diagram: https://gitdiagram.com/aztektr/vue-parking-simulator
- Repository: https://github.com/aztektr/vue-parking-simulator

## Overview

This repository is a **single-page frontend application** built with **Vue 3 + TypeScript** and bundled/served by **Vite**. There is **no backend** or database visible in the tree/README, so the “system” is primarily:
- A **browser runtime** executing a Vue SPA
- A **build/dev toolchain** (Vite) that compiles and serves the SPA
- A set of **UI components + domain types/constants** that implement an “Algorithms & Data Structures” assignment (suggested by README) centered on **Cars / ParkingLot / Search** concepts.

- Runtime containers (Browser, Vite dev server / static host)
- Internal component/module breakdown (Vue component tree + shared constants/types/utils)
- Primary data flows (user actions → state changes → UI re-render; search/filter flows)

##### File-tree driven architecture breakdown (what to include as components)
From the tree:

##### Build & entry points
- `index.html` — Vite entry HTML (mount point)
- `src/main.ts` — bootstraps Vue app, mounts `App.vue`
- `src/App.vue` — root component / composition root
- `vite.config.ts`, `tsconfig.json`, `package.json` — build configuration and dependencies

##### Domain/UI components
- `src/components/ParkingLot.vue` — likely the main visualization/container for parking-lot logic
- `src/components/Car.vue` — car UI representation (rendering a car in lot, etc.)
- `src/components/SideBarSearch/SideBarSearch.vue` — sidebar container
- `src/components/SideBarSearch/Search.vue` — search input + filtering logic
- `src/components/SideBarSearch/ItemCard.vue` — renders an item in results/list

##### Domain model / data contract
- `src/interfaces/Car.ts`
- `src/interfaces/ParkingLot.ts`

##### Static/config data
- `src/constants/car-models.ts`
- `src/constants/markup-car.ts` (likely templating/markup mapping for rendering cars)

##### Utility
- `src/utils/randint.ts` — random int generator (likely used for generating cars / positions / IDs)

##### Assets & static hosting
- `public/` — static files served as-is
- `src/assets/` — bundled assets

##### Build/Serve Tooling (Vite)
- In dev: Vite Dev Server → serves `index.html`, HMR updates
- In prod: Vite build → static assets deployed to any static host (Netlify/S3/etc.)

**Include artifact flow:**
- `src/*` + `index.html` → Vite → bundled JS/CSS/assets → Browser

Split the SPA into:
- **UI Component Tree**
- **Shared Domain Modules**

##### UI Component Tree (based on file structure)
Model it as:
- `main.ts` → mounts → `App.vue`
- `App.vue`
- `ParkingLot.vue`
- `Car.vue` (likely repeated for each car/slot)
- `SideBarSearch.vue`
- `Search.vue`
- `ItemCard.vue` (repeated for each result)

Even if actual nesting differs slightly, this is the most probable structure given the folders; validate quickly by checking imports in `App.vue` and these components.

- Interfaces:
- `interfaces/Car.ts`
- `interfaces/ParkingLot.ts`
- Constants:
- `constants/car-models.ts`
- `constants/markup-car.ts`
- Utils:
- `utils/randint.ts`

- Components → (import) Interfaces
- Components → (import) Constants
- Components → (import) Utils

##### App initialization
- Browser loads `index.html`
- `main.ts` creates Vue app and mounts `App.vue`

##### Parking lot state ownership (pick and document where state lives)
- Most common pattern: `App.vue` owns the canonical state:
- `parkingLot: ParkingLot`
- `cars: Car[]`
- `selectedCarId` / `searchQuery`
- Then:
- `ParkingLot.vue` receives props (cars/slots) and renders `Car.vue`
- `SideBarSearch.vue` receives the same list and filters/displays results

##### Search interaction
- User types in `Search.vue`
- `Search.vue` emits an event (e.g., `update:query` / `search`)
- `SideBarSearch.vue` (or `App.vue`) updates search state
- Filtered list drives `ItemCard.vue` rendering
- Optionally, selecting an item triggers highlight/scroll/selection in `ParkingLot.vue`

##### Car generation / randomization
- If the assignment generates cars: a button/action triggers generation
- UI re-renders

##### Component composition (Vue SFCs)
- `App.vue` as composition root
- Reusable presentational components (`Car.vue`, `ItemCard.vue`)
- Container components (`ParkingLot.vue`, `SideBarSearch.vue`)

##### Type-driven domain model
- Explicit domain contracts in `src/interfaces/*`

##### Utility isolation
- `randint.ts` as shared pure function used by generation logic

If there is no store library (Pinia/Vuex not shown), call out **“local component state + props/events”** as the state management approach.

##### What to label with technologies/frameworks (important
- **Vue 3** (`App.vue`, components)
- **TypeScript** (whole `src/`, interfaces)
- **Vite** (dev server + build pipeline)
- **Browser DOM** (render target)
- Optionally: **Static Host** (deployment target for Vite build output)

**Zone 1: Runtime**
- User → Browser → Vue SPA

**Zone 2: SPA internals**
- Component tree (App → ParkingLot → Car; App → SideBarSearch → Search/ItemCard)

**Zone 3: Build/Serve**
- Source files → Vite → bundled assets → Browser

That representation will be the most accurate given this repository’s structure and will answer the “how does it work” question immediately.

## Diagram (Mermaid)

```mermaid
flowchart TD
  %% =======================
  %% Zone 1: System Context / Runtime
  %% =======================
  subgraph "Zone 1 — System Context (Runtime)"
    direction TB
    User["User"]:::external
    Browser["Browser (DOM + JS Runtime)"]:::runtime
    SPA["Vue 3 SPA (TypeScript)"]:::spa
    User -->|"interacts"| Browser
    Browser -->|"runs"| SPA
  end

  %% =======================
  %% Zone 3: Build / Serve Toolchain
  %% =======================
  subgraph "Zone 3 — Build & Serve (Vite)"
    direction TB

    subgraph "Source & Config"
      direction TB
      IDX["index.html (Vite entry + mount point)"]:::artifact
      MAIN["main.ts (bootstrap + mount App)"]:::artifact
      VCFG["vite.config.ts (Vite config)"]:::config
      TSCFG["tsconfig.json (TS config)"]:::config
      PKG["package.json (deps + scripts)"]:::config
      PUB["public/ (static served as-is)"]:::storage
      ASSETS["src/assets/ (bundled assets)"]:::storage
    end

    VITE["Vite (dev server + build bundler)"]:::tool
    BUNDLE["Bundled JS/CSS/Assets (dist output)"]:::artifact

    IDX -->|"input"| VITE
    MAIN -->|"input"| VITE
    VCFG -->|"configures"| VITE
    TSCFG -->|"typechecks"| VITE
    PKG -->|"scripts/run"| VITE
    PUB -->|"copies/serves"| VITE
    ASSETS -->|"bundles"| VITE

    VITE -->|"builds"| BUNDLE
    VITE -.->|"dev: HMR updates"| Browser
    BUNDLE -->|"served to"| Browser
    IDX -->|"loaded by"| Browser
  end

  %% =======================
  %% Zone 2: SPA Internals (Components + Modules)
  %% =======================
  subgraph "Zone 2 — SPA Internals (Components + Shared Modules)"
    direction TB

    subgraph "App Composition (Component Tree)"
      direction TB
      App["App.vue (root composition)"]:::component

      subgraph "Parking Lot UI"
        direction TB
        ParkingLot["ParkingLot.vue (lot rendering + lot logic)"]:::container
        Car["Car.vue (car/slot UI)"]:::component
        ParkingLot -->|"renders (v-for)"| Car
      end

      subgraph "Sidebar Search UI"
        direction TB
        SideBar["SideBarSearch.vue (panel + filtering)"]:::container
        Search["Search.vue (input + query emit)"]:::component
        ItemCard["ItemCard.vue (result item)"]:::component
        SideBar -->|"contains"| Search
        SideBar -->|"renders (v-for)"| ItemCard
      end

      App -->|"contains"| ParkingLot
      App -->|"contains"| SideBar

      %% Data down (props/state)
      App -->|"props: cars, parkingLot, selectedCarId"| ParkingLot
      App -->|"props: cars, searchQuery"| SideBar

      %% Events up (emits)
      Search -.->|"emit: searchQueryChanged"| SideBar
      SideBar -.->|"emit: searchQueryChanged"| App
      ItemCard -.->|"emit: selectCar(id)"| SideBar
      SideBar -.->|"emit: selectCar(id)"| App
      ParkingLot -.->|"emit: carSelected(id) (optional)"| App
    end

    subgraph "Shared Domain Modules (Type-driven + config separation)"
      direction TB

      subgraph "Interfaces (Domain Types)"
        direction TB
        ICar["interfaces/Car.ts (type)"]:::type
        IParkingLot["interfaces/ParkingLot.ts (type)"]:::type
      end

      subgraph "Constants (Static Data)"
        direction TB
        CColors["constants/car-colors.ts"]:::const
        CModels["constants/car-models.ts"]:::const
        CMarkup["constants/markup-car.ts"]:::const
      end

      subgraph "Utils (Pure Functions)"
        direction TB
        RandInt["utils/randint.ts (random int)"]:::util
      end
    end

    %% Imports/dependencies
    App -->|"imports: types"| ICar
    App -->|"imports: types"| IParkingLot
    ParkingLot -->|"imports: types"| ICar
    ParkingLot -->|"imports: types"| IParkingLot
    SideBar -->|"imports: types"| ICar
    Search -->|"imports: types (optional)"| ICar
    ItemCard -->|"imports: types"| ICar
    Car -->|"imports: types"| ICar

    App -->|"imports: constants"| CColors
    App -->|"imports: constants"| CModels
    App -->|"imports: constants"| CMarkup
    ParkingLot -->|"imports: constants (optional)"| CMarkup
    Car -->|"imports: constants (optional)"| CMarkup

    App -->|"imports: utils"| RandInt
    ParkingLot -->|"imports: utils (generation/placement)"| RandInt
    SideBar -->|"imports: utils (optional)"| RandInt
  end

  %% Bridge runtime -> internals
  SPA -->|"renders"| App
  MAIN -->|"mounts"| App

  %% =======================
  %% Click Events (from mapping)
  %% =======================
  click IDX "https://github.com/aztektr/vue-parking-simulator/blob/main/index.html"
  click MAIN "https://github.com/aztektr/vue-parking-simulator/blob/main/src/main.ts"
  click App "https://github.com/aztektr/vue-parking-simulator/blob/main/src/App.vue"
  click ParkingLot "https://github.com/aztektr/vue-parking-simulator/blob/main/src/components/ParkingLot.vue"
  click Car "https://github.com/aztektr/vue-parking-simulator/blob/main/src/components/Car.vue"
  click SideBar "https://github.com/aztektr/vue-parking-simulator/blob/main/src/components/SideBarSearch/SideBarSearch.vue"
  click Search "https://github.com/aztektr/vue-parking-simulator/blob/main/src/components/SideBarSearch/Search.vue"
  click ItemCard "https://github.com/aztektr/vue-parking-simulator/blob/main/src/components/SideBarSearch/ItemCard.vue"
  click ICar "https://github.com/aztektr/vue-parking-simulator/blob/main/src/interfaces/Car.ts"
  click IParkingLot "https://github.com/aztektr/vue-parking-simulator/blob/main/src/interfaces/ParkingLot.ts"
  click CColors "https://github.com/aztektr/vue-parking-simulator/blob/main/src/constants/car-colors.ts"
  click CModels "https://github.com/aztektr/vue-parking-simulator/blob/main/src/constants/car-models.ts"
  click CMarkup "https://github.com/aztektr/vue-parking-simulator/blob/main/src/constants/markup-car.ts"
  click RandInt "https://github.com/aztektr/vue-parking-simulator/blob/main/src/utils/randint.ts"
  click PUB "https://github.com/aztektr/vue-parking-simulator/tree/main/public/"
  click ASSETS "https://github.com/aztektr/vue-parking-simulator/tree/main/src/assets/"
  click VCFG "https://github.com/aztektr/vue-parking-simulator/blob/main/vite.config.ts"
  click TSCFG "https://github.com/aztektr/vue-parking-simulator/blob/main/tsconfig.json"
  click PKG "https://github.com/aztektr/vue-parking-simulator/blob/main/package.json"

  %% =======================
  %% Styles
  %% =======================
  classDef external fill:#111827,stroke:#374151,color:#F9FAFB,stroke-width:1.5px
  classDef runtime fill:#0B3B6E,stroke:#0A2A4A,color:#EAF2FF,stroke-width:1.5px
  classDef spa fill:#0E7490,stroke:#155E75,color:#ECFEFF,stroke-width:1.5px
  classDef tool fill:#7C3AED,stroke:#5B21B6,color:#F5F3FF,stroke-width:1.5px
  classDef config fill:#312E81,stroke:#1E1B4B,color:#EEF2FF,stroke-width:1.5px
  classDef artifact fill:#065F46,stroke:#064E3B,color:#ECFDF5,stroke-width:1.5px
  classDef storage fill:#0F766E,stroke:#115E59,color:#ECFEFF,stroke-width:1.5px

  classDef component fill:#16A34A,stroke:#14532D,color:#F0FDF4,stroke-width:1.5px,rx:12,ry:12
  classDef container fill:#22C55E,stroke:#14532D,color:#052E16,stroke-width:1.5px,rx:12,ry:12

  classDef type fill:#F59E0B,stroke:#B45309,color:#1F2937,stroke-width:1.5px
  classDef const fill:#FB7185,stroke:#9F1239,color:#FFF1F2,stroke-width:1.5px
  classDef util fill:#60A5FA,stroke:#1D4ED8,color:#0B1220,stroke-width:1.5px
```
