# vainyala/appattendance architecture

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

- Interactive diagram: https://gitdiagram.com/vainyala/appattendance
- Repository: https://github.com/vainyala/appattendance

## Overview

#### Purpose and runtime
This is a cross-platform Flutter workforce-attendance application, targeting Android, iOS, web, Linux, macOS, and Windows. It covers role-aware authentication, attendance tracking and analytics, leave and regularisation workflows, projects/timesheets, teams, dashboards, and profiles. The README provides no functional specification; architecture is inferred from source layout.

#### Application bootstrap and navigation
Flutter starts at `lib/main.dart`, which initializes the application shell in `lib/app.dart`. Central route definition is isolated in `lib/app_router.dart`, forming the navigation boundary between feature screens. Native hosts embed the Flutter runtime, notably `android/app/src/main/kotlin/com/example/appattendance/MainActivity.kt` and `ios/Runner/AppDelegate.swift`.

#### Shared platform, state, and persistence
`lib/core` is the cross-feature foundation. Provider/notifier state is centralized under `lib/core/providers/app_state_provider.dart` and role selection under `lib/core/providers/role_provider.dart`. Persistence is abstracted through database and local-storage services: `lib/core/database/database_provider.dart`, `lib/core/database/db_helper.dart`, and `lib/core/services/storage_service.dart`. `assets/data/dummy_data.json` indicates supported seeded/local dummy data.

#### Authentication and access control
The auth feature defines a layered model: presentation providers/screens invoke repository contracts, whose implementations call services. Key boundaries are `lib/features/auth/presentation/providers/auth_notifier.dart`, `lib/features/auth/data/repositories/auth_repository_impl.dart`, and `lib/features/auth/data/services/auth_service.dart`. Its screens establish login, password/MPIN, OTP/email/device verification, and role selection flows. User and role domain representations reside in `lib/features/auth/domain/models/user_model.dart` and `lib/features/auth/domain/models/user_role.dart`.

#### Attendance capture, offline behavior, and analytics
Attendance is the principal business domain. UI state is managed by `lib/features/attendance/presentation/providers/attendance_notifier.dart`; repository implementations bridge domain operations to service layer work in `lib/features/attendance/data/repositories/attendance_repository_impl.dart`. Capture relies on location/geofence and offline services at `lib/features/attendance/data/services/location_service.dart` and `lib/features/attendance/data/services/offline_attendance_service.dart`; face detection has a dedicated screen at `lib/features/attendance/presentation/screens/face_detection_screen.dart`. Analytics follows a parallel repository/service path via `lib/features/attendance/data/repositories/attendance_analytics_repository_impl.dart`.

#### Role-dependent workforce workflows
Dashboard composition distinguishes employee and manager experiences through `lib/features/dashboard/presentation/widgets/employeewidgets/employee_dashboard_content.dart` and `lib/features/dashboard/presentation/widgets/managerwidgets/manager_dashboard_content.dart`, coordinated by `lib/features/dashboard/presentation/providers/dashboard_notifier.dart`. Leave and regularisation use the same provider → service/repository-style boundary, with manager-specific flows in `lib/features/leaves/presentation/screens/manager_leave_screen.dart` and `lib/features/regularisation/data/services/manager_regularisation_service.dart`. Team employee data is accessed through `lib/features/team/data/services/team_services.dart`.

#### Project and time-recording subsystem
Projects and task/timesheet workflows are separate but connected domains. Project state and persistence pass through `lib/features/projects/presentation/providers/project_notifier.dart` and `lib/features/projects/data/repository/project_repository_impl.dart`; timesheet interactions use `lib/features/timesheet/presentation/providers/timesheet_notifier.dart` and `lib/features/timesheet/data/services/timesheet_service.dart`. Their domain models define the data boundary: `lib/features/projects/domain/models/project_model.dart` and `lib/features/timesheet/domain/models/timesheet_model.dart`.

