# kailash45s/trackpro.eu architecture

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

- Interactive diagram: https://gitdiagram.com/kailash45s/trackpro.eu
- Repository: https://github.com/kailash45s/trackpro.eu

## Overview

Worke is a field-service platform for recording work, coordinating teams, and turning completed jobs into client-facing financial and compliance records. The main workflow runs from employee session or timer entry, through team oversight and monthly closing, to reports, invoices, or quotes. Administrators also manage clients, services, work orders, planning, and staff; employees can complete assigned orders and export their work. Supabase/Postgres is authoritative for tenant data and permissions, while offline reads and queued writes support field use. Relationships beyond the excerpts are shown only where the README documents the capability or flow.

Main entry points: [`src/lib/repositories`](https://github.com/kailash45s/trackpro.eu/tree/main/src/lib/repositories) (Domain repositories), [`src/integrations/supabase/client.ts`](https://github.com/kailash45s/trackpro.eu/blob/main/src/integrations/supabase/client.ts) (Supabase and Postgres), [`src/pages/AddSession.tsx`](https://github.com/kailash45s/trackpro.eu/blob/main/src/pages/AddSession.tsx) (Time sessions), [`src/App.tsx`](https://github.com/kailash45s/trackpro.eu/blob/main/src/App.tsx) (Routes and access)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["App and identity"]
  node_routing["Routes and access<br/>[App.tsx]"]
  node_identity["Auth and membership"]
  node_plans["Plan entitlements"]
end

subgraph group_field["Field operations"]
  node_session["Time sessions<br/>[AddSession.tsx]"]
  node_timer["Work timer<br/>[useWorkTimer.ts]"]
  node_geolocation["GPS and geofence<br/>[geo.ts]"]
  node_offline["Offline queue and cache"]
end

subgraph group_business["Team and planning"]
  node_workorders["Work orders"]
  node_planning["Planning and absences<br/>[Planning.tsx]"]
  node_workplaces["Workplaces"]
  node_clients_services["Clients and services<br/>[Clients.tsx]"]
end

subgraph group_finance["Billing and records"]
  node_closing["Monthly closing<br/>[MonthlyClosing.tsx]"]
  node_reports["Reports and exports<br/>[Reports.tsx]"]
  node_invoices_quotes["Invoices and quotes<br/>[Invoices.tsx]"]
  node_client_report["Client service report"]
end

subgraph group_platform["Data and services"]
  node_repositories["Domain repositories"]
  node_supabase[("Supabase and Postgres<br/>[client.ts]")]
  node_edge_functions["Edge functions"]
  node_stripe["Stripe"]
end

node_employee(("Employee"))
node_administrator(("Administrator"))
node_client(("End client"))

node_employee -->|"uses app"| node_routing
node_administrator -->|"uses app"| node_routing
node_routing -->|"guards routes"| node_identity
node_routing -->|"checks access"| node_plans
node_employee -->|"records work"| node_session
node_employee -->|"tracks time"| node_timer
node_session -->|"uses GPS"| node_geolocation
node_timer -.->|"uses GPS"| node_geolocation
node_timer -->|"queues writes"| node_offline
node_session -->|"queues writes"| node_offline
node_offline -->|"syncs writes"| node_supabase
node_administrator -->|"assigns work"| node_workorders
node_employee -->|"completes assigned"| node_workorders
node_administrator -->|"plans team"| node_planning
node_administrator -->|"manages sites"| node_workplaces
node_administrator -->|"manages records"| node_clients_services
node_administrator -->|"closes month"| node_closing
node_closing -.->|"requests validation"| node_client
node_administrator -->|"exports work"| node_reports
node_employee -->|"exports own work"| node_reports
node_administrator -->|"creates documents"| node_invoices_quotes
node_invoices_quotes -.->|"takes payments"| node_stripe
node_employee -->|"sends report"| node_client_report
node_client_report -->|"delivers PDF"| node_client
node_session -.->|"stores records"| node_repositories
node_workorders -.->|"stores orders"| node_repositories
node_workplaces -->|"reads and writes"| node_repositories
node_clients_services -.->|"accesses records"| node_repositories
node_repositories -.->|"accesses Postgres"| node_supabase
node_identity -->|"loads membership"| node_supabase
node_plans -->|"loads subscription"| node_supabase
node_supabase -->|"hosts functions"| node_edge_functions

click node_routing "https://github.com/kailash45s/trackpro.eu/blob/main/src/App.tsx"
click node_identity "https://github.com/kailash45s/trackpro.eu/tree/main/src/contexts/auth"
click node_plans "https://github.com/kailash45s/trackpro.eu/blob/main/src/services/subscription/subscription-service.ts"
click node_session "https://github.com/kailash45s/trackpro.eu/blob/main/src/pages/AddSession.tsx"
click node_timer "https://github.com/kailash45s/trackpro.eu/blob/main/src/hooks/useWorkTimer.ts"
click node_geolocation "https://github.com/kailash45s/trackpro.eu/blob/main/src/lib/geo.ts"
click node_offline "https://github.com/kailash45s/trackpro.eu/tree/main/src/lib/offline"
click node_workorders "https://github.com/kailash45s/trackpro.eu/blob/main/src/components/admin/AdminWorkOrdersManager.tsx"
click node_planning "https://github.com/kailash45s/trackpro.eu/blob/main/src/pages/Planning.tsx"
click node_workplaces "https://github.com/kailash45s/trackpro.eu/blob/main/src/components/workplaces/WorkplacesManager.tsx"
click node_clients_services "https://github.com/kailash45s/trackpro.eu/blob/main/src/pages/Clients.tsx"
click node_closing "https://github.com/kailash45s/trackpro.eu/blob/main/src/pages/MonthlyClosing.tsx"
click node_reports "https://github.com/kailash45s/trackpro.eu/blob/main/src/pages/Reports.tsx"
click node_invoices_quotes "https://github.com/kailash45s/trackpro.eu/blob/main/src/pages/Invoices.tsx"
click node_client_report "https://github.com/kailash45s/trackpro.eu/blob/main/src/lib/services/sendServiceReport.ts"
click node_repositories "https://github.com/kailash45s/trackpro.eu/tree/main/src/lib/repositories"
click node_supabase "https://github.com/kailash45s/trackpro.eu/blob/main/src/integrations/supabase/client.ts"
click node_edge_functions "https://github.com/kailash45s/trackpro.eu/tree/main/supabase/functions"

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_routing,node_identity,node_plans,node_client toneBlue
class node_session,node_timer,node_geolocation,node_offline toneAmber
class node_workorders,node_planning,node_workplaces,node_clients_services toneMint
class node_closing,node_reports,node_invoices_quotes,node_client_report toneRose
class node_repositories,node_supabase,node_edge_functions,node_stripe,node_employee,node_administrator toneIndigo
```

## Components

### App and identity

- [Routes and access](https://github.com/kailash45s/trackpro.eu/blob/main/src/App.tsx): `src/App.tsx`
- [Auth and membership](https://github.com/kailash45s/trackpro.eu/tree/main/src/contexts/auth): `src/contexts/auth`
- [Plan entitlements](https://github.com/kailash45s/trackpro.eu/blob/main/src/services/subscription/subscription-service.ts): `src/services/subscription/subscription-service.ts`

### Field operations

- [Time sessions](https://github.com/kailash45s/trackpro.eu/blob/main/src/pages/AddSession.tsx): `src/pages/AddSession.tsx`
- [Work timer](https://github.com/kailash45s/trackpro.eu/blob/main/src/hooks/useWorkTimer.ts): `src/hooks/useWorkTimer.ts`
- [GPS and geofence](https://github.com/kailash45s/trackpro.eu/blob/main/src/lib/geo.ts): `src/lib/geo.ts`
- [Offline queue and cache](https://github.com/kailash45s/trackpro.eu/tree/main/src/lib/offline): `src/lib/offline`

### Team and planning

- [Work orders](https://github.com/kailash45s/trackpro.eu/blob/main/src/components/admin/AdminWorkOrdersManager.tsx): `src/components/admin/AdminWorkOrdersManager.tsx`
- [Planning and absences](https://github.com/kailash45s/trackpro.eu/blob/main/src/pages/Planning.tsx): `src/pages/Planning.tsx`
- [Workplaces](https://github.com/kailash45s/trackpro.eu/blob/main/src/components/workplaces/WorkplacesManager.tsx): `src/components/workplaces/WorkplacesManager.tsx`
- [Clients and services](https://github.com/kailash45s/trackpro.eu/blob/main/src/pages/Clients.tsx): `src/pages/Clients.tsx`

### Billing and records

- [Monthly closing](https://github.com/kailash45s/trackpro.eu/blob/main/src/pages/MonthlyClosing.tsx): `src/pages/MonthlyClosing.tsx`
- [Reports and exports](https://github.com/kailash45s/trackpro.eu/blob/main/src/pages/Reports.tsx): `src/pages/Reports.tsx`
- [Invoices and quotes](https://github.com/kailash45s/trackpro.eu/blob/main/src/pages/Invoices.tsx): `src/pages/Invoices.tsx`
- [Client service report](https://github.com/kailash45s/trackpro.eu/blob/main/src/lib/services/sendServiceReport.ts): `src/lib/services/sendServiceReport.ts`

### Data and services

- [Domain repositories](https://github.com/kailash45s/trackpro.eu/tree/main/src/lib/repositories): `src/lib/repositories`
- [Supabase and Postgres](https://github.com/kailash45s/trackpro.eu/blob/main/src/integrations/supabase/client.ts): `src/integrations/supabase/client.ts`
- [Edge functions](https://github.com/kailash45s/trackpro.eu/tree/main/supabase/functions): `supabase/functions`
- **Stripe**

### Other components

- **Employee**
- **Administrator**
- **End client**

## Connections

- Employee → Routes and access: uses app (evidence: `README.md`)
- Administrator → Routes and access: uses app (evidence: `README.md`)
- Routes and access → Auth and membership: guards routes (evidence: `src/App.tsx`)
- Routes and access → Plan entitlements: checks access (evidence: `src/App.tsx`)
- Employee → Time sessions: records work (evidence: `README.md`)
- Employee → Work timer: tracks time (evidence: `README.md`)
- Time sessions → GPS and geofence: uses GPS (evidence: `README.md`)
- Work timer → GPS and geofence: uses GPS (evidence: `src/hooks/useWorkTimer.ts`)
- Work timer → Offline queue and cache: queues writes (evidence: `src/hooks/useWorkTimer.ts`)
- Time sessions → Offline queue and cache: queues writes (evidence: `README.md`)
- Offline queue and cache → Supabase and Postgres: syncs writes (evidence: `README.md`)
- Administrator → Work orders: assigns work (evidence: `README.md`)
- Employee → Work orders: completes assigned (evidence: `README.md`)
- Administrator → Planning and absences: plans team (evidence: `README.md`)
- Administrator → Workplaces: manages sites (evidence: `README.md`)
- Administrator → Clients and services: manages records (evidence: `README.md`)
- Administrator → Monthly closing: closes month (evidence: `README.md`)
- Monthly closing → End client: requests validation (evidence: `README.md`)
- Administrator → Reports and exports: exports work (evidence: `README.md`)
- Employee → Reports and exports: exports own work (evidence: `README.md`)
- Administrator → Invoices and quotes: creates documents (evidence: `README.md`)
- Invoices and quotes → Stripe: takes payments (evidence: `README.md`)
- Employee → Client service report: sends report (evidence: `README.md`)
- Client service report → End client: delivers PDF (evidence: `README.md`)
- Time sessions → Domain repositories: stores records
- Work orders → Domain repositories: stores orders
- Workplaces → Domain repositories: reads and writes (evidence: `src/components/workplaces/WorkplacesManager.tsx`)
- Clients and services → Domain repositories: accesses records
- Domain repositories → Supabase and Postgres: accesses Postgres (evidence: `README.md`)
- Auth and membership → Supabase and Postgres: loads membership (evidence: `src/services/auth/membershipService.ts`)
- Plan entitlements → Supabase and Postgres: loads subscription (evidence: `src/services/subscription/subscription-service.ts`)
- Supabase and Postgres → Edge functions: hosts functions (evidence: `README.md`)
