# harshbodani/autocare architecture

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

- Interactive diagram: https://gitdiagram.com/harshbodani/autocare
- Repository: https://github.com/harshbodani/autocare

## Overview

AutoCare is a Flutter vehicle-service management app for workshop staff and customers. Users sign in, then manage customer and vehicle records, bookings, invoices, reminders, and vehicle service history; dashboard totals summarize workshop activity. The app supports Firebase/Firestore or a PostgreSQL API, with local offline copies and queued changes in REST mode. Backend routing and security are shown in sampled source; screen-to-screen wiring and most Flutter service internals were not sampled, so those links are limited to README-documented behavior.

Main entry points: [`lib/main.dart`](https://github.com/harshbodani/autocare/blob/main/lib/main.dart) (App entry), [`backend/server.js`](https://github.com/harshbodani/autocare/blob/main/backend/server.js) (Express API), [`lib/screens/auth.dart`](https://github.com/harshbodani/autocare/blob/main/lib/screens/auth.dart) (Sign in), [`lib/screens/vehicles.dart`](https://github.com/harshbodani/autocare/blob/main/lib/screens/vehicles.dart) (Vehicles)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Flutter app"]
  node_app["App entry<br/>[main.dart]"]
  node_auth_screen["Sign in<br/>[auth.dart]"]
end

subgraph group_workshop["Workshop operations"]
  node_dashboard["Dashboard<br/>[dashboard.dart]"]
  node_customers["Customers<br/>[customers.dart]"]
  node_vehicles["Vehicles<br/>[vehicles.dart]"]
  node_bookings["Bookings<br/>[bookings.dart]"]
  node_history["Service history<br/>[history.dart]"]
  node_invoices["Invoices<br/>[invoices.dart]"]
  node_reminders["Reminders<br/>[reminders.dart]"]
  node_staff["Staff accounts<br/>[staff.dart]"]
  node_profile["Profile settings<br/>[profile.dart]"]
end

subgraph group_identity["Identity and session"]
  node_session["Session state<br/>[session.dart]"]
  node_auth_service["Authentication<br/>[auth.dart]"]
  node_token_security["Password and tokens<br/>[security.js]"]
end

subgraph group_platform["Data platforms"]
  node_api_client["API client<br/>[api.dart]"]
  node_firebase_client["Firebase backend"]
  node_notifications["Notifications<br/>[notifications.dart]"]
  node_rest_api["Express API<br/>[server.js]"]
  node_pg_pool["PostgreSQL access<br/>[db.js]"]
  node_postgres[("PostgreSQL<br/>[schema.sql]")]
  node_firestore[("Cloud Firestore")]
end

node_user(("Staff or customer"))

node_user -->|"uses"| node_app
node_user -->|"signs in"| node_auth_screen
node_user -->|"manages"| node_customers
node_user -->|"manages"| node_vehicles
node_user -->|"books services"| node_bookings
node_user -->|"views invoices"| node_invoices
node_user -->|"views reminders"| node_reminders
node_user -->|"administers roles"| node_staff
node_user -->|"changes settings"| node_profile
node_app -.->|"offers sign-in"| node_auth_screen
node_auth_screen -.->|"authenticates"| node_auth_service
node_app -.->|"shows overview"| node_dashboard
node_app -->|"uses REST mode"| node_api_client
node_app -->|"uses Firebase mode"| node_firebase_client
node_api_client -->|"sends requests"| node_rest_api
node_firebase_client -->|"reads and writes"| node_firestore
node_rest_api -->|"verifies tokens"| node_token_security
node_rest_api -->|"queries"| node_pg_pool
node_pg_pool -.->|"accesses"| node_postgres
node_rest_api -->|"provides totals"| node_dashboard
node_vehicles -->|"views history"| node_history
node_auth_service -.->|"maintains session"| node_session
node_app -.->|"supports reminders"| node_notifications

click node_app "https://github.com/harshbodani/autocare/blob/main/lib/main.dart"
click node_auth_screen "https://github.com/harshbodani/autocare/blob/main/lib/screens/auth.dart"
click node_dashboard "https://github.com/harshbodani/autocare/blob/main/lib/screens/dashboard.dart"
click node_customers "https://github.com/harshbodani/autocare/blob/main/lib/screens/customers.dart"
click node_vehicles "https://github.com/harshbodani/autocare/blob/main/lib/screens/vehicles.dart"
click node_bookings "https://github.com/harshbodani/autocare/blob/main/lib/screens/bookings.dart"
click node_history "https://github.com/harshbodani/autocare/blob/main/lib/screens/history.dart"
click node_invoices "https://github.com/harshbodani/autocare/blob/main/lib/screens/invoices.dart"
click node_reminders "https://github.com/harshbodani/autocare/blob/main/lib/screens/reminders.dart"
click node_staff "https://github.com/harshbodani/autocare/blob/main/lib/screens/staff.dart"
click node_profile "https://github.com/harshbodani/autocare/blob/main/lib/screens/profile.dart"
click node_api_client "https://github.com/harshbodani/autocare/blob/main/lib/services/api.dart"
click node_firebase_client "https://github.com/harshbodani/autocare/blob/main/lib/services/firebase_backend.dart"
click node_session "https://github.com/harshbodani/autocare/blob/main/lib/services/session.dart"
click node_auth_service "https://github.com/harshbodani/autocare/blob/main/lib/services/auth.dart"
click node_notifications "https://github.com/harshbodani/autocare/blob/main/lib/services/notifications.dart"
click node_rest_api "https://github.com/harshbodani/autocare/blob/main/backend/server.js"
click node_token_security "https://github.com/harshbodani/autocare/blob/main/backend/security.js"
click node_pg_pool "https://github.com/harshbodani/autocare/blob/main/backend/db.js"
click node_postgres "https://github.com/harshbodani/autocare/blob/main/backend/schema.sql"

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,node_auth_screen toneBlue
class node_dashboard,node_customers,node_vehicles,node_bookings,node_history,node_invoices,node_reminders,node_staff,node_profile toneAmber
class node_session,node_auth_service,node_token_security toneMint
class node_api_client,node_firebase_client,node_notifications,node_rest_api,node_pg_pool,node_postgres,node_firestore toneRose
class node_user toneIndigo
```

## Components

### Flutter app

- [App entry](https://github.com/harshbodani/autocare/blob/main/lib/main.dart): `lib/main.dart`
- [Sign in](https://github.com/harshbodani/autocare/blob/main/lib/screens/auth.dart): `lib/screens/auth.dart`

### Workshop operations

- [Dashboard](https://github.com/harshbodani/autocare/blob/main/lib/screens/dashboard.dart): `lib/screens/dashboard.dart`
- [Customers](https://github.com/harshbodani/autocare/blob/main/lib/screens/customers.dart): `lib/screens/customers.dart`
- [Vehicles](https://github.com/harshbodani/autocare/blob/main/lib/screens/vehicles.dart): `lib/screens/vehicles.dart`
- [Bookings](https://github.com/harshbodani/autocare/blob/main/lib/screens/bookings.dart): `lib/screens/bookings.dart`
- [Service history](https://github.com/harshbodani/autocare/blob/main/lib/screens/history.dart): `lib/screens/history.dart`
- [Invoices](https://github.com/harshbodani/autocare/blob/main/lib/screens/invoices.dart): `lib/screens/invoices.dart`
- [Reminders](https://github.com/harshbodani/autocare/blob/main/lib/screens/reminders.dart): `lib/screens/reminders.dart`
- [Staff accounts](https://github.com/harshbodani/autocare/blob/main/lib/screens/staff.dart): `lib/screens/staff.dart`
- [Profile settings](https://github.com/harshbodani/autocare/blob/main/lib/screens/profile.dart): `lib/screens/profile.dart`

### Identity and session

- [Session state](https://github.com/harshbodani/autocare/blob/main/lib/services/session.dart): `lib/services/session.dart`
- [Authentication](https://github.com/harshbodani/autocare/blob/main/lib/services/auth.dart): `lib/services/auth.dart`
- [Password and tokens](https://github.com/harshbodani/autocare/blob/main/backend/security.js): `backend/security.js`

### Data platforms

- [API client](https://github.com/harshbodani/autocare/blob/main/lib/services/api.dart): `lib/services/api.dart`
- [Firebase backend](https://github.com/harshbodani/autocare/blob/main/lib/services/firebase_backend.dart): `lib/services/firebase_backend.dart`
- [Notifications](https://github.com/harshbodani/autocare/blob/main/lib/services/notifications.dart): `lib/services/notifications.dart`
- [Express API](https://github.com/harshbodani/autocare/blob/main/backend/server.js): `backend/server.js`
- [PostgreSQL access](https://github.com/harshbodani/autocare/blob/main/backend/db.js): `backend/db.js`
- [PostgreSQL](https://github.com/harshbodani/autocare/blob/main/backend/schema.sql): `backend/schema.sql`
- **Cloud Firestore**

### Other components

- **Staff or customer**

## Connections

- Staff or customer → App entry: uses (evidence: `README.md`)
- Staff or customer → Sign in: signs in (evidence: `README.md`)
- Staff or customer → Customers: manages (evidence: `README.md`)
- Staff or customer → Vehicles: manages (evidence: `README.md`)
- Staff or customer → Bookings: books services (evidence: `README.md`)
- Staff or customer → Invoices: views invoices (evidence: `README.md`)
- Staff or customer → Reminders: views reminders (evidence: `README.md`)
- Staff or customer → Staff accounts: administers roles (evidence: `README.md`)
- Staff or customer → Profile settings: changes settings (evidence: `README.md`)
- App entry → Sign in: offers sign-in
- Sign in → Authentication: authenticates
- App entry → Dashboard: shows overview
- App entry → API client: uses REST mode (evidence: `README.md`)
- App entry → Firebase backend: uses Firebase mode (evidence: `README.md`)
- API client → Express API: sends requests (evidence: `README.md`)
- Firebase backend → Cloud Firestore: reads and writes (evidence: `README.md`)
- Express API → Password and tokens: verifies tokens (evidence: `backend/server.js`)
- Express API → PostgreSQL access: queries (evidence: `backend/server.js`)
- PostgreSQL access → PostgreSQL: accesses
- Express API → Dashboard: provides totals (evidence: `README.md`)
- Vehicles → Service history: views history (evidence: `README.md`)
- Authentication → Session state: maintains session
- App entry → Notifications: supports reminders