#### External-service boundary
Network access is centralized behind `lib/core/network/api_client.dart`, while feature services encapsulate their backend or local implementations. Device integrations include biometric handling and notifications in `lib/core/services/biometric_service.dart` and `lib/core/services/notification_service.dart`. No server, cloud deployment, or concrete third-party backend configuration is present in the supplied tree.

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Flutter App"]
  node_native_hosts["Native Hosts<br/>platform hosts<br/>[MainActivity.kt]"]
  node_main{{"Bootstrap<br/>Flutter entrypoint<br/>[main.dart]"}}
  node_app_shell["Application Shell<br/>app composition<br/>[app.dart]"]
  node_router["Route Boundary<br/>navigation<br/>[app_router.dart]"]
end

subgraph group_core["Shared Foundation"]
  node_app_state["App &amp; Role State<br/>Provider state"]
  node_persistence[("Local Persistence<br/>database and storage")]
  node_api_client["API Client<br/>network boundary<br/>[api_client.dart]"]
  node_device_services["Device Services<br/>biometric and notifications"]
  node_seed_data["Seed Data<br/>local dummy dataset<br/>[dummy_data.json]"]
end

subgraph group_auth["Identity &amp; Access"]
  node_auth_state["Auth Notifier<br/>presentation state<br/>[auth_notifier.dart]"]
  node_auth_repository["Auth Repository<br/>repository implementation"]
  node_auth_service["Auth Service<br/>feature service<br/>[auth_service.dart]"]
end

subgraph group_attendance["Attendance"]
  node_attendance_state["Attendance Notifier<br/>presentation state"]
  node_attendance_repository["Attendance Repository<br/>repository implementation"]
  node_attendance_capture["Capture &amp; Offline Service<br/>location and offline attendance"]
  node_attendance_analytics["Attendance Analytics<br/>analytics repository"]
end

subgraph group_workflows["Workforce Workflows"]
  node_dashboard["Role Dashboards<br/>dashboard state and views"]
  node_leave_regularisation["Leave &amp; Regularisation<br/>manager workforce workflows"]
  node_team_service["Team Data<br/>team service<br/>[team_services.dart]"]
end

subgraph group_delivery["Projects &amp; Timesheets"]
  node_projects["Projects<br/>project state and repository"]
  node_timesheets["Timesheets<br/>timesheet state and service"]
end

node_native_hosts -->|"launches"| node_main
node_main -->|"initializes"| node_app_shell
node_app_shell -->|"uses"| node_router
node_router -->|"auth screens"| node_auth_state
node_router -->|"attendance screens"| node_attendance_state
node_router -->|"dashboard screens"| node_dashboard
node_router -->|"project screens"| node_projects
node_router -->|"timesheet screens"| node_timesheets
node_auth_state -->|"auth operations"| node_auth_repository
node_auth_repository -->|"delegates to"| node_auth_service
node_auth_service -.->|"network access"| node_api_client
node_auth_service -.->|"local credentials"| node_persistence
node_auth_service -.->|"biometrics"| node_device_services
node_attendance_state -->|"attendance operations"| node_attendance_repository
node_attendance_state -->|"analytics"| node_attendance_analytics
node_attendance_repository -->|"capture records"| node_attendance_capture
node_attendance_capture -->|"offline storage"| node_persistence
node_attendance_repository -.->|"sync"| node_api_client
node_dashboard -->|"reads role context"| node_app_state
node_dashboard -->|"attendance metrics"| node_attendance_analytics
node_dashboard -->|"workflow status"| node_leave_regularisation
node_dashboard -->|"manager team data"| node_team_service
node_projects -.->|"project persistence"| node_api_client
node_timesheets -.->|"time-record persistence"| node_api_client
node_timesheets -->|"records project work"| node_projects
node_persistence -.->|"loads local data"| node_seed_data

