# sudoxwill/second_life architecture

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

- Interactive diagram: https://gitdiagram.com/sudoxwill/second_life
- Repository: https://github.com/sudoxwill/second_life

## Overview

SecondLife is a Flutter recycling-rewards app. A user scans waste by photo to receive an analysis and estimated points, takes it to a relay point for agent weighing and validation, then spends points on partner vouchers; users can track deposits and vouchers. Agents also manage pending tickets, batch collection, and validation history. The graph preserves these documented capabilities and the app’s supporting auth, place discovery, and shared settings. Dart implementation files were not excerpted, so relationships beyond the README-described workflow are omitted.

Main entry points: [`lib/features/waste_analysis/domain/usecases/submit_waste_info.dart`](https://github.com/sudoxwill/second_life/blob/develop/lib/features/waste_analysis/domain/usecases/submit_waste_info.dart) (Deposit tickets), [`lib/features/waste_analysis/domain/usecases/analyze_waste_photo.dart`](https://github.com/sudoxwill/second_life/blob/develop/lib/features/waste_analysis/domain/usecases/analyze_waste_photo.dart) (Waste analysis), [`lib/shared/presentation/pages/app_shell.dart`](https://github.com/sudoxwill/second_life/blob/develop/lib/shared/presentation/pages/app_shell.dart) (App shell), [`lib/features/auth/presentation/pages/login_page.dart`](https://github.com/sudoxwill/second_life/blob/develop/lib/features/auth/presentation/pages/login_page.dart) (Authentication)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["App access"]
  node_app_shell["App shell<br/>[app_shell.dart]"]
  node_auth["Authentication<br/>[login_page.dart]"]
end

subgraph group_citizen["User recycling"]
  node_waste_scan["Waste photo scan"]
  node_waste_analysis["Waste analysis"]
  node_tickets["Deposit tickets"]
  node_places["Relay map"]
end

subgraph group_agent["Relay operations"]
  node_agent_validation["Ticket validation"]
  node_weighing["Deposit weighing<br/>[weighing_page.dart]"]
  node_batch_stock["Batch collection"]
  node_agent_history["Agent history"]
end

subgraph group_rewards["Rewards and history"]
  node_rewards["Reward catalog"]
  node_redemption["Point redemption<br/>[redeem_reward.dart]"]
  node_history["User history"]
end

subgraph group_shared["Shared services"]
  node_notifications["Notifications"]
  node_preferences["App preferences"]
end

node_user(("User"))
node_agent_actor(("Relay agent"))
node_firebase[("Firebase")]
node_ai_analysis["AI analysis service"]
node_map_data["Map data"]

node_user -->|"opens"| node_app_shell
node_agent_actor -->|"opens"| node_app_shell
node_app_shell -.->|"authenticates through"| node_auth
node_user -->|"photographs waste"| node_waste_scan
node_waste_scan -.->|"submits photo"| node_waste_analysis
node_waste_analysis -.->|"analyzes photo"| node_ai_analysis
node_waste_analysis -->|"estimates points"| node_tickets
node_user -->|"finds relay"| node_places
node_places -.->|"shows locations"| node_map_data
node_agent_actor -->|"scans QR"| node_agent_validation
node_agent_validation -->|"weighs deposit"| node_weighing
node_weighing -->|"validates or refuses"| node_tickets
node_agent_actor -->|"records collection"| node_batch_stock
node_agent_actor -->|"reviews validations"| node_agent_history
node_user -->|"browses rewards"| node_rewards
node_rewards -.->|"selects reward"| node_redemption
node_redemption -->|"exchanges points"| node_tickets
node_user -->|"tracks deposits and vouchers"| node_history
node_tickets -.->|"reports deposit status"| node_notifications
node_user -->|"sets language and theme"| node_preferences
node_auth -->|"uses Auth"| node_firebase
node_tickets -.->|"uses Firestore"| node_firebase

click node_app_shell "https://github.com/sudoxwill/second_life/blob/develop/lib/shared/presentation/pages/app_shell.dart"
click node_auth "https://github.com/sudoxwill/second_life/blob/develop/lib/features/auth/presentation/pages/login_page.dart"
click node_waste_scan "https://github.com/sudoxwill/second_life/blob/develop/lib/features/waste_analysis/presentation/pages/waste_scan_page.dart"
click node_waste_analysis "https://github.com/sudoxwill/second_life/blob/develop/lib/features/waste_analysis/domain/usecases/analyze_waste_photo.dart"
click node_tickets "https://github.com/sudoxwill/second_life/blob/develop/lib/features/waste_analysis/domain/usecases/submit_waste_info.dart"
click node_places "https://github.com/sudoxwill/second_life/blob/develop/lib/features/places/presentation/pages/places_map_page.dart"
click node_agent_validation "https://github.com/sudoxwill/second_life/blob/develop/lib/features/ticket_validation/presentation/pages/agent_scanner_page.dart"
click node_weighing "https://github.com/sudoxwill/second_life/blob/develop/lib/features/ticket_validation/presentation/pages/weighing_page.dart"
click node_batch_stock "https://github.com/sudoxwill/second_life/blob/develop/lib/features/ticket_validation/domain/usecases/mark_batch_collected.dart"
click node_agent_history "https://github.com/sudoxwill/second_life/blob/develop/lib/features/ticket_validation/presentation/pages/agent_history_page.dart"
click node_rewards "https://github.com/sudoxwill/second_life/blob/develop/lib/features/rewards/presentation/pages/rewards_catalog_page.dart"
click node_redemption "https://github.com/sudoxwill/second_life/blob/develop/lib/features/rewards/domain/usecases/redeem_reward.dart"
click node_history "https://github.com/sudoxwill/second_life/blob/develop/lib/features/history/presentation/pages/user_history_page.dart"
click node_notifications "https://github.com/sudoxwill/second_life/blob/develop/lib/shared/data/services/notification_service.dart"
click node_preferences "https://github.com/sudoxwill/second_life/blob/develop/lib/shared/presentation/providers/locale_provider.dart"

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_app_shell,node_auth,node_user toneBlue
class node_waste_scan,node_waste_analysis,node_tickets,node_places,node_firebase toneAmber
class node_agent_validation,node_weighing,node_batch_stock,node_agent_history toneMint
class node_rewards,node_redemption,node_history toneRose
class node_notifications,node_preferences,node_agent_actor,node_ai_analysis,node_map_data toneIndigo
```

## Components

### App access

- [App shell](https://github.com/sudoxwill/second_life/blob/develop/lib/shared/presentation/pages/app_shell.dart): `lib/shared/presentation/pages/app_shell.dart`
- [Authentication](https://github.com/sudoxwill/second_life/blob/develop/lib/features/auth/presentation/pages/login_page.dart): `lib/features/auth/presentation/pages/login_page.dart`

### User recycling

- [Waste photo scan](https://github.com/sudoxwill/second_life/blob/develop/lib/features/waste_analysis/presentation/pages/waste_scan_page.dart): `lib/features/waste_analysis/presentation/pages/waste_scan_page.dart`
- [Waste analysis](https://github.com/sudoxwill/second_life/blob/develop/lib/features/waste_analysis/domain/usecases/analyze_waste_photo.dart): `lib/features/waste_analysis/domain/usecases/analyze_waste_photo.dart`
- [Deposit tickets](https://github.com/sudoxwill/second_life/blob/develop/lib/features/waste_analysis/domain/usecases/submit_waste_info.dart): `lib/features/waste_analysis/domain/usecases/submit_waste_info.dart`
- [Relay map](https://github.com/sudoxwill/second_life/blob/develop/lib/features/places/presentation/pages/places_map_page.dart): `lib/features/places/presentation/pages/places_map_page.dart`

### Relay operations

- [Ticket validation](https://github.com/sudoxwill/second_life/blob/develop/lib/features/ticket_validation/presentation/pages/agent_scanner_page.dart): `lib/features/ticket_validation/presentation/pages/agent_scanner_page.dart`
- [Deposit weighing](https://github.com/sudoxwill/second_life/blob/develop/lib/features/ticket_validation/presentation/pages/weighing_page.dart): `lib/features/ticket_validation/presentation/pages/weighing_page.dart`
- [Batch collection](https://github.com/sudoxwill/second_life/blob/develop/lib/features/ticket_validation/domain/usecases/mark_batch_collected.dart): `lib/features/ticket_validation/domain/usecases/mark_batch_collected.dart`
- [Agent history](https://github.com/sudoxwill/second_life/blob/develop/lib/features/ticket_validation/presentation/pages/agent_history_page.dart): `lib/features/ticket_validation/presentation/pages/agent_history_page.dart`

### Rewards and history

- [Reward catalog](https://github.com/sudoxwill/second_life/blob/develop/lib/features/rewards/presentation/pages/rewards_catalog_page.dart): `lib/features/rewards/presentation/pages/rewards_catalog_page.dart`
- [Point redemption](https://github.com/sudoxwill/second_life/blob/develop/lib/features/rewards/domain/usecases/redeem_reward.dart): `lib/features/rewards/domain/usecases/redeem_reward.dart`
- [User history](https://github.com/sudoxwill/second_life/blob/develop/lib/features/history/presentation/pages/user_history_page.dart): `lib/features/history/presentation/pages/user_history_page.dart`

### Shared services

- [Notifications](https://github.com/sudoxwill/second_life/blob/develop/lib/shared/data/services/notification_service.dart): `lib/shared/data/services/notification_service.dart`
- [App preferences](https://github.com/sudoxwill/second_life/blob/develop/lib/shared/presentation/providers/locale_provider.dart): `lib/shared/presentation/providers/locale_provider.dart`

### Other components

- **User**
- **Relay agent**
- **Firebase**
- **AI analysis service**
- **Map data**

## Connections

- User → App shell: opens (evidence: `README.md`)
- Relay agent → App shell: opens (evidence: `README.md`)
- App shell → Authentication: authenticates through
- User → Waste photo scan: photographs waste (evidence: `README.md`)
- Waste photo scan → Waste analysis: submits photo
- Waste analysis → AI analysis service: analyzes photo
- Waste analysis → Deposit tickets: estimates points (evidence: `README.md`)
- User → Relay map: finds relay (evidence: `README.md`)
- Relay map → Map data: shows locations
- Relay agent → Ticket validation: scans QR (evidence: `README.md`)
- Ticket validation → Deposit weighing: weighs deposit (evidence: `README.md`)
- Deposit weighing → Deposit tickets: validates or refuses (evidence: `README.md`)
- Relay agent → Batch collection: records collection (evidence: `README.md`)
- Relay agent → Agent history: reviews validations (evidence: `README.md`)
- User → Reward catalog: browses rewards (evidence: `README.md`)
- Reward catalog → Point redemption: selects reward
- Point redemption → Deposit tickets: exchanges points (evidence: `README.md`)
- User → User history: tracks deposits and vouchers (evidence: `README.md`)
- Deposit tickets → Notifications: reports deposit status
- User → App preferences: sets language and theme (evidence: `README.md`)
- Authentication → Firebase: uses Auth (evidence: `README.md`)
- Deposit tickets → Firebase: uses Firestore
