# deepkumar7106/baseball architecture

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

- Interactive diagram: https://gitdiagram.com/deepkumar7106/baseball
- Repository: https://github.com/deepkumar7106/baseball

## Overview

Baseoball is a browser-based baseball game with account registration/login, configurable innings, a toss, gameplay against a CPU, and persisted game outcomes and scores. The main path is Home → game setup and toss → game creation → gameplay → score/winner submission; authentication is a separate API flow that establishes browser session state. Profile, history, and scoreboard screens are also present. Some screen and backend wiring is unsampled, so the graph limits those connections to documented or excerpted relationships.

Main entry points: [`frontend/src/App.jsx`](https://github.com/deepkumar7106/baseball/blob/main/frontend/src/App.jsx) (Route shell), [`frontend/src/pages/Game.jsx`](https://github.com/deepkumar7106/baseball/blob/main/frontend/src/pages/Game.jsx) (Gameplay), [`frontend/src/components/GameTweaker.jsx`](https://github.com/deepkumar7106/baseball/blob/main/frontend/src/components/GameTweaker.jsx) (Game setup), [`frontend/src/pages/Auth.jsx`](https://github.com/deepkumar7106/baseball/blob/main/frontend/src/pages/Auth.jsx) (Auth screen)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Web application"]
  node_app["Route shell<br/>[App.jsx]"]
  node_home["Home<br/>[Home.jsx]"]
  node_setup["Game setup<br/>[GameTweaker.jsx]"]
  node_ball_count["Ball selector"]
  node_toss["Toss and launch<br/>[Toss.jsx]"]
  node_game["Gameplay<br/>[Game.jsx]"]
  node_game_rules["Game rules<br/>[game.utils.js]"]
  node_game_api["Game API client<br/>[game.api.js]"]
  node_auth_screen["Auth screen<br/>[Auth.jsx]"]
  node_auth_state["Session state<br/>[AuthContext.jsx]"]
  node_profile["Player profile<br/>[PlayerProfile.jsx]"]
  node_history["Game history<br/>[History.jsx]"]
  node_scoreboard["Scoreboard<br/>[Scoreboard.jsx]"]
end

subgraph group_api["Backend API"]
  node_auth_routes["Auth routes<br/>[auth.router.js]"]
  node_game_routes["Game routes<br/>[game.routes.js]"]
end

subgraph group_data["Persistence"]
  node_prisma["Database client<br/>[prisma.js]"]
  node_database[("SQLite database<br/>[schema.prisma]")]
end

node_player(("Player"))
node_browser_storage[("Browser storage")]

node_player -->|"opens"| node_app
node_app -->|"routes to"| node_home
node_app -->|"routes to"| node_game
node_app -->|"routes to"| node_auth_screen
node_app -->|"routes to"| node_profile
node_app -->|"routes to"| node_scoreboard
node_home -->|"renders"| node_setup
node_setup -->|"renders"| node_ball_count
node_setup -->|"renders"| node_toss
node_toss -->|"creates game"| node_game_routes
node_game -->|"uses rules"| node_game_rules
node_game -->|"submits results"| node_game_api
node_game -->|"reads session"| node_auth_state
node_auth_screen -->|"sends auth requests"| node_auth_routes
node_auth_screen -->|"sets session"| node_auth_state
node_auth_state -->|"persists session"| node_browser_storage
node_profile -->|"renders"| node_history
node_auth_routes -->|"queries users"| node_prisma
node_game_routes -->|"writes game data"| node_prisma
node_prisma -.->|"uses adapter"| node_database

click node_app "https://github.com/deepkumar7106/baseball/blob/main/frontend/src/App.jsx"
click node_home "https://github.com/deepkumar7106/baseball/blob/main/frontend/src/pages/Home.jsx"
click node_setup "https://github.com/deepkumar7106/baseball/blob/main/frontend/src/components/GameTweaker.jsx"
click node_ball_count "https://github.com/deepkumar7106/baseball/blob/main/frontend/src/components/BallCountSelector.jsx"
click node_toss "https://github.com/deepkumar7106/baseball/blob/main/frontend/src/components/home/Toss.jsx"
click node_game "https://github.com/deepkumar7106/baseball/blob/main/frontend/src/pages/Game.jsx"
click node_game_rules "https://github.com/deepkumar7106/baseball/blob/main/frontend/src/scripts/game.utils.js"
click node_game_api "https://github.com/deepkumar7106/baseball/blob/main/frontend/src/scripts/game.api.js"
click node_auth_screen "https://github.com/deepkumar7106/baseball/blob/main/frontend/src/pages/Auth.jsx"
click node_auth_state "https://github.com/deepkumar7106/baseball/blob/main/frontend/src/context/AuthContext.jsx"
click node_profile "https://github.com/deepkumar7106/baseball/blob/main/frontend/src/components/profile/PlayerProfile.jsx"
click node_history "https://github.com/deepkumar7106/baseball/blob/main/frontend/src/components/profile/History.jsx"
click node_scoreboard "https://github.com/deepkumar7106/baseball/blob/main/frontend/src/pages/Scoreboard.jsx"
click node_auth_routes "https://github.com/deepkumar7106/baseball/blob/main/backend/src/routes/auth.router.js"
click node_game_routes "https://github.com/deepkumar7106/baseball/blob/main/backend/src/routes/game.routes.js"
click node_prisma "https://github.com/deepkumar7106/baseball/blob/main/backend/src/lib/prisma.js"
click node_database "https://github.com/deepkumar7106/baseball/blob/main/backend/prisma/schema.prisma"

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_app,node_home,node_setup,node_ball_count,node_toss,node_game,node_game_rules,node_game_api,node_auth_screen,node_auth_state,node_profile,node_history,node_scoreboard toneBlue
class node_auth_routes,node_game_routes,node_browser_storage toneAmber
class node_prisma,node_database toneMint
class node_player toneIndigo
```

## Components

### Web application

- [Route shell](https://github.com/deepkumar7106/baseball/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Home](https://github.com/deepkumar7106/baseball/blob/main/frontend/src/pages/Home.jsx): `frontend/src/pages/Home.jsx`
- [Game setup](https://github.com/deepkumar7106/baseball/blob/main/frontend/src/components/GameTweaker.jsx): `frontend/src/components/GameTweaker.jsx`
- [Ball selector](https://github.com/deepkumar7106/baseball/blob/main/frontend/src/components/BallCountSelector.jsx): `frontend/src/components/BallCountSelector.jsx`
- [Toss and launch](https://github.com/deepkumar7106/baseball/blob/main/frontend/src/components/home/Toss.jsx): `frontend/src/components/home/Toss.jsx`
- [Gameplay](https://github.com/deepkumar7106/baseball/blob/main/frontend/src/pages/Game.jsx): `frontend/src/pages/Game.jsx`
- [Game rules](https://github.com/deepkumar7106/baseball/blob/main/frontend/src/scripts/game.utils.js): `frontend/src/scripts/game.utils.js`
- [Game API client](https://github.com/deepkumar7106/baseball/blob/main/frontend/src/scripts/game.api.js): `frontend/src/scripts/game.api.js`
- [Auth screen](https://github.com/deepkumar7106/baseball/blob/main/frontend/src/pages/Auth.jsx): `frontend/src/pages/Auth.jsx`
- [Session state](https://github.com/deepkumar7106/baseball/blob/main/frontend/src/context/AuthContext.jsx): `frontend/src/context/AuthContext.jsx`
- [Player profile](https://github.com/deepkumar7106/baseball/blob/main/frontend/src/components/profile/PlayerProfile.jsx): `frontend/src/components/profile/PlayerProfile.jsx`
- [Game history](https://github.com/deepkumar7106/baseball/blob/main/frontend/src/components/profile/History.jsx): `frontend/src/components/profile/History.jsx`
- [Scoreboard](https://github.com/deepkumar7106/baseball/blob/main/frontend/src/pages/Scoreboard.jsx): `frontend/src/pages/Scoreboard.jsx`

### Backend API

- [Auth routes](https://github.com/deepkumar7106/baseball/blob/main/backend/src/routes/auth.router.js): `backend/src/routes/auth.router.js`
- [Game routes](https://github.com/deepkumar7106/baseball/blob/main/backend/src/routes/game.routes.js): `backend/src/routes/game.routes.js`

### Persistence

- [Database client](https://github.com/deepkumar7106/baseball/blob/main/backend/src/lib/prisma.js): `backend/src/lib/prisma.js`
- [SQLite database](https://github.com/deepkumar7106/baseball/blob/main/backend/prisma/schema.prisma): `backend/prisma/schema.prisma`

### Other components

- **Player**
- **Browser storage**

## Connections

- Player → Route shell: opens (evidence: `frontend/src/App.jsx`)
- Route shell → Home: routes to (evidence: `frontend/src/App.jsx`)
- Route shell → Gameplay: routes to (evidence: `frontend/src/App.jsx`)
- Route shell → Auth screen: routes to (evidence: `frontend/src/App.jsx`)
- Route shell → Player profile: routes to (evidence: `frontend/src/App.jsx`)
- Route shell → Scoreboard: routes to (evidence: `frontend/src/App.jsx`)
- Home → Game setup: renders (evidence: `frontend/src/pages/Home.jsx`)
- Game setup → Ball selector: renders (evidence: `frontend/src/components/GameTweaker.jsx`)
- Game setup → Toss and launch: renders (evidence: `frontend/src/components/GameTweaker.jsx`)
- Toss and launch → Game routes: creates game (evidence: `frontend/src/components/home/Toss.jsx`)
- Gameplay → Game rules: uses rules (evidence: `frontend/src/pages/Game.jsx`)
- Gameplay → Game API client: submits results (evidence: `frontend/src/pages/Game.jsx`)
- Gameplay → Session state: reads session (evidence: `frontend/src/pages/Game.jsx`)
- Auth screen → Auth routes: sends auth requests (evidence: `frontend/src/pages/Auth.jsx`)
- Auth screen → Session state: sets session (evidence: `frontend/src/pages/Auth.jsx`)
- Session state → Browser storage: persists session (evidence: `frontend/src/context/AuthContext.jsx`)
- Player profile → Game history: renders
- Auth routes → Database client: queries users (evidence: `backend/src/routes/auth.router.js`)
- Game routes → Database client: writes game data (evidence: `backend/src/routes/game.routes.js`)
- Database client → SQLite database: uses adapter
