# las-101/pushpace architecture

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

- Interactive diagram: https://gitdiagram.com/las-101/pushpace
- Repository: https://github.com/las-101/pushpace

## Overview

#### Purpose and Entry Points
This is a PHP-backed fitness activity tracker with static HTML frontend screens for login, dashboard, and activity-specific views. The primary browser entry point is `index.php`; authenticated user interactions are handled through API endpoints under `api/`.

Key entry points:
- `index.php`
- `frontend/login.html`
- `frontend/dashboard.html`
- `frontend/script.js`

#### Frontend Application Surface
The frontend is a multi-page browser UI rather than a bundled SPA. Separate pages represent the dashboard and activity modes, while shared JavaScript coordinates API calls and UI behavior.

Primary screens and shared assets:
- `frontend/dashboard.html`
- `frontend/running.html`
- `frontend/walking.html`
- `frontend/gym.html`
- `frontend/script.js`
- `frontend/style.css`

#### Authentication and User Identity Boundary
Authentication is isolated behind a dedicated PHP API endpoint. Client code should establish identity through this boundary before requesting or modifying profile and activity data. Session, credential, and authorization behavior are expected to be implemented server-side rather than trusted to the HTML pages.

Relevant boundary:
- `api/auth.php`
- `frontend/login.html`
- `frontend/script.js`

#### Activity Recording and Retrieval
Activity operations are separated into their own API endpoint, making activities the central domain resource. Running, walking, and gym pages likely submit or display activity-specific data through the same backend activity boundary, which should normalize storage and retrieval regardless of the originating UI page.

Relevant paths:
- `api/activities.php`
- `frontend/running.html`
- `frontend/walking.html`
- `frontend/gym.html`

#### Profile Management
User profile reads and updates are handled independently from authentication and activity tracking. This separation allows dashboard/profile presentation to evolve without coupling it to credential workflows or exercise records.

Relevant paths:
- `api/profile.php`
- `api/auth.php`
- `frontend/dashboard.html`

#### Backend Configuration and Database Persistence
PHP API handlers share a server-side configuration layer, likely including database connection setup and common runtime settings. Persistent schema is defined in SQL and is the contract connecting user/authentication, profile, and activity APIs.

Infrastructure and persistence:
- `api/config.php`
- `database.sql`
- `api/auth.php`
- `api/activities.php`
- `api/profile.php`

#### Primary Control Flow
1. A user enters through `index.php` or the login UI.
2. `frontend/script.js` sends authentication requests to `api/auth.php`.
3. Once authenticated, dashboard and activity pages request user/profile data and activity data.
4. Activity submissions flow to `api/activities.php`; profile changes flow to `api/profile.php`.
5. API handlers use `api/config.php` and persist or query records defined by `database.sql`.

The principal trust boundary is browser-to-PHP API: frontend pages are presentation clients, while authentication, validation, authorization, and database access belong in the `api/` layer.

