# ein-shen/pikol architecture

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

- Interactive diagram: https://gitdiagram.com/ein-shen/pikol
- Repository: https://github.com/ein-shen/pikol

## Overview

Pikol is a pickleball open-play and tournament-management app. Players use the React dashboard to create or manage open play and single-elimination, Top 2, and Top 3 tournaments, view brackets, and record results; the Express API handles authentication and tournament data in PostgreSQL. The graph preserves the documented tournament formats and visible frontend modules. Some route internals were not sampled, so links between frontend API requests and backend handlers are shown as unverified rather than asserted.

Main entry points: [`frontend/src/App.jsx`](https://github.com/ein-shen/pikol/blob/main/frontend/src/App.jsx) (Routes and dashboard), [`backend/server.js`](https://github.com/ein-shen/pikol/blob/main/backend/server.js) (Express API), [`backend/db.js`](https://github.com/ein-shen/pikol/blob/main/backend/db.js) (PostgreSQL connection pool), [`frontend/src/api.js`](https://github.com/ein-shen/pikol/blob/main/frontend/src/api.js) (HTTP client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web application"]
  node_app["Routes and dashboard<br/>[App.jsx]"]
  node_landing["Landing page<br/>[Home.jsx]"]
  node_api["HTTP client<br/>[api.js]"]
  node_matching["Player matching<br/>[Matching.jsx]"]
  node_overview["Tournament overview<br/>[Overview.jsx]"]
end

subgraph group_tournaments["Tournament workflows"]
  node_create["Tournament creation"]
  node_openplay["Open play<br/>[OpenPlay.jsx]"]
  node_single["Single elimination"]
  node_top2["Top 2 format<br/>[Top2_Brackets.jsx]"]
  node_top3["Top 3 format<br/>[Top3_Brackets.jsx]"]
  node_dashboards["Tournament dashboards"]
  node_singlebracket["Single bracket view"]
  node_top2bracket["Top 2 bracket view"]
  node_top3bracket["Top 3 bracket view"]
end

subgraph group_identity["Identity and preferences"]
  node_authui["Login and signup<br/>[Login.jsx]"]
  node_authstate["Authentication state<br/>[AuthContext.jsx]"]
  node_theme["Theme preferences<br/>[ThemeContext.jsx]"]
end

subgraph group_server["API and persistence"]
  node_server["Express API<br/>[server.js]"]
  node_authroutes["Authentication routes<br/>[auth.js]"]
  node_middleware["Authentication middleware<br/>[auth.js]"]
  node_getroutes["Read routes<br/>[get.js]"]
  node_postroutes["Create routes<br/>[post.js]"]
  node_putroutes["Update routes<br/>[put.js]"]
  node_deleteroutes["Delete routes<br/>[delete.js]"]
  node_pool["PostgreSQL connection pool<br/>[db.js]"]
end

node_player(("Player"))
node_postgres[("PostgreSQL")]

node_player -->|"uses"| node_app
node_app -->|"routes to"| node_landing
node_app -->|"routes to"| node_authui
node_app -->|"routes to"| node_create
node_app -->|"routes to"| node_dashboards
node_app -->|"routes to"| node_matching
node_app -->|"routes to"| node_overview
node_app -->|"reads state"| node_authstate
node_create -.->|"includes"| node_openplay
node_create -.->|"includes"| node_single
node_create -.->|"includes"| node_top2
node_create -.->|"includes"| node_top3
node_single -->|"renders"| node_singlebracket
node_top2 -->|"renders"| node_top2bracket
node_top3 -->|"renders"| node_top3bracket
node_dashboards -->|"uses"| node_singlebracket
node_dashboards -->|"uses"| node_top2bracket
node_dashboards -->|"uses"| node_top3bracket
node_authui -->|"updates"| node_authstate
node_authstate -->|"requests user"| node_api
node_theme -->|"stores preference"| node_player
node_matching -->|"requests data"| node_api
node_overview -->|"requests data"| node_api
node_singlebracket -->|"saves scores"| node_api
node_top3bracket -->|"saves scores"| node_api
node_api -.->|"sends requests"| node_server
node_server -->|"mounts"| node_authroutes
node_server -->|"mounts"| node_getroutes
node_server -->|"mounts"| node_postroutes
node_server -->|"mounts"| node_putroutes
node_server -->|"mounts"| node_deleteroutes
node_server -->|"queries"| node_pool
node_authroutes -->|"queries"| node_pool
node_authroutes -->|"protects user lookup"| node_middleware
node_middleware -->|"loads user"| node_pool
node_getroutes -->|"reads data"| node_pool
node_postroutes -->|"writes data"| node_pool
node_putroutes -->|"updates data"| node_pool
node_deleteroutes -->|"deletes data"| node_pool
node_pool -->|"connects"| node_postgres

click node_app "https://github.com/ein-shen/pikol/blob/main/frontend/src/App.jsx"
click node_landing "https://github.com/ein-shen/pikol/blob/main/frontend/src/Home.jsx"
click node_api "https://github.com/ein-shen/pikol/blob/main/frontend/src/api.js"
click node_matching "https://github.com/ein-shen/pikol/blob/main/frontend/src/user/Matching.jsx"
click node_overview "https://github.com/ein-shen/pikol/blob/main/frontend/src/user/Overview.jsx"
click node_create "https://github.com/ein-shen/pikol/tree/main/frontend/src/user/Create_select_game"
click node_openplay "https://github.com/ein-shen/pikol/blob/main/frontend/src/user/Create_select_game/OpenPlay.jsx"
click node_single "https://github.com/ein-shen/pikol/blob/main/frontend/src/user/Create_select_game/SingleElilmination.jsx"
click node_top2 "https://github.com/ein-shen/pikol/blob/main/frontend/src/user/Create_select_game/Top2_Brackets.jsx"
click node_top3 "https://github.com/ein-shen/pikol/blob/main/frontend/src/user/Create_select_game/Top3_Brackets.jsx"
click node_dashboards "https://github.com/ein-shen/pikol/tree/main/frontend/src/user/Tour_dashb"
click node_singlebracket "https://github.com/ein-shen/pikol/blob/main/frontend/src/user/bracket_lead/Bracket_Single_VIew.jsx"
click node_top2bracket "https://github.com/ein-shen/pikol/blob/main/frontend/src/user/bracket_lead/Top2_bracketing_e.jsx"
click node_top3bracket "https://github.com/ein-shen/pikol/blob/main/frontend/src/user/bracket_lead/Top3_bracketing_e.jsx"
click node_authui "https://github.com/ein-shen/pikol/blob/main/frontend/src/user/Login.jsx"
click node_authstate "https://github.com/ein-shen/pikol/blob/main/frontend/src/context/AuthContext.jsx"
click node_theme "https://github.com/ein-shen/pikol/blob/main/frontend/src/user/theme_color/ThemeContext.jsx"
click node_server "https://github.com/ein-shen/pikol/blob/main/backend/server.js"
click node_authroutes "https://github.com/ein-shen/pikol/blob/main/backend/routes/auth.js"
click node_middleware "https://github.com/ein-shen/pikol/blob/main/backend/middleware/auth.js"
click node_getroutes "https://github.com/ein-shen/pikol/blob/main/backend/routes/get.js"
click node_postroutes "https://github.com/ein-shen/pikol/blob/main/backend/routes/post.js"
click node_putroutes "https://github.com/ein-shen/pikol/blob/main/backend/routes/put.js"
click node_deleteroutes "https://github.com/ein-shen/pikol/blob/main/backend/routes/delete.js"
click node_pool "https://github.com/ein-shen/pikol/blob/main/backend/db.js"

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_landing,node_api,node_matching,node_overview toneBlue
class node_create,node_openplay,node_single,node_top2,node_top3,node_dashboards,node_singlebracket,node_top2bracket,node_top3bracket,node_postgres toneAmber
class node_authui,node_authstate,node_theme toneMint
class node_server,node_authroutes,node_middleware,node_getroutes,node_postroutes,node_putroutes,node_deleteroutes,node_pool toneRose
class node_player toneIndigo
```

## Components

### Web application

- [Routes and dashboard](https://github.com/ein-shen/pikol/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Landing page](https://github.com/ein-shen/pikol/blob/main/frontend/src/Home.jsx): `frontend/src/Home.jsx`
- [HTTP client](https://github.com/ein-shen/pikol/blob/main/frontend/src/api.js): `frontend/src/api.js`
- [Player matching](https://github.com/ein-shen/pikol/blob/main/frontend/src/user/Matching.jsx): `frontend/src/user/Matching.jsx`
- [Tournament overview](https://github.com/ein-shen/pikol/blob/main/frontend/src/user/Overview.jsx): `frontend/src/user/Overview.jsx`

### Tournament workflows

- [Tournament creation](https://github.com/ein-shen/pikol/tree/main/frontend/src/user/Create_select_game): `frontend/src/user/Create_select_game`
- [Open play](https://github.com/ein-shen/pikol/blob/main/frontend/src/user/Create_select_game/OpenPlay.jsx): `frontend/src/user/Create_select_game/OpenPlay.jsx`
- [Single elimination](https://github.com/ein-shen/pikol/blob/main/frontend/src/user/Create_select_game/SingleElilmination.jsx): `frontend/src/user/Create_select_game/SingleElilmination.jsx`
- [Top 2 format](https://github.com/ein-shen/pikol/blob/main/frontend/src/user/Create_select_game/Top2_Brackets.jsx): `frontend/src/user/Create_select_game/Top2_Brackets.jsx`
- [Top 3 format](https://github.com/ein-shen/pikol/blob/main/frontend/src/user/Create_select_game/Top3_Brackets.jsx): `frontend/src/user/Create_select_game/Top3_Brackets.jsx`
- [Tournament dashboards](https://github.com/ein-shen/pikol/tree/main/frontend/src/user/Tour_dashb): `frontend/src/user/Tour_dashb`
- [Single bracket view](https://github.com/ein-shen/pikol/blob/main/frontend/src/user/bracket_lead/Bracket_Single_VIew.jsx): `frontend/src/user/bracket_lead/Bracket_Single_VIew.jsx`
- [Top 2 bracket view](https://github.com/ein-shen/pikol/blob/main/frontend/src/user/bracket_lead/Top2_bracketing_e.jsx): `frontend/src/user/bracket_lead/Top2_bracketing_e.jsx`
- [Top 3 bracket view](https://github.com/ein-shen/pikol/blob/main/frontend/src/user/bracket_lead/Top3_bracketing_e.jsx): `frontend/src/user/bracket_lead/Top3_bracketing_e.jsx`

### Identity and preferences

- [Login and signup](https://github.com/ein-shen/pikol/blob/main/frontend/src/user/Login.jsx): `frontend/src/user/Login.jsx`
- [Authentication state](https://github.com/ein-shen/pikol/blob/main/frontend/src/context/AuthContext.jsx): `frontend/src/context/AuthContext.jsx`
- [Theme preferences](https://github.com/ein-shen/pikol/blob/main/frontend/src/user/theme_color/ThemeContext.jsx): `frontend/src/user/theme_color/ThemeContext.jsx`

### API and persistence

- [Express API](https://github.com/ein-shen/pikol/blob/main/backend/server.js): `backend/server.js`
- [Authentication routes](https://github.com/ein-shen/pikol/blob/main/backend/routes/auth.js): `backend/routes/auth.js`
- [Authentication middleware](https://github.com/ein-shen/pikol/blob/main/backend/middleware/auth.js): `backend/middleware/auth.js`
- [Read routes](https://github.com/ein-shen/pikol/blob/main/backend/routes/get.js): `backend/routes/get.js`
- [Create routes](https://github.com/ein-shen/pikol/blob/main/backend/routes/post.js): `backend/routes/post.js`
- [Update routes](https://github.com/ein-shen/pikol/blob/main/backend/routes/put.js): `backend/routes/put.js`
- [Delete routes](https://github.com/ein-shen/pikol/blob/main/backend/routes/delete.js): `backend/routes/delete.js`
- [PostgreSQL connection pool](https://github.com/ein-shen/pikol/blob/main/backend/db.js): `backend/db.js`

### Other components

- **Player**
- **PostgreSQL**

## Connections

- Player → Routes and dashboard: uses (evidence: `frontend/src/App.jsx`)
- Routes and dashboard → Landing page: routes to (evidence: `frontend/src/App.jsx`)
- Routes and dashboard → Login and signup: routes to (evidence: `frontend/src/App.jsx`)
- Routes and dashboard → Tournament creation: routes to (evidence: `frontend/src/App.jsx`)
- Routes and dashboard → Tournament dashboards: routes to (evidence: `frontend/src/App.jsx`)
- Routes and dashboard → Player matching: routes to (evidence: `frontend/src/App.jsx`)
- Routes and dashboard → Tournament overview: routes to (evidence: `frontend/src/App.jsx`)
- Routes and dashboard → Authentication state: reads state (evidence: `frontend/src/App.jsx`)
- Tournament creation → Open play: includes
- Tournament creation → Single elimination: includes
- Tournament creation → Top 2 format: includes
- Tournament creation → Top 3 format: includes
- Single elimination → Single bracket view: renders (evidence: `frontend/src/user/Create_select_game/SingleElilmination.jsx`)
- Top 2 format → Top 2 bracket view: renders (evidence: `frontend/src/user/Create_select_game/Top2_Brackets.jsx`)
- Top 3 format → Top 3 bracket view: renders (evidence: `frontend/src/user/Create_select_game/Top3_Brackets.jsx`)
- Tournament dashboards → Single bracket view: uses (evidence: `frontend/src/user/Tour_dashb/SingleDashb.jsx`)
- Tournament dashboards → Top 2 bracket view: uses (evidence: `frontend/src/user/Tour_dashb/Top2_Dashb.jsx`)
- Tournament dashboards → Top 3 bracket view: uses (evidence: `frontend/src/user/Tour_dashb/Top3_Dashb.jsx`)
- Login and signup → Authentication state: updates (evidence: `frontend/src/user/Login.jsx`)
- Authentication state → HTTP client: requests user (evidence: `frontend/src/context/AuthContext.jsx`)
- Theme preferences → Player: stores preference (evidence: `frontend/src/user/theme_color/ThemeContext.jsx`)
- Player matching → HTTP client: requests data (evidence: `frontend/src/user/Matching.jsx`)
- Tournament overview → HTTP client: requests data (evidence: `frontend/src/user/Overview.jsx`)
- Single bracket view → HTTP client: saves scores (evidence: `frontend/src/user/bracket_lead/Bracket_Single_VIew.jsx`)
- Top 3 bracket view → HTTP client: saves scores (evidence: `frontend/src/user/bracket_lead/Top3_bracketing_e.jsx`)
- HTTP client → Express API: sends requests
- Express API → Authentication routes: mounts (evidence: `backend/server.js`)
- Express API → Read routes: mounts (evidence: `backend/server.js`)
- Express API → Create routes: mounts (evidence: `backend/server.js`)
- Express API → Update routes: mounts (evidence: `backend/server.js`)
- Express API → Delete routes: mounts (evidence: `backend/server.js`)
- Express API → PostgreSQL connection pool: queries (evidence: `backend/server.js`)
- Authentication routes → PostgreSQL connection pool: queries (evidence: `backend/routes/auth.js`)
- Authentication routes → Authentication middleware: protects user lookup (evidence: `backend/routes/auth.js`)
- Authentication middleware → PostgreSQL connection pool: loads user (evidence: `backend/middleware/auth.js`)
- Read routes → PostgreSQL connection pool: reads data (evidence: `backend/routes/get.js`)
- Create routes → PostgreSQL connection pool: writes data (evidence: `backend/routes/post.js`)
- Update routes → PostgreSQL connection pool: updates data (evidence: `backend/routes/put.js`)
- Delete routes → PostgreSQL connection pool: deletes data (evidence: `backend/routes/delete.js`)
- PostgreSQL connection pool → PostgreSQL: connects (evidence: `backend/db.js`)
