# keyboard-cyber/fronttest architecture

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

- Interactive diagram: https://gitdiagram.com/keyboard-cyber/fronttest
- Repository: https://github.com/keyboard-cyber/fronttest

## Overview

Taxe Mobile Agent is an offline-first collection app for field agents. The main workflow is agent sign-in, recording a payment into a local queue, then synchronizing queued payments and reference data with the backend; agents can review payment history and access receipts. The repository also contains controller scan/search routes and receipt printing/QR capabilities. The graph reflects documented features and source-index references; some route and service internals were not sampled, so uncertain connections are omitted.

Main entry points: [`src/database/repositories.ts`](https://github.com/keyboard-cyber/fronttest/blob/main/src/database/repositories.ts) (Local repositories), [`src/contexts/AuthContext.tsx`](https://github.com/keyboard-cyber/fronttest/blob/main/src/contexts/AuthContext.tsx) (Authentication context), [`app/payment/new.tsx`](https://github.com/keyboard-cyber/fronttest/blob/main/app/payment/new.tsx) (New payment route), [`src/contexts/SyncContext.tsx`](https://github.com/keyboard-cyber/fronttest/blob/main/src/contexts/SyncContext.tsx) (Sync context)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Agent app"]
  node_controller_scan["Controller scan<br/>[scan.tsx]"]
  node_controller_search["Controller search<br/>[search.tsx]"]
  node_login_screen["Login screen<br/>[LoginScreen.tsx]"]
  node_home_screen["Home screen<br/>[HomeScreen.tsx]"]
  node_profile_screen["Profile screen<br/>[ProfileScreen.tsx]"]
  node_auth["Authentication context<br/>[AuthContext.tsx]"]
end

subgraph group_domain["Payments and receipts"]
  node_payment_route["New payment route<br/>[new.tsx]"]
  node_history_route["Payment history<br/>[history.tsx]"]
  node_receipt_route["Receipt routes<br/>[&#91;uuid&#93;.tsx]"]
  node_preview_route["Payment preview<br/>[&#91;uuid&#93;.tsx]"]
  node_payment_screen["Payment screen"]
  node_history_screen["History screen<br/>[HistoryScreen.tsx]"]
  node_receipt_screen["Receipt screen<br/>[ReceiptScreen.tsx]"]
  node_printer["Receipt printer<br/>[printer.service.ts]"]
  node_qr["QR generation<br/>[qrcode.service.ts]"]
end

subgraph group_sync["Offline and sync"]
  node_sync_context["Sync context<br/>[SyncContext.tsx]"]
  node_sync_service["Sync service<br/>[sync.service.ts]"]
end

subgraph group_infra["Local and remote services"]
  node_api["API client<br/>[api.service.ts]"]
  node_repositories["Local repositories<br/>[repositories.ts]"]
  node_sqlite[("SQLite database<br/>[database.ts]")]
  node_notifications["Notifications"]
end

node_agent(("Field agent"))
node_backend["Backend API"]

node_agent -->|"records payment"| node_payment_route
node_agent -->|"reviews payments"| node_history_route
node_agent -->|"signs in"| node_login_screen
node_payment_route -->|"uses context"| node_auth
node_payment_route -->|"stores locally"| node_repositories
node_payment_route -->|"uses notifications"| node_notifications
node_payment_route -->|"uses sync hook"| node_sync_context
node_history_route -->|"reads payments"| node_repositories
node_history_route -->|"requests sync"| node_sync_service
node_history_route -->|"uses printer"| node_printer
node_receipt_route -->|"loads payment"| node_repositories
node_preview_route -->|"uses printer"| node_printer
node_preview_route -->|"loads payment"| node_repositories
node_controller_scan -->|"uses local data"| node_repositories
node_controller_search -->|"uses local data"| node_repositories
node_login_screen -->|"uses context"| node_auth
node_home_screen -->|"uses context"| node_auth
node_home_screen -->|"reads local data"| node_repositories
node_payment_screen -->|"uses local data"| node_repositories
node_payment_screen -->|"uses context"| node_auth
node_history_screen -->|"uses local data"| node_repositories
node_history_screen -->|"uses context"| node_auth
node_receipt_screen -->|"loads payment"| node_repositories
node_receipt_screen -->|"uses context"| node_auth
node_profile_screen -->|"uses context"| node_auth
node_auth -->|"reads and saves"| node_repositories
node_auth -->|"authenticates"| node_api
node_sync_context -->|"checks session"| node_auth
node_sync_context -->|"starts sync"| node_sync_service
node_sync_context -->|"loads queue and cache"| node_repositories
node_sync_context -->|"reports sync"| node_notifications
node_sync_service -->|"sends payments"| node_api
node_sync_service -->|"reads queue; updates status"| node_repositories
node_api -->|"HTTP requests"| node_backend
node_repositories -->|"executes data operations"| node_sqlite
node_printer -->|"uses QR data"| node_qr

click node_payment_route "https://github.com/keyboard-cyber/fronttest/blob/main/app/payment/new.tsx"
click node_history_route "https://github.com/keyboard-cyber/fronttest/blob/main/app/(tabs)/history.tsx"
click node_receipt_route "https://github.com/keyboard-cyber/fronttest/blob/main/app/payment/receipt/%5Buuid%5D.tsx"
click node_preview_route "https://github.com/keyboard-cyber/fronttest/blob/main/app/payment/preview/%5Buuid%5D.tsx"
click node_controller_scan "https://github.com/keyboard-cyber/fronttest/blob/main/app/(controller)/scan.tsx"
click node_controller_search "https://github.com/keyboard-cyber/fronttest/blob/main/app/(controller)/search.tsx"
click node_login_screen "https://github.com/keyboard-cyber/fronttest/blob/main/src/screens/auth/LoginScreen.tsx"
click node_home_screen "https://github.com/keyboard-cyber/fronttest/blob/main/src/screens/home/HomeScreen.tsx"
click node_payment_screen "https://github.com/keyboard-cyber/fronttest/blob/main/src/screens/payment/NewPaymentScreen.tsx"
click node_history_screen "https://github.com/keyboard-cyber/fronttest/blob/main/src/screens/history/HistoryScreen.tsx"
click node_receipt_screen "https://github.com/keyboard-cyber/fronttest/blob/main/src/screens/receipt/ReceiptScreen.tsx"
click node_profile_screen "https://github.com/keyboard-cyber/fronttest/blob/main/src/screens/profile/ProfileScreen.tsx"
click node_auth "https://github.com/keyboard-cyber/fronttest/blob/main/src/contexts/AuthContext.tsx"
click node_sync_context "https://github.com/keyboard-cyber/fronttest/blob/main/src/contexts/SyncContext.tsx"
click node_sync_service "https://github.com/keyboard-cyber/fronttest/blob/main/src/services/sync.service.ts"
click node_api "https://github.com/keyboard-cyber/fronttest/blob/main/src/services/api.service.ts"
click node_repositories "https://github.com/keyboard-cyber/fronttest/blob/main/src/database/repositories.ts"
click node_sqlite "https://github.com/keyboard-cyber/fronttest/blob/main/src/database/database.ts"
click node_notifications "https://github.com/keyboard-cyber/fronttest/blob/main/src/services/notification.service.ts"
click node_printer "https://github.com/keyboard-cyber/fronttest/blob/main/src/services/printer.service.ts"
click node_qr "https://github.com/keyboard-cyber/fronttest/blob/main/src/services/qrcode.service.ts"

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_controller_scan,node_controller_search,node_login_screen,node_home_screen,node_profile_screen,node_auth toneBlue
class node_payment_route,node_history_route,node_receipt_route,node_preview_route,node_payment_screen,node_history_screen,node_receipt_screen,node_printer,node_qr toneAmber
class node_sync_context,node_sync_service,node_backend toneMint
class node_api,node_repositories,node_sqlite,node_notifications toneRose
class node_agent toneIndigo
```

## Components

### Agent app

- [Controller scan](https://github.com/keyboard-cyber/fronttest/blob/main/app/(controller)/scan.tsx): `app/(controller)/scan.tsx`
- [Controller search](https://github.com/keyboard-cyber/fronttest/blob/main/app/(controller)/search.tsx): `app/(controller)/search.tsx`
- [Login screen](https://github.com/keyboard-cyber/fronttest/blob/main/src/screens/auth/LoginScreen.tsx): `src/screens/auth/LoginScreen.tsx`
- [Home screen](https://github.com/keyboard-cyber/fronttest/blob/main/src/screens/home/HomeScreen.tsx): `src/screens/home/HomeScreen.tsx`
- [Profile screen](https://github.com/keyboard-cyber/fronttest/blob/main/src/screens/profile/ProfileScreen.tsx): `src/screens/profile/ProfileScreen.tsx`
- [Authentication context](https://github.com/keyboard-cyber/fronttest/blob/main/src/contexts/AuthContext.tsx): `src/contexts/AuthContext.tsx`

### Payments and receipts

- [New payment route](https://github.com/keyboard-cyber/fronttest/blob/main/app/payment/new.tsx): `app/payment/new.tsx`
- [Payment history](https://github.com/keyboard-cyber/fronttest/blob/main/app/(tabs)/history.tsx): `app/(tabs)/history.tsx`
- [Receipt routes](https://github.com/keyboard-cyber/fronttest/blob/main/app/payment/receipt/%5Buuid%5D.tsx): `app/payment/receipt/[uuid].tsx`
- [Payment preview](https://github.com/keyboard-cyber/fronttest/blob/main/app/payment/preview/%5Buuid%5D.tsx): `app/payment/preview/[uuid].tsx`
- [Payment screen](https://github.com/keyboard-cyber/fronttest/blob/main/src/screens/payment/NewPaymentScreen.tsx): `src/screens/payment/NewPaymentScreen.tsx`
- [History screen](https://github.com/keyboard-cyber/fronttest/blob/main/src/screens/history/HistoryScreen.tsx): `src/screens/history/HistoryScreen.tsx`
- [Receipt screen](https://github.com/keyboard-cyber/fronttest/blob/main/src/screens/receipt/ReceiptScreen.tsx): `src/screens/receipt/ReceiptScreen.tsx`
- [Receipt printer](https://github.com/keyboard-cyber/fronttest/blob/main/src/services/printer.service.ts): `src/services/printer.service.ts`
- [QR generation](https://github.com/keyboard-cyber/fronttest/blob/main/src/services/qrcode.service.ts): `src/services/qrcode.service.ts`

### Offline and sync

- [Sync context](https://github.com/keyboard-cyber/fronttest/blob/main/src/contexts/SyncContext.tsx): `src/contexts/SyncContext.tsx`
- [Sync service](https://github.com/keyboard-cyber/fronttest/blob/main/src/services/sync.service.ts): `src/services/sync.service.ts`

### Local and remote services

- [API client](https://github.com/keyboard-cyber/fronttest/blob/main/src/services/api.service.ts): `src/services/api.service.ts`
- [Local repositories](https://github.com/keyboard-cyber/fronttest/blob/main/src/database/repositories.ts): `src/database/repositories.ts`
- [SQLite database](https://github.com/keyboard-cyber/fronttest/blob/main/src/database/database.ts): `src/database/database.ts`
- [Notifications](https://github.com/keyboard-cyber/fronttest/blob/main/src/services/notification.service.ts): `src/services/notification.service.ts`

### Other components

- **Field agent**
- **Backend API**

## Connections

- Field agent → New payment route: records payment
- Field agent → Payment history: reviews payments
- Field agent → Login screen: signs in
- New payment route → Authentication context: uses context (evidence: `app/payment/new.tsx`)
- New payment route → Local repositories: stores locally (evidence: `app/payment/new.tsx`)
- New payment route → Notifications: uses notifications (evidence: `app/payment/new.tsx`)
- New payment route → Sync context: uses sync hook (evidence: `app/payment/new.tsx`)
- Payment history → Local repositories: reads payments (evidence: `app/(tabs)/history.tsx`)
- Payment history → Sync service: requests sync (evidence: `app/(tabs)/history.tsx`)
- Payment history → Receipt printer: uses printer (evidence: `app/(tabs)/history.tsx`)
- Receipt routes → Local repositories: loads payment (evidence: `app/payment/receipt/[uuid].tsx`)
- Payment preview → Receipt printer: uses printer (evidence: `app/payment/preview/[uuid].tsx`)
- Payment preview → Local repositories: loads payment (evidence: `app/payment/preview/[uuid].tsx`)
- Controller scan → Local repositories: uses local data (evidence: `app/(controller)/scan.tsx`)
- Controller search → Local repositories: uses local data (evidence: `app/(controller)/search.tsx`)
- Login screen → Authentication context: uses context (evidence: `src/screens/auth/LoginScreen.tsx`)
- Home screen → Authentication context: uses context (evidence: `src/screens/home/HomeScreen.tsx`)
- Home screen → Local repositories: reads local data (evidence: `src/screens/home/HomeScreen.tsx`)
- Payment screen → Local repositories: uses local data (evidence: `src/screens/payment/NewPaymentScreen.tsx`)
- Payment screen → Authentication context: uses context (evidence: `src/screens/payment/NewPaymentScreen.tsx`)
- History screen → Local repositories: uses local data (evidence: `src/screens/history/HistoryScreen.tsx`)
- History screen → Authentication context: uses context (evidence: `src/screens/history/HistoryScreen.tsx`)
- Receipt screen → Local repositories: loads payment (evidence: `src/screens/receipt/ReceiptScreen.tsx`)
- Receipt screen → Authentication context: uses context (evidence: `src/screens/receipt/ReceiptScreen.tsx`)
- Profile screen → Authentication context: uses context (evidence: `src/screens/profile/ProfileScreen.tsx`)
- Authentication context → Local repositories: reads and saves (evidence: `src/contexts/AuthContext.tsx`)
- Authentication context → API client: authenticates (evidence: `src/contexts/AuthContext.tsx`)
- Sync context → Authentication context: checks session (evidence: `src/contexts/SyncContext.tsx`)
- Sync context → Sync service: starts sync (evidence: `src/contexts/SyncContext.tsx`)
- Sync context → Local repositories: loads queue and cache (evidence: `src/contexts/SyncContext.tsx`)
- Sync context → Notifications: reports sync (evidence: `src/contexts/SyncContext.tsx`)
- Sync service → API client: sends payments (evidence: `src/services/sync.service.ts`)
- Sync service → Local repositories: reads queue; updates status (evidence: `src/services/sync.service.ts`)
- API client → Backend API: HTTP requests
- Local repositories → SQLite database: executes data operations (evidence: `src/database/index.ts`)
- Receipt printer → QR generation: uses QR data (evidence: `src/services/printer.service.ts`)
