# notpradip/football-scoreboard-for-obs architecture

> Architecture diagram of the GitHub repository notpradip/football-scoreboard-for-obs, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-04-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/notpradip/football-scoreboard-for-obs
- Repository: https://github.com/notpradip/football-scoreboard-for-obs

## Overview

1. **Overall shape**  
   This is a small PHP/MySQL web application for managing a live football scoreboard. The architecture is split into a private admin/control side and a public display side intended for OBS Browser Source.

2. **Main runtime boundary**  
   The app runs on a standard PHP web server with a MySQL/MariaDB database. There is no separate backend service or build pipeline; the PHP pages handle both presentation and server-side logic.

3. **Administrative workflow**  
   `signup.php`, `login.php`, `logout.php`, and `dashboard.php` form the authenticated control path. Users create an account, log in, and are redirected to the dashboard where they can edit team names and scores.

4. **Public scoreboard path**  
   `score.php` is the public-facing display page used in OBS. It is accessed through a unique token in the URL, which is the privacy boundary preventing viewers from reaching the admin UI.

5. **Data access/API-like layer**  
   `data.php` is the data retrieval endpoint for the scoreboard state. It uses the token to fetch the correct scoreboard record from the database and supplies the display page with current values.

6. **Database model**  
   `user.sql` contains the schema and seed structure. Based on the README, the database stores user accounts, scoreboard data, and the unique tokens that map a display URL to a specific scoreboard.

7. **Shared application logic**  
   `function.php` likely holds reusable PHP helpers such as authentication checks, database queries, token generation, or scoreboard update logic. This is the main shared code boundary across the page scripts.

8. **Configuration boundary**  
   `connects/config.php` contains the database connection credentials. That file is the deployment-specific configuration point separating code from environment setup.

9. **Client-side rendering and live updating**  
   `js/main.js` and `js/popper.js` support the browser-side behavior, while `css/style.css` and Bootstrap/Font assets provide the UI. The score display is designed to update live for broadcasts, so the front end likely refreshes or polls scoreboard data rather than relying on a separate push service.

10. **External integration**  
   OBS Studio is an external consumer of the public scoreboard URL. In the architecture diagram, it should be shown as a browser client pointing at `score.php?token=...`, not as a system component that talks directly to the database.

11. **Security and access boundaries**  
   Authentication protects the dashboard and score editing actions. The tokenized public URL exposes only the scoreboard view, while update privileges remain restricted to logged-in users.

12. **What to diagram as core flows**  
   The important flows are: account creation/login to establish an authenticated session; dashboard updates writing score/team data to MySQL; score display reading the same data through a tokenized endpoint; OBS rendering that public page during the broadcast.

