# phrase0/tilli architecture

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

- Interactive diagram: https://gitdiagram.com/phrase0/tilli
- Repository: https://github.com/phrase0/tilli

## Overview

Tilli is a session-based merchant sales and inventory app. Its central workflow is to create a sales session with categories, products, currency and discounts; record checkout transactions; then review transaction history and sales or product-performance reports by date. The tree also shows QR-code management and report sharing. The README is empty, and several view models and repository implementations were not sampled, so uncertain wiring is left out; the graph focuses on the visible entry points, named capabilities and directly evidenced calls.

Main entry points: [`Tilli/View/CalendarPage/SessionDetailFromCalendarView.swift`](https://github.com/phrase0/tilli/blob/develop/Tilli/View/CalendarPage/SessionDetailFromCalendarView.swift) (Session reports), [`Tilli/Data/CoreData/Persistence.swift`](https://github.com/phrase0/tilli/blob/develop/Tilli/Data/CoreData/Persistence.swift) (Core Data stack), [`Tilli/ContentView.swift`](https://github.com/phrase0/tilli/blob/develop/Tilli/ContentView.swift) (App interface), [`Tilli/ViewModel/AddSessionViewModel.swift`](https://github.com/phrase0/tilli/blob/develop/Tilli/ViewModel/AddSessionViewModel.swift) (Session editor logic)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App and navigation"]
  node_app["App state<br/>[AppState.swift]"]
  node_root["App interface<br/>[ContentView.swift]"]
  node_qr_ui["Merchant QR code"]
end

subgraph group_sessions["Sessions and catalog"]
  node_sessions_ui["Sessions<br/>[SessionsView.swift]"]
  node_session_form["Session editor"]
  node_session_vm["Session editor logic"]
  node_session_model["Session domain<br/>[SessionModel.swift]"]
  node_product_ui["Product details"]
  node_product_vm["Product editing"]
end

subgraph group_sales["Checkout and sales"]
  node_session_detail["Session workspace"]
  node_checkout["Checkout flow"]
  node_cash["Cash payment"]
  node_epayment["E-payment<br/>[EPaymentView.swift]"]
  node_transaction_ui["Transaction history"]
end

subgraph group_insights["Reports and sharing"]
  node_calendar["Calendar reports<br/>[CalendarView.swift]"]
  node_calendar_detail["Session reports"]
  node_product_performance["Product performance"]
  node_sales_analytics["Sales analytics"]
  node_share["Share sheet"]
end

subgraph group_storage["Persistence"]
  node_product_repo["Product repository"]
  node_transaction_data["Transaction queries"]
  node_qr_data["QR code manager"]
  node_persistence[("Core Data stack<br/>[Persistence.swift]")]
  node_session_data["Session manager"]
end

node_merchant(("Merchant"))

node_merchant -->|"uses"| node_root
node_root -->|"reads state"| node_app
node_root -->|"presents"| node_sessions_ui
node_sessions_ui -->|"edits sessions"| node_session_form
node_session_form -->|"delegates"| node_session_vm
node_session_vm -->|"fetches products"| node_product_repo
node_session_vm -->|"counts transactions"| node_transaction_data
node_session_detail -->|"opens checkout"| node_checkout
node_checkout -->|"offers payment"| node_cash
node_checkout -->|"offers payment"| node_epayment
node_calendar_detail -->|"presents"| node_transaction_ui
node_calendar_detail -->|"loads report"| node_product_performance
node_calendar_detail -->|"loads report"| node_sales_analytics
node_calendar_detail -->|"shares export"| node_share
node_calendar_detail -->|"loads transactions"| node_transaction_data
node_qr_ui -->|"manages image"| node_qr_data
node_qr_data -->|"uses store"| node_persistence
node_session_data -->|"uses store"| node_persistence
node_transaction_data -->|"queries store"| node_persistence
node_product_repo -->|"uses store"| node_persistence

click node_app "https://github.com/phrase0/tilli/blob/develop/Tilli/AppState.swift"
click node_root "https://github.com/phrase0/tilli/blob/develop/Tilli/ContentView.swift"
click node_sessions_ui "https://github.com/phrase0/tilli/blob/develop/Tilli/View/SessionPage/SessionsView.swift"
click node_session_form "https://github.com/phrase0/tilli/blob/develop/Tilli/View/SessionPage/AddSessionView.swift"
click node_session_vm "https://github.com/phrase0/tilli/blob/develop/Tilli/ViewModel/AddSessionViewModel.swift"
click node_session_model "https://github.com/phrase0/tilli/blob/develop/Tilli/Model/Domain/SessionModel.swift"
click node_product_ui "https://github.com/phrase0/tilli/blob/develop/Tilli/View/DetailPage/ProductDetailView.swift"
click node_product_vm "https://github.com/phrase0/tilli/blob/develop/Tilli/ViewModel/AddNewProductViewModel.swift"
click node_product_repo "https://github.com/phrase0/tilli/blob/develop/Tilli/Data/Repositories/ProductRepository.swift"
click node_session_detail "https://github.com/phrase0/tilli/blob/develop/Tilli/View/DetailPage/SessionDetailView.swift"
click node_checkout "https://github.com/phrase0/tilli/blob/develop/Tilli/View/CheckoutPage/CheckoutFlowView.swift"
click node_cash "https://github.com/phrase0/tilli/blob/develop/Tilli/View/CheckoutPage/CashPaymentView.swift"
click node_epayment "https://github.com/phrase0/tilli/blob/develop/Tilli/View/CheckoutPage/EPaymentView.swift"
click node_transaction_ui "https://github.com/phrase0/tilli/blob/develop/Tilli/View/DetailPage/TransactionHistoryView.swift"
click node_transaction_data "https://github.com/phrase0/tilli/blob/develop/Tilli/Data/Repositories/TransactionDataManager.swift"
click node_calendar "https://github.com/phrase0/tilli/blob/develop/Tilli/View/CalendarPage/CalendarView.swift"
click node_calendar_detail "https://github.com/phrase0/tilli/blob/develop/Tilli/View/CalendarPage/SessionDetailFromCalendarView.swift"
click node_product_performance "https://github.com/phrase0/tilli/blob/develop/Tilli/Service/Analytics/ProductPerformanceService.swift"
click node_sales_analytics "https://github.com/phrase0/tilli/blob/develop/Tilli/Service/Analytics/SalesAnalyticsService.swift"
click node_share "https://github.com/phrase0/tilli/blob/develop/Tilli/Utilities/UIComponents/ActivityViewController.swift"
click node_qr_ui "https://github.com/phrase0/tilli/blob/develop/Tilli/View/QRCodePage/MerchantQRCodeView.swift"
click node_qr_data "https://github.com/phrase0/tilli/blob/develop/Tilli/Data/Repositories/QRCodeDataManager.swift"
click node_persistence "https://github.com/phrase0/tilli/blob/develop/Tilli/Data/CoreData/Persistence.swift"
click node_session_data "https://github.com/phrase0/tilli/blob/develop/Tilli/Data/Repositories/SessionDataManager.swift"

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_root,node_qr_ui toneBlue
class node_sessions_ui,node_session_form,node_session_vm,node_session_model,node_product_ui,node_product_vm toneAmber
class node_session_detail,node_checkout,node_cash,node_epayment,node_transaction_ui toneMint
class node_calendar,node_calendar_detail,node_product_performance,node_sales_analytics,node_share toneRose
class node_product_repo,node_transaction_data,node_qr_data,node_persistence,node_session_data,node_merchant toneIndigo
```

## Components

### App and navigation

- [App state](https://github.com/phrase0/tilli/blob/develop/Tilli/AppState.swift): `Tilli/AppState.swift`
- [App interface](https://github.com/phrase0/tilli/blob/develop/Tilli/ContentView.swift): `Tilli/ContentView.swift`
- [Merchant QR code](https://github.com/phrase0/tilli/blob/develop/Tilli/View/QRCodePage/MerchantQRCodeView.swift): `Tilli/View/QRCodePage/MerchantQRCodeView.swift`

### Sessions and catalog

- [Sessions](https://github.com/phrase0/tilli/blob/develop/Tilli/View/SessionPage/SessionsView.swift): `Tilli/View/SessionPage/SessionsView.swift`
- [Session editor](https://github.com/phrase0/tilli/blob/develop/Tilli/View/SessionPage/AddSessionView.swift): `Tilli/View/SessionPage/AddSessionView.swift`
- [Session editor logic](https://github.com/phrase0/tilli/blob/develop/Tilli/ViewModel/AddSessionViewModel.swift): `Tilli/ViewModel/AddSessionViewModel.swift`
- [Session domain](https://github.com/phrase0/tilli/blob/develop/Tilli/Model/Domain/SessionModel.swift): `Tilli/Model/Domain/SessionModel.swift`
- [Product details](https://github.com/phrase0/tilli/blob/develop/Tilli/View/DetailPage/ProductDetailView.swift): `Tilli/View/DetailPage/ProductDetailView.swift`
- [Product editing](https://github.com/phrase0/tilli/blob/develop/Tilli/ViewModel/AddNewProductViewModel.swift): `Tilli/ViewModel/AddNewProductViewModel.swift`

### Checkout and sales

- [Session workspace](https://github.com/phrase0/tilli/blob/develop/Tilli/View/DetailPage/SessionDetailView.swift): `Tilli/View/DetailPage/SessionDetailView.swift`
- [Checkout flow](https://github.com/phrase0/tilli/blob/develop/Tilli/View/CheckoutPage/CheckoutFlowView.swift): `Tilli/View/CheckoutPage/CheckoutFlowView.swift`
- [Cash payment](https://github.com/phrase0/tilli/blob/develop/Tilli/View/CheckoutPage/CashPaymentView.swift): `Tilli/View/CheckoutPage/CashPaymentView.swift`
- [E-payment](https://github.com/phrase0/tilli/blob/develop/Tilli/View/CheckoutPage/EPaymentView.swift): `Tilli/View/CheckoutPage/EPaymentView.swift`
- [Transaction history](https://github.com/phrase0/tilli/blob/develop/Tilli/View/DetailPage/TransactionHistoryView.swift): `Tilli/View/DetailPage/TransactionHistoryView.swift`

### Reports and sharing

- [Calendar reports](https://github.com/phrase0/tilli/blob/develop/Tilli/View/CalendarPage/CalendarView.swift): `Tilli/View/CalendarPage/CalendarView.swift`
- [Session reports](https://github.com/phrase0/tilli/blob/develop/Tilli/View/CalendarPage/SessionDetailFromCalendarView.swift): `Tilli/View/CalendarPage/SessionDetailFromCalendarView.swift`
- [Product performance](https://github.com/phrase0/tilli/blob/develop/Tilli/Service/Analytics/ProductPerformanceService.swift): `Tilli/Service/Analytics/ProductPerformanceService.swift`
- [Sales analytics](https://github.com/phrase0/tilli/blob/develop/Tilli/Service/Analytics/SalesAnalyticsService.swift): `Tilli/Service/Analytics/SalesAnalyticsService.swift`
- [Share sheet](https://github.com/phrase0/tilli/blob/develop/Tilli/Utilities/UIComponents/ActivityViewController.swift): `Tilli/Utilities/UIComponents/ActivityViewController.swift`

### Persistence

- [Product repository](https://github.com/phrase0/tilli/blob/develop/Tilli/Data/Repositories/ProductRepository.swift): `Tilli/Data/Repositories/ProductRepository.swift`
- [Transaction queries](https://github.com/phrase0/tilli/blob/develop/Tilli/Data/Repositories/TransactionDataManager.swift): `Tilli/Data/Repositories/TransactionDataManager.swift`
- [QR code manager](https://github.com/phrase0/tilli/blob/develop/Tilli/Data/Repositories/QRCodeDataManager.swift): `Tilli/Data/Repositories/QRCodeDataManager.swift`
- [Core Data stack](https://github.com/phrase0/tilli/blob/develop/Tilli/Data/CoreData/Persistence.swift): `Tilli/Data/CoreData/Persistence.swift`
- [Session manager](https://github.com/phrase0/tilli/blob/develop/Tilli/Data/Repositories/SessionDataManager.swift): `Tilli/Data/Repositories/SessionDataManager.swift`

### Other components

- **Merchant**

## Connections

- Merchant → App interface: uses
- App interface → App state: reads state
- App interface → Sessions: presents
- Sessions → Session editor: edits sessions
- Session editor → Session editor logic: delegates
- Session editor logic → Product repository: fetches products
- Session editor logic → Transaction queries: counts transactions
- Session workspace → Checkout flow: opens checkout
- Checkout flow → Cash payment: offers payment
- Checkout flow → E-payment: offers payment
- Session reports → Transaction history: presents
- Session reports → Product performance: loads report
- Session reports → Sales analytics: loads report
- Session reports → Share sheet: shares export
- Session reports → Transaction queries: loads transactions
- Merchant QR code → QR code manager: manages image
- QR code manager → Core Data stack: uses store
- Session manager → Core Data stack: uses store
- Transaction queries → Core Data stack: queries store
- Product repository → Core Data stack: uses store
