How aztektr/vue-parking-simulator works
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.