# besoda/ecoquest architecture

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

- Interactive diagram: https://gitdiagram.com/besoda/ecoquest
- Repository: https://github.com/besoda/ecoquest

## Overview

EcoQuest is a role-based sustainability challenge platform: participants discover challenges, submit proof, and earn points; organizers publish challenges; moderators review submissions; and administrators manage the platform. The graph preserves these distinct product areas and shared services. Several page and handler implementations are unsampled, so their internal transitions are not inferred; cited links are limited to relationships shown in excerpts or the source index.

Main entry points: [`actions/review_submission_handler.php`](https://github.com/besoda/ecoquest/blob/main/actions/review_submission_handler.php) (Review decision), [`includes/participant_functions.php`](https://github.com/besoda/ecoquest/blob/main/includes/participant_functions.php) (Participant data helpers), [`actions/create_challenge_handler.php`](https://github.com/besoda/ecoquest/blob/main/actions/create_challenge_handler.php) (Publish challenge), [`config/db_connect.php`](https://github.com/besoda/ecoquest/blob/main/config/db_connect.php) (EcoQuest database)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_participation["Participant journey"]
  node_participant_browse["Challenge discovery"]
  node_participant_join["Challenge participation<br/>[join_challenge.php]"]
  node_participant_proof["Proof submission<br/>[submit_proof.php]"]
  node_participant_progress["Progress and rewards"]
end

subgraph group_challenge_ops["Challenge operations"]
  node_organizer_wizard["Challenge authoring"]
  node_challenge_publish["Publish challenge"]
  node_organizer_reports["Participation reports"]
  node_stepper["Wizard stepper"]
end

subgraph group_review_admin["Review and administration"]
  node_moderator_review["Submission review"]
  node_review_handler["Review decision"]
  node_admin_tools["Administration"]
end

subgraph group_shared["Shared platform"]
  node_auth_pages["Account access"]
  node_database[("EcoQuest database<br/>[db_connect.php]")]
  node_public_queries["Shared query helpers"]
  node_participant_queries["Participant data helpers"]
  node_progress_rules["Progress rules<br/>[progress.php]"]
  node_moderation_rules["Moderation helpers<br/>[moderation.php]"]
  node_auth_guard["Session and role guards<br/>[auth_check.php]"]
  node_settings["Site settings<br/>[settings.php]"]
  node_upload["Evidence uploads<br/>[upload.php]"]
  node_flash["Flash and redirects<br/>[flash.php]"]
  node_app_header["Logged-in shell<br/>[app_header.php]"]
end

node_participant(("Participant"))

node_participant -->|"signs in"| node_auth_pages
node_participant -.->|"browses"| node_participant_browse
node_participant -.->|"submits proof"| node_participant_proof
node_participant_browse -.->|"loads challenges"| node_participant_queries
node_participant_proof -.->|"stores evidence"| node_upload
node_organizer_wizard -->|"renders steps"| node_stepper
node_organizer_wizard -.->|"publishes"| node_challenge_publish
node_challenge_publish -->|"writes challenge"| node_database
node_challenge_publish -->|"checks role"| node_auth_guard
node_challenge_publish -->|"uses helpers"| node_public_queries
node_challenge_publish -->|"sets messages"| node_flash
node_moderator_review -.->|"submits decision"| node_review_handler
node_review_handler -->|"updates records"| node_database
node_review_handler -->|"checks role"| node_auth_guard
node_review_handler -->|"uses helpers"| node_participant_queries
node_review_handler -->|"updates progress"| node_progress_rules
node_review_handler -->|"uses rules"| node_moderation_rules
node_review_handler -->|"sets messages"| node_flash
node_review_handler -.->|"notifies participant"| node_participant_progress
node_auth_guard -->|"checks account"| node_database
node_participant_queries -->|"uses queries"| node_public_queries
node_progress_rules -->|"uses helpers"| node_participant_queries
node_moderation_rules -->|"uses helpers"| node_participant_queries
node_settings -->|"loads settings"| node_public_queries
node_settings -->|"reads and writes"| node_database
node_upload -->|"uses limits"| node_settings
node_app_header -->|"loads user data"| node_participant_queries
node_app_header -->|"loads settings"| node_settings
node_app_header -->|"shows messages"| node_flash
node_admin_tools -.->|"manages records"| node_database

click node_auth_pages "https://github.com/besoda/ecoquest/tree/main/auth"
click node_participant_browse "https://github.com/besoda/ecoquest/blob/main/participant/browse_challenges.php"
click node_participant_join "https://github.com/besoda/ecoquest/blob/main/actions/join_challenge.php"
click node_participant_proof "https://github.com/besoda/ecoquest/blob/main/actions/submit_proof.php"
click node_participant_progress "https://github.com/besoda/ecoquest/tree/main/participant"
click node_organizer_wizard "https://github.com/besoda/ecoquest/tree/main/organizer"
click node_challenge_publish "https://github.com/besoda/ecoquest/blob/main/actions/create_challenge_handler.php"
click node_organizer_reports "https://github.com/besoda/ecoquest/blob/main/organizer/participation_reports.php"
click node_moderator_review "https://github.com/besoda/ecoquest/blob/main/moderator/review_submission.php"
click node_review_handler "https://github.com/besoda/ecoquest/blob/main/actions/review_submission_handler.php"
click node_admin_tools "https://github.com/besoda/ecoquest/tree/main/admin"
click node_database "https://github.com/besoda/ecoquest/blob/main/config/db_connect.php"
click node_public_queries "https://github.com/besoda/ecoquest/blob/main/includes/public_functions.php"
click node_participant_queries "https://github.com/besoda/ecoquest/blob/main/includes/participant_functions.php"
click node_progress_rules "https://github.com/besoda/ecoquest/blob/main/includes/progress.php"
click node_moderation_rules "https://github.com/besoda/ecoquest/blob/main/includes/moderation.php"
click node_auth_guard "https://github.com/besoda/ecoquest/blob/main/includes/auth_check.php"
click node_settings "https://github.com/besoda/ecoquest/blob/main/includes/settings.php"
click node_upload "https://github.com/besoda/ecoquest/blob/main/includes/upload.php"
click node_flash "https://github.com/besoda/ecoquest/blob/main/includes/flash.php"
click node_app_header "https://github.com/besoda/ecoquest/blob/main/includes/app_header.php"
click node_stepper "https://github.com/besoda/ecoquest/blob/main/includes/challenge_stepper.php"

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_participant_browse,node_participant_join,node_participant_proof,node_participant_progress toneBlue
class node_organizer_wizard,node_challenge_publish,node_organizer_reports,node_stepper toneAmber
class node_moderator_review,node_review_handler,node_admin_tools toneMint
class node_auth_pages,node_database,node_public_queries,node_participant_queries,node_progress_rules,node_moderation_rules,node_auth_guard,node_settings,node_upload,node_flash,node_app_header toneRose
class node_participant toneIndigo
```

## Components

### Participant journey

- [Challenge discovery](https://github.com/besoda/ecoquest/blob/main/participant/browse_challenges.php): `participant/browse_challenges.php`
- [Challenge participation](https://github.com/besoda/ecoquest/blob/main/actions/join_challenge.php): `actions/join_challenge.php`
- [Proof submission](https://github.com/besoda/ecoquest/blob/main/actions/submit_proof.php): `actions/submit_proof.php`
- [Progress and rewards](https://github.com/besoda/ecoquest/tree/main/participant): `participant`

### Challenge operations

- [Challenge authoring](https://github.com/besoda/ecoquest/tree/main/organizer): `organizer`
- [Publish challenge](https://github.com/besoda/ecoquest/blob/main/actions/create_challenge_handler.php): `actions/create_challenge_handler.php`
- [Participation reports](https://github.com/besoda/ecoquest/blob/main/organizer/participation_reports.php): `organizer/participation_reports.php`
- [Wizard stepper](https://github.com/besoda/ecoquest/blob/main/includes/challenge_stepper.php): `includes/challenge_stepper.php`

### Review and administration

- [Submission review](https://github.com/besoda/ecoquest/blob/main/moderator/review_submission.php): `moderator/review_submission.php`
- [Review decision](https://github.com/besoda/ecoquest/blob/main/actions/review_submission_handler.php): `actions/review_submission_handler.php`
- [Administration](https://github.com/besoda/ecoquest/tree/main/admin): `admin`

### Shared platform

- [Account access](https://github.com/besoda/ecoquest/tree/main/auth): `auth`
- [EcoQuest database](https://github.com/besoda/ecoquest/blob/main/config/db_connect.php): `config/db_connect.php`
- [Shared query helpers](https://github.com/besoda/ecoquest/blob/main/includes/public_functions.php): `includes/public_functions.php`
- [Participant data helpers](https://github.com/besoda/ecoquest/blob/main/includes/participant_functions.php): `includes/participant_functions.php`
- [Progress rules](https://github.com/besoda/ecoquest/blob/main/includes/progress.php): `includes/progress.php`
- [Moderation helpers](https://github.com/besoda/ecoquest/blob/main/includes/moderation.php): `includes/moderation.php`
- [Session and role guards](https://github.com/besoda/ecoquest/blob/main/includes/auth_check.php): `includes/auth_check.php`
- [Site settings](https://github.com/besoda/ecoquest/blob/main/includes/settings.php): `includes/settings.php`
- [Evidence uploads](https://github.com/besoda/ecoquest/blob/main/includes/upload.php): `includes/upload.php`
- [Flash and redirects](https://github.com/besoda/ecoquest/blob/main/includes/flash.php): `includes/flash.php`
- [Logged-in shell](https://github.com/besoda/ecoquest/blob/main/includes/app_header.php): `includes/app_header.php`

### Other components

- **Participant**

## Connections

- Participant → Account access: signs in (evidence: `auth/login.php`)
- Participant → Challenge discovery: browses
- Participant → Proof submission: submits proof
- Challenge discovery → Participant data helpers: loads challenges
- Proof submission → Evidence uploads: stores evidence
- Challenge authoring → Wizard stepper: renders steps (evidence: `organizer/create_challenge_review.php`)
- Challenge authoring → Publish challenge: publishes
- Publish challenge → EcoQuest database: writes challenge (evidence: `actions/create_challenge_handler.php`)
- Publish challenge → Session and role guards: checks role (evidence: `actions/create_challenge_handler.php`)
- Publish challenge → Shared query helpers: uses helpers (evidence: `actions/create_challenge_handler.php`)
- Publish challenge → Flash and redirects: sets messages (evidence: `actions/create_challenge_handler.php`)
- Submission review → Review decision: submits decision
- Review decision → EcoQuest database: updates records (evidence: `actions/review_submission_handler.php`)
- Review decision → Session and role guards: checks role (evidence: `actions/review_submission_handler.php`)
- Review decision → Participant data helpers: uses helpers (evidence: `actions/review_submission_handler.php`)
- Review decision → Progress rules: updates progress (evidence: `actions/review_submission_handler.php`)
- Review decision → Moderation helpers: uses rules (evidence: `actions/review_submission_handler.php`)
- Review decision → Flash and redirects: sets messages (evidence: `actions/review_submission_handler.php`)
- Review decision → Progress and rewards: notifies participant
- Session and role guards → EcoQuest database: checks account (evidence: `includes/auth_check.php`)
- Participant data helpers → Shared query helpers: uses queries (evidence: `includes/participant_functions.php`)
- Progress rules → Participant data helpers: uses helpers (evidence: `includes/progress.php`)
- Moderation helpers → Participant data helpers: uses helpers (evidence: `includes/moderation.php`)
- Site settings → Shared query helpers: loads settings (evidence: `includes/settings.php`)
- Site settings → EcoQuest database: reads and writes (evidence: `includes/settings.php`)
- Evidence uploads → Site settings: uses limits (evidence: `includes/upload.php`)
- Logged-in shell → Participant data helpers: loads user data (evidence: `includes/app_header.php`)
- Logged-in shell → Site settings: loads settings (evidence: `includes/app_header.php`)
- Logged-in shell → Flash and redirects: shows messages (evidence: `includes/app_header.php`)
- Administration → EcoQuest database: manages records (evidence: `admin/user_detail.php`)
