# dordhak/vert---a-recycling-app architecture

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

- Interactive diagram: https://gitdiagram.com/dordhak/vert---a-recycling-app
- Repository: https://github.com/dordhak/vert---a-recycling-app

## Overview

1. **Project shape**
   - This is a **Flutter application** named `my_app`, built to run on **mobile, web, and desktop**.
   - The repository is organized as a single client app plus a **Supabase-backed database/auth layer** under `supabase/`.

2. **Application entry and shell**
   - `lib/main.dart` is the runtime entry point.
   - It boots the app shell in `lib/app/vert_app.dart` and applies global styling from `lib/app/vert_theme.dart`.
   - `lib/config/supabase_config.dart` is the client-side boundary for connecting the Flutter app to Supabase.

3. **Primary product domain**
   - The model names show the app is centered on a **waste/recycling management workflow**.
   - Core concepts include `recycling_submission`, `recycling_center`, `waste_type`, `education_guide`, `finance_settings`, `user_profile`, `user_role`, `submission_status`, and `staff_approval_status`.
   - This suggests a system where residents submit recycling requests, staff review them, and admins manage centers/settings.

4. **Presentation layer**
   - UI is split by user role and feature area in `lib/screens/`.
   - Role-specific dashboards live in:
     - `admin_dashboard.dart`
     - `staff_dashboard.dart`
     - `resident_dashboard.dart`
   - `home_screen.dart` and `login_screen.dart` provide the top-level navigation and authentication entry points.
   - `lib/screens/features/feature_pages.dart` likely hosts feature detail views beyond the dashboards.

5. **Forms and user actions**
   - User input flows are concentrated in `lib/widgets/forms/`.
   - `submission_form.dart` handles recycling submissions, `center_form.dart` manages center data, and `profile_form.dart` handles user profile updates.
   - These forms are the main mutation boundary from UI into the data layer.

6. **Data access boundary**
   - `lib/repositories/vert_repository.dart` is the central abstraction for reading/writing app data.
   - This repository likely coordinates all Supabase-backed operations for profiles, submissions, centers, guides, and settings.
   - Architecturally, it separates UI concerns from persistence and keeps Supabase usage out of screens/widgets.

7. **Authentication boundary**
   - `lib/services/supabase_auth_service.dart` encapsulates Supabase authentication.
   - It likely manages sign-in/sign-out and session state, while the rest of the app consumes authenticated user state through the repository/UI layer.
   - `user_role` and `staff_approval_status` indicate authorization is role-driven, not just login-driven.

8. **Backend and database layer**
   - The `supabase/` directory contains the backend definition and maintenance scripts:
     - `schema.sql` for the core schema
     - `bootstrap_first_admin.sql` for initial admin setup
     - `install_auth_profile_trigger.sql` for automatic profile creation or sync
     - `upgrade_existing.sql` for migrations/upgrades
     - `check_database.sql` for validation
   - This is the main persistent system of record for the app.

9. **Backend lifecycle/data flow**
   - Typical flow is: **Flutter UI → repository/service → Supabase auth or Postgres tables → UI refresh**.
   - Authentication likely happens first, then the app loads the user profile and role, which determines whether the resident, staff, or admin dashboard is shown.
   - Submission and center management flows likely write to Supabase tables and then rehydrate the UI from repository queries.

10. **Cross-platform and native integration**
   - The platform folders (`android`, `ios`, `web`, `windows`, `macos`, `linux`) are standard Flutter wrappers, but one notable app-specific boundary is the map abstraction in `lib/widgets/location/`.
   - `center_map_platform.dart` with `*_web.dart` and `*_stub.dart` indicates **platform-specific map rendering** behind a common interface.
   - `center_location_panel.dart` appears to combine map/location display with center details.

11. **Reusable UI system**
   - Shared visual building blocks live in `lib/widgets/shared/` and `lib/widgets/tiles/`.
   - These include metric cards, pills/status indicators, section titles, empty states, and domain tiles for centers, guides, submissions, and material bars.
   - This indicates the dashboards are assembled from reusable components rather than bespoke screen-only UI.

12. **Supporting data and utility code**
   - `lib/data/vert_seed.dart` provides seed/sample content for the app’s domain.
   - `lib/utils/staff_request_id.dart` suggests helper logic for staff-side request handling or identifier generation.
   - `lib/models/vert_models.dart` likely aggregates exports for the model layer.