click node_native_hosts "https://github.com/vainyala/appattendance/blob/master/android/app/src/main/kotlin/com/example/appattendance/MainActivity.kt"
click node_main "https://github.com/vainyala/appattendance/blob/master/lib/main.dart"
click node_app_shell "https://github.com/vainyala/appattendance/blob/master/lib/app.dart"
click node_router "https://github.com/vainyala/appattendance/blob/master/lib/app_router.dart"
click node_app_state "https://github.com/vainyala/appattendance/blob/master/lib/core/providers/app_state_provider.dart"
click node_persistence "https://github.com/vainyala/appattendance/blob/master/lib/core/database/database_provider.dart"
click node_api_client "https://github.com/vainyala/appattendance/blob/master/lib/core/network/api_client.dart"
click node_device_services "https://github.com/vainyala/appattendance/blob/master/lib/core/services/biometric_service.dart"
click node_auth_state "https://github.com/vainyala/appattendance/blob/master/lib/features/auth/presentation/providers/auth_notifier.dart"
click node_auth_repository "https://github.com/vainyala/appattendance/blob/master/lib/features/auth/data/repositories/auth_repository_impl.dart"
click node_auth_service "https://github.com/vainyala/appattendance/blob/master/lib/features/auth/data/services/auth_service.dart"
click node_attendance_state "https://github.com/vainyala/appattendance/blob/master/lib/features/attendance/presentation/providers/attendance_notifier.dart"
click node_attendance_repository "https://github.com/vainyala/appattendance/blob/master/lib/features/attendance/data/repositories/attendance_repository_impl.dart"
click node_attendance_capture "https://github.com/vainyala/appattendance/blob/master/lib/features/attendance/data/services/location_service.dart"
click node_attendance_analytics "https://github.com/vainyala/appattendance/blob/master/lib/features/attendance/data/repositories/attendance_analytics_repository_impl.dart"
click node_dashboard "https://github.com/vainyala/appattendance/blob/master/lib/features/dashboard/presentation/providers/dashboard_notifier.dart"
click node_leave_regularisation "https://github.com/vainyala/appattendance/blob/master/lib/features/regularisation/data/services/manager_regularisation_service.dart"
click node_team_service "https://github.com/vainyala/appattendance/blob/master/lib/features/team/data/services/team_services.dart"
click node_projects "https://github.com/vainyala/appattendance/blob/master/lib/features/projects/presentation/providers/project_notifier.dart"
click node_timesheets "https://github.com/vainyala/appattendance/blob/master/lib/features/timesheet/presentation/providers/timesheet_notifier.dart"
click node_seed_data "https://github.com/vainyala/appattendance/blob/master/assets/data/dummy_data.json"

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_native_hosts,node_main,node_app_shell,node_router toneBlue
class node_app_state,node_persistence,node_api_client,node_device_services,node_seed_data toneAmber
class node_auth_state,node_auth_repository,node_auth_service toneMint
class node_attendance_state,node_attendance_repository,node_attendance_capture,node_attendance_analytics toneRose
class node_dashboard,node_leave_regularisation,node_team_service toneIndigo
class node_projects,node_timesheets toneTeal
```

## Components

### Flutter App

- [Native Hosts](https://github.com/vainyala/appattendance/blob/master/android/app/src/main/kotlin/com/example/appattendance/MainActivity.kt): platform hosts · Android and iOS embed the Flutter runtime. · `android/app/src/main/kotlin/com/example/appattendance/MainActivity.kt`
- [Bootstrap](https://github.com/vainyala/appattendance/blob/master/lib/main.dart): Flutter entrypoint · `lib/main.dart`
- [Application Shell](https://github.com/vainyala/appattendance/blob/master/lib/app.dart): app composition · `lib/app.dart`
- [Route Boundary](https://github.com/vainyala/appattendance/blob/master/lib/app_router.dart): navigation · `lib/app_router.dart`

### Shared Foundation

- [App & Role State](https://github.com/vainyala/appattendance/blob/master/lib/core/providers/app_state_provider.dart): Provider state · Cross-feature state and selected role. · `lib/core/providers/app_state_provider.dart`
- [Local Persistence](https://github.com/vainyala/appattendance/blob/master/lib/core/database/database_provider.dart): database and storage · Database helpers and local storage abstraction. · `lib/core/database/database_provider.dart`
- [API Client](https://github.com/vainyala/appattendance/blob/master/lib/core/network/api_client.dart): network boundary · `lib/core/network/api_client.dart`
- [Device Services](https://github.com/vainyala/appattendance/blob/master/lib/core/services/biometric_service.dart): biometric and notifications · `lib/core/services/biometric_service.dart`
- [Seed Data](https://github.com/vainyala/appattendance/blob/master/assets/data/dummy_data.json): local dummy dataset · `assets/data/dummy_data.json`

### Identity & Access

- [Auth Notifier](https://github.com/vainyala/appattendance/blob/master/lib/features/auth/presentation/providers/auth_notifier.dart): presentation state · `lib/features/auth/presentation/providers/auth_notifier.dart`
- [Auth Repository](https://github.com/vainyala/appattendance/blob/master/lib/features/auth/data/repositories/auth_repository_impl.dart): repository implementation · `lib/features/auth/data/repositories/auth_repository_impl.dart`
- [Auth Service](https://github.com/vainyala/appattendance/blob/master/lib/features/auth/data/services/auth_service.dart): feature service · Handles login, verification, password, and MPIN flows. · `lib/features/auth/data/services/auth_service.dart`

### Attendance

- [Attendance Notifier](https://github.com/vainyala/appattendance/blob/master/lib/features/attendance/presentation/providers/attendance_notifier.dart): presentation state · `lib/features/attendance/presentation/providers/attendance_notifier.dart`
- [Attendance Repository](https://github.com/vainyala/appattendance/blob/master/lib/features/attendance/data/repositories/attendance_repository_impl.dart): repository implementation · `lib/features/attendance/data/repositories/attendance_repository_impl.dart`
- [Capture & Offline Service](https://github.com/vainyala/appattendance/blob/master/lib/features/attendance/data/services/location_service.dart): location and offline attendance · Supports location/geofence capture and offline records. · `lib/features/attendance/data/services/location_service.dart`
- [Attendance Analytics](https://github.com/vainyala/appattendance/blob/master/lib/features/attendance/data/repositories/attendance_analytics_repository_impl.dart): analytics repository · `lib/features/attendance/data/repositories/attendance_analytics_repository_impl.dart`

### Workforce Workflows

- [Role Dashboards](https://github.com/vainyala/appattendance/blob/master/lib/features/dashboard/presentation/providers/dashboard_notifier.dart): dashboard state and views · Composes distinct employee and manager experiences. · `lib/features/dashboard/presentation/providers/dashboard_notifier.dart`
- [Leave & Regularisation](https://github.com/vainyala/appattendance/blob/master/lib/features/regularisation/data/services/manager_regularisation_service.dart): manager workforce workflows · `lib/features/regularisation/data/services/manager_regularisation_service.dart`
- [Team Data](https://github.com/vainyala/appattendance/blob/master/lib/features/team/data/services/team_services.dart): team service · `lib/features/team/data/services/team_services.dart`

### Projects & Timesheets

- [Projects](https://github.com/vainyala/appattendance/blob/master/lib/features/projects/presentation/providers/project_notifier.dart): project state and repository · `lib/features/projects/presentation/providers/project_notifier.dart`
- [Timesheets](https://github.com/vainyala/appattendance/blob/master/lib/features/timesheet/presentation/providers/timesheet_notifier.dart): timesheet state and service · `lib/features/timesheet/presentation/providers/timesheet_notifier.dart`

## Connections

- Native Hosts → Bootstrap: launches
- Bootstrap → Application Shell: initializes
- Application Shell → Route Boundary: uses
- Route Boundary → Auth Notifier: auth screens
- Route Boundary → Attendance Notifier: attendance screens
- Route Boundary → Role Dashboards: dashboard screens
- Route Boundary → Projects: project screens
- Route Boundary → Timesheets: timesheet screens
- Auth Notifier → Auth Repository: auth operations
- Auth Repository → Auth Service: delegates to
- Auth Service → API Client: network access
- Auth Service → Local Persistence: local credentials
- Auth Service → Device Services: biometrics
- Attendance Notifier → Attendance Repository: attendance operations
- Attendance Notifier → Attendance Analytics: analytics
- Attendance Repository → Capture & Offline Service: capture records
- Capture & Offline Service → Local Persistence: offline storage
- Attendance Repository → API Client: sync
- Role Dashboards → App & Role State: reads role context
- Role Dashboards → Attendance Analytics: attendance metrics
- Role Dashboards → Leave & Regularisation: workflow status
- Role Dashboards → Team Data: manager team data
- Projects → API Client: project persistence
- Timesheets → API Client: time-record persistence
- Timesheets → Projects: records project work
- Local Persistence → Seed Data: loads local data