Main entry points: [`frontend/script.js`](https://github.com/las-101/pushpace/blob/main/frontend/script.js) (Shared client logic), [`api/config.php`](https://github.com/las-101/pushpace/blob/main/api/config.php) (Server configuration), [`frontend/login.html`](https://github.com/las-101/pushpace/blob/main/frontend/login.html) (Login screen), [`api/auth.php`](https://github.com/las-101/pushpace/blob/main/api/auth.php) (Authentication API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_browser["Browser UI"]
  node_login["Login screen<br/>HTML page<br/>[login.html]"]
  node_dashboard["Dashboard<br/>HTML page<br/>[dashboard.html]"]
  node_running["Running view<br/>HTML page<br/>[running.html]"]
  node_walking["Walking view<br/>HTML page<br/>[walking.html]"]
  node_gym["Gym view<br/>HTML page<br/>[gym.html]"]
  node_client_js["Shared client logic<br/>JavaScript<br/>[script.js]"]
end

subgraph group_api["PHP API"]
  node_auth_api{{"Authentication API<br/>PHP endpoint<br/>[auth.php]"}}
  node_activities_api["Activities API<br/>PHP endpoint<br/>[activities.php]"]
  node_profile_api["Profile API<br/>PHP endpoint<br/>[profile.php]"]
  node_config["Server configuration<br/>PHP configuration<br/>[config.php]"]
end

node_index["PHP entry point<br/>[index.php]"]
node_database[("Database schema<br/>SQL schema<br/>[database.sql]")]

node_index -->|"enters via"| node_login
node_login -->|"uses"| node_client_js
node_dashboard -->|"uses"| node_client_js
node_running -->|"uses"| node_client_js
node_walking -->|"uses"| node_client_js
node_gym -->|"uses"| node_client_js
node_client_js -->|"authenticates"| node_auth_api
node_client_js -->|"reads and updates profile"| node_profile_api
node_client_js -->|"retrieves and submits activities"| node_activities_api
node_auth_api -->|"uses"| node_config
node_activities_api -->|"uses"| node_config
node_profile_api -->|"uses"| node_config
node_config -->|"connects to"| node_database

click node_index "https://github.com/las-101/pushpace/blob/main/index.php"
click node_login "https://github.com/las-101/pushpace/blob/main/frontend/login.html"
click node_dashboard "https://github.com/las-101/pushpace/blob/main/frontend/dashboard.html"
click node_running "https://github.com/las-101/pushpace/blob/main/frontend/running.html"
click node_walking "https://github.com/las-101/pushpace/blob/main/frontend/walking.html"
click node_gym "https://github.com/las-101/pushpace/blob/main/frontend/gym.html"
click node_client_js "https://github.com/las-101/pushpace/blob/main/frontend/script.js"
click node_auth_api "https://github.com/las-101/pushpace/blob/main/api/auth.php"
click node_activities_api "https://github.com/las-101/pushpace/blob/main/api/activities.php"
click node_profile_api "https://github.com/las-101/pushpace/blob/main/api/profile.php"
click node_config "https://github.com/las-101/pushpace/blob/main/api/config.php"
click node_database "https://github.com/las-101/pushpace/blob/main/database.sql"

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_login,node_dashboard,node_running,node_walking,node_gym,node_client_js toneBlue
class node_auth_api,node_activities_api,node_profile_api,node_config toneAmber
class node_index,node_database toneNeutral
```

## Components

### Browser UI

Static multi-page presentation client.

- [Login screen](https://github.com/las-101/pushpace/blob/main/frontend/login.html): HTML page · `frontend/login.html`
- [Dashboard](https://github.com/las-101/pushpace/blob/main/frontend/dashboard.html): HTML page · `frontend/dashboard.html`
- [Running view](https://github.com/las-101/pushpace/blob/main/frontend/running.html): HTML page · `frontend/running.html`
- [Walking view](https://github.com/las-101/pushpace/blob/main/frontend/walking.html): HTML page · `frontend/walking.html`
- [Gym view](https://github.com/las-101/pushpace/blob/main/frontend/gym.html): HTML page · `frontend/gym.html`
- [Shared client logic](https://github.com/las-101/pushpace/blob/main/frontend/script.js): JavaScript · Coordinates UI behavior and API calls. · `frontend/script.js`

### PHP API

Server-side trust and data boundary.

- [Authentication API](https://github.com/las-101/pushpace/blob/main/api/auth.php): PHP endpoint · Establishes identity and enforces authentication. · `api/auth.php`
- [Activities API](https://github.com/las-101/pushpace/blob/main/api/activities.php): PHP endpoint · Normalizes activity recording and retrieval. · `api/activities.php`
- [Profile API](https://github.com/las-101/pushpace/blob/main/api/profile.php): PHP endpoint · Handles user profile reads and updates. · `api/profile.php`
- [Server configuration](https://github.com/las-101/pushpace/blob/main/api/config.php): PHP configuration · Shared database connection and runtime settings. · `api/config.php`

### Other components

- [PHP entry point](https://github.com/las-101/pushpace/blob/main/index.php): entry point · `index.php`
- [Database schema](https://github.com/las-101/pushpace/blob/main/database.sql): SQL schema · Persistence contract for users, profiles, and activities. · `database.sql`

## Connections

- PHP entry point → Login screen: enters via
- Login screen → Shared client logic: uses
- Dashboard → Shared client logic: uses
- Running view → Shared client logic: uses
- Walking view → Shared client logic: uses
- Gym view → Shared client logic: uses
- Shared client logic → Authentication API: authenticates
- Shared client logic → Profile API: reads and updates profile
- Shared client logic → Activities API: retrieves and submits activities
- Authentication API → Server configuration: uses
- Activities API → Server configuration: uses
- Profile API → Server configuration: uses
- Server configuration → Database schema: connects to