Main entry points: [`function.php`](https://github.com/notpradip/football-scoreboard-for-obs/blob/main/function.php) (Helpers), [`dashboard.php`](https://github.com/notpradip/football-scoreboard-for-obs/blob/main/dashboard.php) (Dashboard), [`score.php`](https://github.com/notpradip/football-scoreboard-for-obs/blob/main/score.php) (Score view), [`data.php`](https://github.com/notpradip/football-scoreboard-for-obs/blob/main/data.php) (Data endpoint)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_group_admin["Admin control"]
  node_node_signup["Signup<br/>PHP auth page<br/>[signup.php]"]
  node_node_login["Login<br/>PHP auth page<br/>[login.php]"]
  node_node_logout["Logout<br/>PHP session page<br/>[logout.php]"]
  node_node_dashboard["Dashboard<br/>PHP control page<br/>[dashboard.php]"]
end

subgraph group_group_public["Public display"]
  node_node_score["Score view<br/>PHP public page<br/>[score.php]"]
  node_node_data["Data endpoint<br/>PHP read endpoint<br/>[data.php]"]
  node_node_obs(("OBS<br/>browser client"))
end

subgraph group_group_shared["Shared app core"]
  node_node_function["Helpers<br/>PHP shared logic<br/>[function.php]"]
  node_node_config["Config<br/>[config.php]"]
  node_node_schema[("Schema<br/>[user.sql]")]
  node_node_mysql[("MySQL<br/>database")]
end

subgraph group_group_frontend["Browser assets"]
  node_node_js_main["Main JS<br/>browser script<br/>[main.js]"]
  node_node_js_popper["Popper<br/>vendor script<br/>[popper.js]"]
  node_node_css["Styles<br/>[style.css]"]
  node_node_bootstrap["Bootstrap<br/>ui framework<br/>[_table-row.css]"]
  node_node_fonts["Icons<br/>font asset<br/>[ionicons.eot]"]
end

node_node_signup -->|"uses"| node_node_function
node_node_login -->|"uses"| node_node_function
node_node_logout -->|"uses"| node_node_function
node_node_dashboard -->|"uses"| node_node_function
node_node_score -->|"loads"| node_node_data
node_node_data -->|"uses"| node_node_function
node_node_function -->|"reads"| node_node_config
node_node_function -->|"queries"| node_node_mysql
node_node_schema -->|"defines"| node_node_mysql
node_node_dashboard -->|"writes"| node_node_mysql
node_node_data -->|"reads"| node_node_mysql
node_node_score -->|"uses"| node_node_js_main
node_node_score -->|"styles"| node_node_css
node_node_dashboard -->|"styles"| node_node_css
node_node_dashboard -->|"uses"| node_node_js_main
node_node_js_main -->|"depends on"| node_node_js_popper
node_node_score -->|"renders in"| node_node_obs

click node_node_signup "https://github.com/notpradip/football-scoreboard-for-obs/blob/main/signup.php"
click node_node_login "https://github.com/notpradip/football-scoreboard-for-obs/blob/main/login.php"
click node_node_logout "https://github.com/notpradip/football-scoreboard-for-obs/blob/main/logout.php"
click node_node_dashboard "https://github.com/notpradip/football-scoreboard-for-obs/blob/main/dashboard.php"
click node_node_score "https://github.com/notpradip/football-scoreboard-for-obs/blob/main/score.php"
click node_node_data "https://github.com/notpradip/football-scoreboard-for-obs/blob/main/data.php"
click node_node_function "https://github.com/notpradip/football-scoreboard-for-obs/blob/main/function.php"
click node_node_config "https://github.com/notpradip/football-scoreboard-for-obs/blob/main/connects/config.php"
click node_node_schema "https://github.com/notpradip/football-scoreboard-for-obs/blob/main/user.sql"
click node_node_js_main "https://github.com/notpradip/football-scoreboard-for-obs/blob/main/js/main.js"
click node_node_js_popper "https://github.com/notpradip/football-scoreboard-for-obs/blob/main/js/popper.js"
click node_node_css "https://github.com/notpradip/football-scoreboard-for-obs/blob/main/css/style.css"
click node_node_bootstrap "https://github.com/notpradip/football-scoreboard-for-obs/blob/main/css/bootstrap/mixins/_table-row.css"
click node_node_fonts "https://github.com/notpradip/football-scoreboard-for-obs/blob/main/fonts/ionicons/fonts/ionicons.eot"

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_node_signup,node_node_login,node_node_logout,node_node_dashboard toneBlue
class node_node_score,node_node_data,node_node_obs toneAmber
class node_node_function,node_node_config,node_node_schema,node_node_mysql toneMint
class node_node_js_main,node_node_js_popper,node_node_css,node_node_bootstrap,node_node_fonts toneRose
```

## Components

### Admin control

Authenticated workflow for managing the scoreboard.

- [Signup](https://github.com/notpradip/football-scoreboard-for-obs/blob/main/signup.php): PHP auth page · Creates user accounts for the control side. · `signup.php`
- [Login](https://github.com/notpradip/football-scoreboard-for-obs/blob/main/login.php): PHP auth page · Authenticates users and starts the control session. · `login.php`
- [Logout](https://github.com/notpradip/football-scoreboard-for-obs/blob/main/logout.php): PHP session page · Ends the authenticated control session. · `logout.php`
- [Dashboard](https://github.com/notpradip/football-scoreboard-for-obs/blob/main/dashboard.php): PHP control page · Main admin surface for editing teams and scores. · `dashboard.php`

### Public display

Tokenized view used by OBS and viewers.

- [Score view](https://github.com/notpradip/football-scoreboard-for-obs/blob/main/score.php): PHP public page · Tokenized public scoreboard rendered in the browser/OBS. · `score.php`
- [Data endpoint](https://github.com/notpradip/football-scoreboard-for-obs/blob/main/data.php): PHP read endpoint · Fetches the current scoreboard state by token. · `data.php`
- **OBS**: browser client · External browser source consumer of the public scoreboard.

### Shared app core

Common PHP logic, configuration, and persistence.

- [Helpers](https://github.com/notpradip/football-scoreboard-for-obs/blob/main/function.php): PHP shared logic · Reusable application logic for auth, data access, and updates. · `function.php`
- [Config](https://github.com/notpradip/football-scoreboard-for-obs/blob/main/connects/config.php): DB config · Deployment-specific database connection settings. · `connects/config.php`
- [Schema](https://github.com/notpradip/football-scoreboard-for-obs/blob/main/user.sql): SQL schema · Database tables for users, scoreboards, and tokens. · `user.sql`
- **MySQL**: database · Persistent storage for application state.

### Browser assets

Client-side UI and styling used by the pages.

- [Main JS](https://github.com/notpradip/football-scoreboard-for-obs/blob/main/js/main.js): browser script · Client-side behavior for the pages and live updates. · `js/main.js`
- [Popper](https://github.com/notpradip/football-scoreboard-for-obs/blob/main/js/popper.js): vendor script · Frontend dependency bundled with the browser assets. · `js/popper.js`
- [Styles](https://github.com/notpradip/football-scoreboard-for-obs/blob/main/css/style.css): stylesheet · Application styling for the dashboard and display. · `css/style.css`
- [Bootstrap](https://github.com/notpradip/football-scoreboard-for-obs/blob/main/css/bootstrap/mixins/_table-row.css): ui framework · Shared CSS framework assets used by the UI. · `css/bootstrap/mixins/_table-row.css`
- [Icons](https://github.com/notpradip/football-scoreboard-for-obs/blob/main/fonts/ionicons/fonts/ionicons.eot): font asset · Icon font assets used by the browser UI. · `fonts/ionicons/fonts/ionicons.eot`

## Connections

- Signup → Helpers: uses · Signup relies on shared validation and account logic.
- Login → Helpers: uses · Login relies on shared authentication helpers.
- Logout → Helpers: uses · Logout uses shared session handling.
- Dashboard → Helpers: uses · Dashboard uses shared auth and scoreboard update logic.
- Score view → Data endpoint: loads · The public view fetches live scoreboard state.
- Data endpoint → Helpers: uses · Data endpoint uses shared token lookup and read logic.
- Helpers → Config: reads · Shared code uses the database connection settings.
- Helpers → MySQL: queries · Shared logic performs reads and writes against MySQL.
- Schema → MySQL: defines · The SQL file defines the persistent database structure.
- Dashboard → MySQL: writes · Admin edits persist scoreboard changes to the database.
- Data endpoint → MySQL: reads · Score data is loaded from persistent storage.
- Score view → Main JS: uses · The display page uses browser-side behavior.
- Score view → Styles: styles · The public page uses the shared stylesheet.
- Dashboard → Styles: styles · The admin UI uses the shared stylesheet.
- Dashboard → Main JS: uses · Admin interactions are supported by browser script.
- Main JS → Popper: depends on · Main browser script relies on Popper bundle support.
- Score view → OBS: renders in · OBS loads the public scoreboard as a browser source.