13. **Operational/testing surface**
   - `test/widget_test.dart` is the only visible automated test entry point in the tree, so test coverage appears light.
   - The rest of the repo is mostly generated platform scaffolding, with the architectural “center of gravity” in Flutter UI + Supabase backend.

Main entry points: [`lib/app/vert_app.dart`](https://github.com/dordhak/vert---a-recycling-app/blob/main/lib/app/vert_app.dart) (App shell), [`supabase/schema.sql`](https://github.com/dordhak/vert---a-recycling-app/blob/main/supabase/schema.sql) (Schema), [`lib/screens/home_screen.dart`](https://github.com/dordhak/vert---a-recycling-app/blob/main/lib/screens/home_screen.dart) (Home & login), [`lib/services/supabase_auth_service.dart`](https://github.com/dordhak/vert---a-recycling-app/blob/main/lib/services/supabase_auth_service.dart) (Auth service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Flutter app"]
  node_main(("Main<br/>entrypoint<br/>[main.dart]"))
  node_app_shell["App shell<br/>[vert_app.dart]"]
  node_theme["Theme<br/>styling<br/>[vert_theme.dart]"]
  node_supabase_config["Supabase config<br/>client boundary"]
  node_auth_service["Auth service"]
  node_repository["Repository<br/>data access"]
  node_models["Domain models<br/>entities<br/>[vert_models.dart]"]
  node_resident_dash["Resident dash<br/>dashboard"]
  node_staff_dash["Staff dash<br/>dashboard"]
  node_admin_dash["Admin dash<br/>dashboard"]
  node_home_login["Home & login<br/>navigation<br/>[home_screen.dart]"]
  node_feature_pages["Feature pages<br/>screens<br/>[feature_pages.dart]"]
  node_submission_form["Submission form"]
  node_center_form["Center form<br/>[center_form.dart]"]
  node_profile_form["Profile form<br/>[profile_form.dart]"]
  node_center_map["Center map<br/>location"]
  node_center_panel["Location panel<br/>location UI"]
  node_shared_ui["Shared UI<br/>components"]
  node_tiles["Domain tiles<br/>cards"]
  node_seed_data["Seed data<br/>sample data<br/>[vert_seed.dart]"]
  node_utils["Utilities<br/>helpers"]
end

subgraph group_backend["Supabase backend"]
  node_schema[("Schema<br/>[schema.sql]")]
  node_bootstrap_admin["Bootstrap admin<br/>sql script"]
  node_profile_trigger["Profile trigger<br/>sql script"]
  node_migration["Upgrade script<br/>sql migration"]
  node_db_check["DB check<br/>validation script<br/>[check_database.sql]"]
end

subgraph group_platform["Platform shells"]
  node_android["Android<br/>platform shell"]
  node_ios["iOS<br/>platform shell"]
  node_web["Web<br/>platform shell"]
  node_desktop["Desktop<br/>platform shell"]
end

node_main -->|"boots"| node_app_shell
node_app_shell -->|"uses"| node_theme
node_app_shell -->|"configures"| node_supabase_config
node_supabase_config -->|"supports"| node_auth_service
node_auth_service -->|"feeds session"| node_repository
node_repository -->|"reads/writes"| node_models
node_repository -->|"persists to"| node_schema
node_auth_service -->|"authenticates via"| node_schema
node_home_login -->|"signs in"| node_auth_service
node_home_login -->|"routes to"| node_resident_dash
node_home_login -->|"routes to"| node_staff_dash
node_home_login -->|"routes to"| node_admin_dash
node_resident_dash -->|"creates"| node_submission_form
node_staff_dash -->|"reviews"| node_feature_pages
node_admin_dash -->|"manages"| node_center_form
node_admin_dash -->|"updates"| node_profile_form
node_feature_pages -->|"shows"| node_center_panel
node_center_panel -->|"renders"| node_center_map
node_shared_ui -->|"contains"| node_tiles
node_tiles -->|"composes"| node_resident_dash
node_seed_data -->|"seeds"| node_models
node_schema -->|"includes"| node_bootstrap_admin
node_schema -->|"includes"| node_profile_trigger
node_schema -->|"evolves via"| node_migration
node_schema -->|"validated by"| node_db_check
node_android -.->|"hosts"| node_app_shell
node_ios -.->|"hosts"| node_app_shell
node_web -.->|"hosts"| node_app_shell
node_desktop -.->|"hosts"| node_app_shell

click node_main "https://github.com/dordhak/vert---a-recycling-app/blob/main/lib/main.dart"
click node_app_shell "https://github.com/dordhak/vert---a-recycling-app/blob/main/lib/app/vert_app.dart"
click node_theme "https://github.com/dordhak/vert---a-recycling-app/blob/main/lib/app/vert_theme.dart"
click node_supabase_config "https://github.com/dordhak/vert---a-recycling-app/blob/main/lib/config/supabase_config.dart"
click node_auth_service "https://github.com/dordhak/vert---a-recycling-app/blob/main/lib/services/supabase_auth_service.dart"
click node_repository "https://github.com/dordhak/vert---a-recycling-app/blob/main/lib/repositories/vert_repository.dart"
click node_models "https://github.com/dordhak/vert---a-recycling-app/blob/main/lib/models/vert_models.dart"
click node_resident_dash "https://github.com/dordhak/vert---a-recycling-app/blob/main/lib/screens/dashboards/resident_dashboard.dart"
click node_staff_dash "https://github.com/dordhak/vert---a-recycling-app/blob/main/lib/screens/dashboards/staff_dashboard.dart"
click node_admin_dash "https://github.com/dordhak/vert---a-recycling-app/blob/main/lib/screens/dashboards/admin_dashboard.dart"
click node_home_login "https://github.com/dordhak/vert---a-recycling-app/blob/main/lib/screens/home_screen.dart"
click node_feature_pages "https://github.com/dordhak/vert---a-recycling-app/blob/main/lib/screens/features/feature_pages.dart"
click node_submission_form "https://github.com/dordhak/vert---a-recycling-app/blob/main/lib/widgets/forms/submission_form.dart"
click node_center_form "https://github.com/dordhak/vert---a-recycling-app/blob/main/lib/widgets/forms/center_form.dart"
click node_profile_form "https://github.com/dordhak/vert---a-recycling-app/blob/main/lib/widgets/forms/profile_form.dart"
click node_center_map "https://github.com/dordhak/vert---a-recycling-app/blob/main/lib/widgets/location/center_map_platform.dart"
click node_center_panel "https://github.com/dordhak/vert---a-recycling-app/blob/main/lib/widgets/location/center_location_panel.dart"
click node_shared_ui "https://github.com/dordhak/vert---a-recycling-app/tree/main/lib/widgets/shared"
click node_tiles "https://github.com/dordhak/vert---a-recycling-app/tree/main/lib/widgets/tiles"
click node_seed_data "https://github.com/dordhak/vert---a-recycling-app/blob/main/lib/data/vert_seed.dart"
click node_utils "https://github.com/dordhak/vert---a-recycling-app/blob/main/lib/utils/staff_request_id.dart"
click node_schema "https://github.com/dordhak/vert---a-recycling-app/blob/main/supabase/schema.sql"
click node_bootstrap_admin "https://github.com/dordhak/vert---a-recycling-app/blob/main/supabase/bootstrap_first_admin.sql"
click node_profile_trigger "https://github.com/dordhak/vert---a-recycling-app/blob/main/supabase/install_auth_profile_trigger.sql"
click node_migration "https://github.com/dordhak/vert---a-recycling-app/blob/main/supabase/upgrade_existing.sql"
click node_db_check "https://github.com/dordhak/vert---a-recycling-app/blob/main/supabase/check_database.sql"
click node_android "https://github.com/dordhak/vert---a-recycling-app/tree/main/android"
click node_ios "https://github.com/dordhak/vert---a-recycling-app/tree/main/ios"
click node_web "https://github.com/dordhak/vert---a-recycling-app/tree/main/web"
click node_desktop "https://github.com/dordhak/vert---a-recycling-app/tree/main/windows"

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_main,node_app_shell,node_theme,node_supabase_config,node_auth_service,node_repository,node_models,node_resident_dash,node_staff_dash,node_admin_dash,node_home_login,node_feature_pages,node_submission_form,node_center_form,node_profile_form,node_center_map,node_center_panel,node_shared_ui,node_tiles,node_seed_data,node_utils toneBlue
class node_schema,node_bootstrap_admin,node_profile_trigger,node_migration,node_db_check toneAmber
class node_android,node_ios,node_web,node_desktop toneMint
```

## Components

### Flutter app

Cross-platform client UI, state, forms, and shared components.

- [Main](https://github.com/dordhak/vert---a-recycling-app/blob/main/lib/main.dart): entrypoint · App runtime entry point. · `lib/main.dart`
- [App shell](https://github.com/dordhak/vert---a-recycling-app/blob/main/lib/app/vert_app.dart): shell · Bootstraps routing, layout, and app-wide composition. · `lib/app/vert_app.dart`
- [Theme](https://github.com/dordhak/vert---a-recycling-app/blob/main/lib/app/vert_theme.dart): styling · Global visual styling and design tokens. · `lib/app/vert_theme.dart`
- [Supabase config](https://github.com/dordhak/vert---a-recycling-app/blob/main/lib/config/supabase_config.dart): client boundary · Client-side connection settings for Supabase. · `lib/config/supabase_config.dart`
- [Auth service](https://github.com/dordhak/vert---a-recycling-app/blob/main/lib/services/supabase_auth_service.dart): auth · Encapsulates Supabase sign-in, sign-out, and session state. · `lib/services/supabase_auth_service.dart`
- [Repository](https://github.com/dordhak/vert---a-recycling-app/blob/main/lib/repositories/vert_repository.dart): data access · Central read/write abstraction over app data. · `lib/repositories/vert_repository.dart`
- [Domain models](https://github.com/dordhak/vert---a-recycling-app/blob/main/lib/models/vert_models.dart): entities · Aggregated exports for core app data types. · `lib/models/vert_models.dart`
- [Resident dash](https://github.com/dordhak/vert---a-recycling-app/blob/main/lib/screens/dashboards/resident_dashboard.dart): dashboard · Resident-facing overview and actions. · `lib/screens/dashboards/resident_dashboard.dart`
- [Staff dash](https://github.com/dordhak/vert---a-recycling-app/blob/main/lib/screens/dashboards/staff_dashboard.dart): dashboard · Staff review and approval workspace. · `lib/screens/dashboards/staff_dashboard.dart`
- [Admin dash](https://github.com/dordhak/vert---a-recycling-app/blob/main/lib/screens/dashboards/admin_dashboard.dart): dashboard · Admin management and configuration workspace. · `lib/screens/dashboards/admin_dashboard.dart`
- [Home & login](https://github.com/dordhak/vert---a-recycling-app/blob/main/lib/screens/home_screen.dart): navigation · Top-level navigation and authentication entry screens. · `lib/screens/home_screen.dart`
- [Feature pages](https://github.com/dordhak/vert---a-recycling-app/blob/main/lib/screens/features/feature_pages.dart): screens · Secondary feature views beyond the dashboards. · `lib/screens/features/feature_pages.dart`
- [Submission form](https://github.com/dordhak/vert---a-recycling-app/blob/main/lib/widgets/forms/submission_form.dart): form · Creates recycling submissions. · `lib/widgets/forms/submission_form.dart`
- [Center form](https://github.com/dordhak/vert---a-recycling-app/blob/main/lib/widgets/forms/center_form.dart): form · Creates and edits recycling centers. · `lib/widgets/forms/center_form.dart`
- [Profile form](https://github.com/dordhak/vert---a-recycling-app/blob/main/lib/widgets/forms/profile_form.dart): form · Edits user profile details. · `lib/widgets/forms/profile_form.dart`
- [Center map](https://github.com/dordhak/vert---a-recycling-app/blob/main/lib/widgets/location/center_map_platform.dart): location · Platform-aware map rendering behind a shared interface. · `lib/widgets/location/center_map_platform.dart`
- [Location panel](https://github.com/dordhak/vert---a-recycling-app/blob/main/lib/widgets/location/center_location_panel.dart): location UI · Combines center details with map/location display. · `lib/widgets/location/center_location_panel.dart`
- [Shared UI](https://github.com/dordhak/vert---a-recycling-app/tree/main/lib/widgets/shared): components · Reusable visual primitives used across screens. · `lib/widgets/shared`
- [Domain tiles](https://github.com/dordhak/vert---a-recycling-app/tree/main/lib/widgets/tiles): cards · Reusable tiles for centers, guides, submissions, and metrics. · `lib/widgets/tiles`
- [Seed data](https://github.com/dordhak/vert---a-recycling-app/blob/main/lib/data/vert_seed.dart): sample data · Seed or sample content for the domain. · `lib/data/vert_seed.dart`
- [Utilities](https://github.com/dordhak/vert---a-recycling-app/blob/main/lib/utils/staff_request_id.dart): helpers · Supporting helper logic such as request identifiers. · `lib/utils/staff_request_id.dart`

### Supabase backend

Database schema and maintenance scripts for auth and core data.

- [Schema](https://github.com/dordhak/vert---a-recycling-app/blob/main/supabase/schema.sql): postgres schema · Core database schema and tables. · `supabase/schema.sql`
- [Bootstrap admin](https://github.com/dordhak/vert---a-recycling-app/blob/main/supabase/bootstrap_first_admin.sql): sql script · Initial admin provisioning script. · `supabase/bootstrap_first_admin.sql`
- [Profile trigger](https://github.com/dordhak/vert---a-recycling-app/blob/main/supabase/install_auth_profile_trigger.sql): sql script · Automatic profile creation or sync for auth users. · `supabase/install_auth_profile_trigger.sql`
- [Upgrade script](https://github.com/dordhak/vert---a-recycling-app/blob/main/supabase/upgrade_existing.sql): sql migration · Existing database upgrade and migration logic. · `supabase/upgrade_existing.sql`
- [DB check](https://github.com/dordhak/vert---a-recycling-app/blob/main/supabase/check_database.sql): validation script · Database validation and health checks. · `supabase/check_database.sql`

### Platform shells

Generated mobile, web, and desktop wrappers around the Flutter app.

- [Android](https://github.com/dordhak/vert---a-recycling-app/tree/main/android): platform shell · Generated Android host application. · `android`
- [iOS](https://github.com/dordhak/vert---a-recycling-app/tree/main/ios): platform shell · Generated iOS host application. · `ios`
- [Web](https://github.com/dordhak/vert---a-recycling-app/tree/main/web): platform shell · Web host and app manifest. · `web`
- [Desktop](https://github.com/dordhak/vert---a-recycling-app/tree/main/windows): platform shell · Windows, macOS, and Linux host wrappers. · `windows`

## Connections

- Main → App shell: boots · Main entry launches the app shell.
- App shell → Theme: uses · Shell applies global theme and styling.
- App shell → Supabase config: configures · App shell initializes backend connectivity.
- Supabase config → Auth service: supports · Supabase client configuration is consumed by auth.
- Auth service → Repository: feeds session · Authenticated user/session state informs data access.
- Repository → Domain models: reads/writes · Repository works with the core domain entities.
- Repository → Schema: persists to · Repository operations map onto Supabase tables.
- Auth service → Schema: authenticates via · Authentication is backed by Supabase auth and profile data.
- Home & login → Auth service: signs in · Login flow delegates to the auth service.
- Home & login → Resident dash: routes to · Authenticated residents land on resident dashboard.
- Home & login → Staff dash: routes to · Authenticated staff land on staff dashboard.
- Home & login → Admin dash: routes to · Authenticated admins land on admin dashboard.
- Resident dash → Submission form: creates · Residents submit recycling requests through the form.
- Staff dash → Feature pages: reviews · Staff use feature pages for operational workflows.
- Admin dash → Center form: manages · Admins manage recycling centers and related data.
- Admin dash → Profile form: updates · Admin or profile workflows edit user details.
- Feature pages → Location panel: shows · Feature views include location-aware center details.
- Location panel → Center map: renders · Center panel delegates map display to platform map abstraction.
- Shared UI → Domain tiles: contains · Shared UI area supports reusable domain cards and indicators.
- Domain tiles → Resident dash: composes · Dashboards are built from reusable tile components.
- Seed data → Domain models: seeds · Seed content mirrors the core domain model.
- Schema → Bootstrap admin: includes · Database setup supports initial admin provisioning.
- Schema → Profile trigger: includes · Schema is paired with auth/profile synchronization trigger.
- Schema → Upgrade script: evolves via · Existing installations are upgraded through migration script.
- Schema → DB check: validated by · Schema health is checked with validation script.
- Android → App shell: hosts · Android wrapper runs the Flutter app.
- iOS → App shell: hosts · iOS wrapper runs the Flutter app.
- Web → App shell: hosts · Web wrapper runs the Flutter app.
- Desktop → App shell: hosts · Desktop wrappers run the Flutter app.
