# oc-ean/endless_lane_rush architecture

> Architecture diagram of the GitHub repository oc-ean/endless_lane_rush, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-07-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/oc-ean/endless_lane_rush
- Repository: https://github.com/oc-ean/endless_lane_rush

## Overview

#### Purpose and entry points
Lane Rush is a browser-based endless lane-driving game. Vue boots from `src/main.ts`, mounts the application shell in `src/App.vue`, and routes between landing, instructions, and gameplay screens through `src/router/index.ts`.

#### Route-level experience
The router separates non-game screens from the active simulation:
- Home/start screen: `src/views/HomeView.vue`
- Instructions and control reference: `src/views/InstructionsView.vue`
- Primary runtime surface: `src/views/GameView.vue`

`GameView` is the orchestration boundary that combines the road, cars, HUD, controls, and pause/game-over overlays.

#### Central game state and loop
`src/stores/game.ts` is the core domain authority. It holds game lifecycle state (running/paused/ended), score/high-score and difficulty progression, player lane/jump state, and obstacle movement/collision-related state. It also owns or coordinates the game-loop logic, making Pinia the primary shared-state and simulation boundary rather than individual components.

Domain contracts are centralized in `src/types/index.ts`, allowing views, store, and visual entities to share typed game models.

#### Runtime visual entities
Gameplay is rendered as a composition of focused Vue components:
- Road/world presentation: `src/components/RoadBackground.vue`
- Player visual state and interactions: `src/components/PlayerCar.vue`
- Moving traffic/obstacles: `src/components/ObstacleCar.vue`

These components should remain render-oriented consumers of store-provided state; game rules, spawning, speed scaling, and collision decisions belong in the game store.

#### Input and gameplay lifecycle
`src/composables/useGameControls.ts` bridges browser input to game actions. It supports keyboard controls plus mobile swipe/tap gestures, and should attach/remove listeners with the gameplay view lifecycle. Actions flow from this composable into `src/stores/game.ts`, which validates them against lifecycle state (for example, ignoring movement while paused or over).

Lifecycle presentation is separated into:
- Active score and pause control: `src/components/GameHud.vue`
- Pause state: `src/components/GamePauseModal.vue`
- Terminal score/restart state: `src/components/GameOverModal.vue`

#### Audio and asset boundary
`src/composables/useSounds.ts` encapsulates browser audio behavior and exposes gameplay-triggered sound effects without embedding audio control in car or HUD components. Styling and static visual assets are local: `src/assets/base.css`, `src/assets/main.css`, and `src/assets/images`.

#### Platform and deployment
The application is a Vue 3 + TypeScript single-page app built and served by Vite (`vite.config.ts`). Tailwind is part of the styling pipeline (`tailwind.config.js`, `postcss.config.js`). Production output is static and configured for Vercel deployment through `vercel.json`; no backend, database, or external runtime service is indicated.

