How dordhak/vert---a-recycling-app works
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: vert_app.dart App shell · schema.sql Schema · home_screen.dart Home & login · supabase_auth_service.dart Auth service
Components 30
Flutter app
Cross-platform client UI, state, forms, and shared components.
- Main · App runtime entry point.
lib/main.dart - App shell · Bootstraps routing, layout, and app-wide composition.
lib/app/vert_app.dart - Theme · Global visual styling and design tokens.
lib/app/vert_theme.dart - Supabase config · Client-side connection settings for Supabase.
lib/config/supabase_config.dart - Auth service · Encapsulates Supabase sign-in, sign-out, and session state.
lib/services/supabase_auth_service.dart - Repository · Central read/write abstraction over app data.
lib/repositories/vert_repository.dart - Domain models · Aggregated exports for core app data types.
lib/models/vert_models.dart - Resident dash · Resident-facing overview and actions.
lib/screens/dashboards/resident_dashboard.dart - Staff dash · Staff review and approval workspace.
lib/screens/dashboards/staff_dashboard.dart - Admin dash · Admin management and configuration workspace.
lib/screens/dashboards/admin_dashboard.dart - Home & login · Top-level navigation and authentication entry screens.
lib/screens/home_screen.dart - Feature pages · Secondary feature views beyond the dashboards.
lib/screens/features/feature_pages.dart - Submission form · Creates recycling submissions.
lib/widgets/forms/submission_form.dart - Center form · Creates and edits recycling centers.
lib/widgets/forms/center_form.dart - Profile form · Edits user profile details.
lib/widgets/forms/profile_form.dart - Center map · Platform-aware map rendering behind a shared interface.
lib/widgets/location/center_map_platform.dart - Location panel · Combines center details with map/location display.
lib/widgets/location/center_location_panel.dart - Shared UI · Reusable visual primitives used across screens.
lib/widgets/shared - Domain tiles · Reusable tiles for centers, guides, submissions, and metrics.
lib/widgets/tiles - Seed data · Seed or sample content for the domain.
lib/data/vert_seed.dart - Utilities · 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 · Core database schema and tables.
supabase/schema.sql - Bootstrap admin · Initial admin provisioning script.
supabase/bootstrap_first_admin.sql - Profile trigger · Automatic profile creation or sync for auth users.
supabase/install_auth_profile_trigger.sql - Upgrade script · Existing database upgrade and migration logic.
supabase/upgrade_existing.sql - DB check · Database validation and health checks.
supabase/check_database.sql
Connections 29
- 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.