Main entry points: [`src/views/GameView.vue`](https://github.com/oc-ean/endless_lane_rush/blob/main/src/views/GameView.vue) (Game runtime surface), [`src/stores/game.ts`](https://github.com/oc-ean/endless_lane_rush/blob/main/src/stores/game.ts) (Game state and loop), [`src/router/index.ts`](https://github.com/oc-ean/endless_lane_rush/blob/main/src/router/index.ts) (Route coordinator), [`src/App.vue`](https://github.com/oc-ean/endless_lane_rush/blob/main/src/App.vue) (Application shell)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application"]
  node_main{{"Vue bootstrap<br/>entrypoint<br/>[main.ts]"}}
  node_app_shell["Application shell<br/>Vue root<br/>[App.vue]"]
  node_router["Route coordinator<br/>Vue Router<br/>[index.ts]"]
  node_home["Home screen<br/>Vue view<br/>[HomeView.vue]"]
  node_instructions["Instructions screen<br/>Vue view"]
end

subgraph group_gameplay["Gameplay runtime"]
  node_game_view["Game runtime surface<br/>Vue view<br/>[GameView.vue]"]
  node_game_store[("Game state and loop<br/>Pinia store<br/>[game.ts]")]
  node_game_types["Game contracts<br/>TypeScript models<br/>[index.ts]"]
  node_controls{{"Browser controls<br/>Vue composable<br/>[useGameControls.ts]"}}
  node_sounds{{"Game sounds<br/>Vue composable<br/>[useSounds.ts]"}}
end

subgraph group_ui["Gameplay UI"]
  node_road["Road world<br/>Vue component<br/>[RoadBackground.vue]"]
  node_player["Player car<br/>Vue component<br/>[PlayerCar.vue]"]
  node_obstacles["Traffic obstacles<br/>Vue component<br/>[ObstacleCar.vue]"]
  node_hud["Game HUD<br/>Vue component<br/>[GameHud.vue]"]
  node_pause_modal["Pause overlay<br/>Vue component<br/>[GamePauseModal.vue]"]
  node_game_over["Game-over overlay<br/>Vue component<br/>[GameOverModal.vue]"]
  node_styles_assets["Styles and images<br/>static assets"]
end

subgraph group_platform["Build and deployment"]
  node_vite{{"Vite build server<br/>build tool<br/>[vite.config.ts]"}}
  node_tailwind{{"Tailwind pipeline<br/>CSS pipeline<br/>[tailwind.config.js]"}}
  node_vercel["Vercel static deploy<br/>deployment config<br/>[vercel.json]"]
end

node_main -->|"mounts"| node_app_shell
node_app_shell -->|"hosts"| node_router
node_router -->|"routes to"| node_home
node_router -->|"routes to"| node_instructions
node_router -->|"routes to"| node_game_view
node_game_view -->|"binds lifecycle"| node_controls
node_controls -->|"dispatches actions"| node_game_store
node_game_view -->|"orchestrates"| node_game_store
node_game_store -->|"uses models"| node_game_types
node_game_view -->|"triggers effects"| node_sounds
node_game_view -->|"renders"| node_road
node_game_view -->|"renders"| node_player
node_game_view -->|"renders"| node_obstacles
node_game_view -->|"renders"| node_hud
node_game_view -->|"renders by state"| node_pause_modal
node_game_view -->|"renders by state"| node_game_over
node_game_store -->|"provides visual state"| node_player
node_game_store -->|"provides obstacle state"| node_obstacles
node_game_store -->|"provides score and lifecycle"| node_hud
node_game_store -->|"provides pause state"| node_pause_modal
node_game_store -->|"provides terminal state"| node_game_over
node_styles_assets -->|"styles UI"| node_app_shell
node_vite -->|"builds"| node_app_shell
node_tailwind -->|"processes CSS"| node_vite
node_vite -->|"produces static output"| node_vercel

click node_main "https://github.com/oc-ean/endless_lane_rush/blob/main/src/main.ts"
click node_app_shell "https://github.com/oc-ean/endless_lane_rush/blob/main/src/App.vue"
click node_router "https://github.com/oc-ean/endless_lane_rush/blob/main/src/router/index.ts"
click node_home "https://github.com/oc-ean/endless_lane_rush/blob/main/src/views/HomeView.vue"
click node_instructions "https://github.com/oc-ean/endless_lane_rush/blob/main/src/views/InstructionsView.vue"
click node_game_view "https://github.com/oc-ean/endless_lane_rush/blob/main/src/views/GameView.vue"
click node_game_store "https://github.com/oc-ean/endless_lane_rush/blob/main/src/stores/game.ts"
click node_game_types "https://github.com/oc-ean/endless_lane_rush/blob/main/src/types/index.ts"
click node_controls "https://github.com/oc-ean/endless_lane_rush/blob/main/src/composables/useGameControls.ts"
click node_sounds "https://github.com/oc-ean/endless_lane_rush/blob/main/src/composables/useSounds.ts"
click node_road "https://github.com/oc-ean/endless_lane_rush/blob/main/src/components/RoadBackground.vue"
click node_player "https://github.com/oc-ean/endless_lane_rush/blob/main/src/components/PlayerCar.vue"
click node_obstacles "https://github.com/oc-ean/endless_lane_rush/blob/main/src/components/ObstacleCar.vue"
click node_hud "https://github.com/oc-ean/endless_lane_rush/blob/main/src/components/GameHud.vue"
click node_pause_modal "https://github.com/oc-ean/endless_lane_rush/blob/main/src/components/GamePauseModal.vue"
click node_game_over "https://github.com/oc-ean/endless_lane_rush/blob/main/src/components/GameOverModal.vue"
click node_styles_assets "https://github.com/oc-ean/endless_lane_rush/tree/main/src/assets"
click node_vite "https://github.com/oc-ean/endless_lane_rush/blob/main/vite.config.ts"
click node_tailwind "https://github.com/oc-ean/endless_lane_rush/blob/main/tailwind.config.js"
click node_vercel "https://github.com/oc-ean/endless_lane_rush/blob/main/vercel.json"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_main,node_app_shell,node_router,node_home,node_instructions toneBlue
class node_game_view,node_game_store,node_game_types,node_controls,node_sounds toneAmber
class node_road,node_player,node_obstacles,node_hud,node_pause_modal,node_game_over,node_styles_assets toneMint
class node_vite,node_tailwind,node_vercel toneRose
```

## Components

### Application

- [Vue bootstrap](https://github.com/oc-ean/endless_lane_rush/blob/main/src/main.ts): entrypoint · Creates and mounts the SPA. · `src/main.ts`
- [Application shell](https://github.com/oc-ean/endless_lane_rush/blob/main/src/App.vue): Vue root · `src/App.vue`
- [Route coordinator](https://github.com/oc-ean/endless_lane_rush/blob/main/src/router/index.ts): Vue Router · Separates informational screens from active gameplay. · `src/router/index.ts`
- [Home screen](https://github.com/oc-ean/endless_lane_rush/blob/main/src/views/HomeView.vue): Vue view · `src/views/HomeView.vue`
- [Instructions screen](https://github.com/oc-ean/endless_lane_rush/blob/main/src/views/InstructionsView.vue): Vue view · `src/views/InstructionsView.vue`

### Gameplay runtime

- [Game runtime surface](https://github.com/oc-ean/endless_lane_rush/blob/main/src/views/GameView.vue): Vue view · Composes simulation visuals, controls, HUD, and lifecycle overlays. · `src/views/GameView.vue`
- [Game state and loop](https://github.com/oc-ean/endless_lane_rush/blob/main/src/stores/game.ts): Pinia store · Owns lifecycle, scoring, progression, movement, spawning, and collision decisions. · `src/stores/game.ts`
- [Game contracts](https://github.com/oc-ean/endless_lane_rush/blob/main/src/types/index.ts): TypeScript models · `src/types/index.ts`
- [Browser controls](https://github.com/oc-ean/endless_lane_rush/blob/main/src/composables/useGameControls.ts): Vue composable · Maps keyboard and touch gestures to validated game actions. · `src/composables/useGameControls.ts`
- [Game sounds](https://github.com/oc-ean/endless_lane_rush/blob/main/src/composables/useSounds.ts): Vue composable · Encapsulates browser audio effects. · `src/composables/useSounds.ts`

### Gameplay UI

- [Road world](https://github.com/oc-ean/endless_lane_rush/blob/main/src/components/RoadBackground.vue): Vue component · `src/components/RoadBackground.vue`
- [Player car](https://github.com/oc-ean/endless_lane_rush/blob/main/src/components/PlayerCar.vue): Vue component · Renders player lane and jump state. · `src/components/PlayerCar.vue`
- [Traffic obstacles](https://github.com/oc-ean/endless_lane_rush/blob/main/src/components/ObstacleCar.vue): Vue component · Renders store-provided moving traffic. · `src/components/ObstacleCar.vue`
- [Game HUD](https://github.com/oc-ean/endless_lane_rush/blob/main/src/components/GameHud.vue): Vue component · Shows active score and pause control. · `src/components/GameHud.vue`
- [Pause overlay](https://github.com/oc-ean/endless_lane_rush/blob/main/src/components/GamePauseModal.vue): Vue component · `src/components/GamePauseModal.vue`
- [Game-over overlay](https://github.com/oc-ean/endless_lane_rush/blob/main/src/components/GameOverModal.vue): Vue component · Presents terminal score and restart. · `src/components/GameOverModal.vue`
- [Styles and images](https://github.com/oc-ean/endless_lane_rush/tree/main/src/assets): static assets · Local CSS and visual assets. · `src/assets`

### Build and deployment

- [Vite build server](https://github.com/oc-ean/endless_lane_rush/blob/main/vite.config.ts): build tool · Builds and serves the Vue SPA. · `vite.config.ts`
- [Tailwind pipeline](https://github.com/oc-ean/endless_lane_rush/blob/main/tailwind.config.js): CSS pipeline · `tailwind.config.js`
- [Vercel static deploy](https://github.com/oc-ean/endless_lane_rush/blob/main/vercel.json): deployment config · Deploys the production static output. · `vercel.json`

## Connections

- Vue bootstrap → Application shell: mounts
- Application shell → Route coordinator: hosts
- Route coordinator → Home screen: routes to
- Route coordinator → Instructions screen: routes to
- Route coordinator → Game runtime surface: routes to
- Game runtime surface → Browser controls: binds lifecycle
- Browser controls → Game state and loop: dispatches actions
- Game runtime surface → Game state and loop: orchestrates
- Game state and loop → Game contracts: uses models
- Game runtime surface → Game sounds: triggers effects
- Game runtime surface → Road world: renders
- Game runtime surface → Player car: renders
- Game runtime surface → Traffic obstacles: renders
- Game runtime surface → Game HUD: renders
- Game runtime surface → Pause overlay: renders by state
- Game runtime surface → Game-over overlay: renders by state
- Game state and loop → Player car: provides visual state
- Game state and loop → Traffic obstacles: provides obstacle state
- Game state and loop → Game HUD: provides score and lifecycle
- Game state and loop → Pause overlay: provides pause state
- Game state and loop → Game-over overlay: provides terminal state
- Styles and images → Application shell: styles UI
- Vite build server → Application shell: builds
- Tailwind pipeline → Vite build server: processes CSS
- Vite build server → Vercel static deploy: produces static output
