# manisuryalingineni/ca_ai_demo architecture

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

- Interactive diagram: https://gitdiagram.com/manisuryalingineni/ca_ai_demo
- Repository: https://github.com/manisuryalingineni/ca_ai_demo

## Overview

This is a local retail-management app for setting up a business and maintaining its customers, products, and vendors. The main workflow is to complete business setup, then manage those records through screens that call domain services, which validate and scope data before repository access to SQLite. The dashboard and purchase repository are also represented; the tree and excerpts do not establish a broader sales or purchasing workflow. Some screen-to-service links are supported by SOURCE INDEX references rather than inspected call bodies.

Main entry points: [`App.tsx`](https://github.com/manisuryalingineni/ca_ai_demo/blob/main/App.tsx) (App shell), [`src/repositories/businessRepository.ts`](https://github.com/manisuryalingineni/ca_ai_demo/blob/main/src/repositories/businessRepository.ts) (Business repository), [`src/database/database.ts`](https://github.com/manisuryalingineni/ca_ai_demo/blob/main/src/database/database.ts) (SQLite database), [`app/dashboard/index.tsx`](https://github.com/manisuryalingineni/ca_ai_demo/blob/main/app/dashboard/index.tsx) (Dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_screens["App screens"]
  node_app["App shell<br/>[App.tsx]"]
  node_setup["Business setup<br/>[index.tsx]"]
  node_dashboard["Dashboard<br/>[index.tsx]"]
  node_customers["Customer screens"]
  node_products["Product screens"]
  node_vendors["Vendor screens"]
end

subgraph group_services["Domain services"]
  node_business_service["Business service<br/>[businessService.ts]"]
  node_customer_service["Customer service<br/>[customerService.ts]"]
  node_product_service["Product service<br/>[productService.ts]"]
  node_vendor_service["Vendor service<br/>[vendorService.ts]"]
end

subgraph group_data["Persistence"]
  node_business_repo["Business repository"]
  node_customer_repo["Customer repository"]
  node_product_repo["Product repository"]
  node_vendor_repo["Vendor repository"]
  node_purchase_repo["Purchase repository"]
  node_database[("SQLite database<br/>[database.ts]")]
end

subgraph group_models["Domain models"]
  node_business_type["Business model<br/>[business.ts]"]
  node_customer_type["Customer model<br/>[customer.ts]"]
  node_product_type["Product model<br/>[product.ts]"]
  node_vendor_type["Vendor model<br/>[vendor.ts]"]
end

node_user(("Retail user"))

node_user -->|"uses"| node_app
node_app -.->|"routes to"| node_setup
node_app -.->|"routes to"| node_dashboard
node_app -.->|"routes to"| node_customers
node_app -.->|"routes to"| node_products
node_app -.->|"routes to"| node_vendors
node_setup -->|"calls"| node_business_service
node_dashboard -->|"reads"| node_business_repo
node_dashboard -->|"reads"| node_customer_repo
node_customers -->|"calls"| node_customer_service
node_products -->|"calls"| node_product_service
node_vendors -->|"calls"| node_vendor_service
node_business_service -->|"delegates to"| node_business_repo
node_customer_service -->|"checks business"| node_business_repo
node_customer_service -->|"delegates to"| node_customer_repo
node_product_service -->|"checks business"| node_business_repo
node_product_service -->|"delegates to"| node_product_repo
node_vendor_service -->|"checks business"| node_business_repo
node_vendor_service -->|"delegates to"| node_vendor_repo
node_business_repo -->|"queries"| node_database
node_customer_repo -->|"queries"| node_database
node_product_repo -->|"queries"| node_database
node_vendor_repo -->|"queries"| node_database
node_purchase_repo -->|"queries"| node_database

click node_app "https://github.com/manisuryalingineni/ca_ai_demo/blob/main/App.tsx"
click node_setup "https://github.com/manisuryalingineni/ca_ai_demo/blob/main/app/setup/index.tsx"
click node_dashboard "https://github.com/manisuryalingineni/ca_ai_demo/blob/main/app/dashboard/index.tsx"
click node_customers "https://github.com/manisuryalingineni/ca_ai_demo/tree/main/app/customers"
click node_products "https://github.com/manisuryalingineni/ca_ai_demo/tree/main/app/products"
click node_vendors "https://github.com/manisuryalingineni/ca_ai_demo/tree/main/app/vendors"
click node_business_service "https://github.com/manisuryalingineni/ca_ai_demo/blob/main/src/services/businessService.ts"
click node_customer_service "https://github.com/manisuryalingineni/ca_ai_demo/blob/main/src/services/customerService.ts"
click node_product_service "https://github.com/manisuryalingineni/ca_ai_demo/blob/main/src/services/productService.ts"
click node_vendor_service "https://github.com/manisuryalingineni/ca_ai_demo/blob/main/src/services/vendorService.ts"
click node_business_repo "https://github.com/manisuryalingineni/ca_ai_demo/blob/main/src/repositories/businessRepository.ts"
click node_customer_repo "https://github.com/manisuryalingineni/ca_ai_demo/blob/main/src/repositories/customerRepository.ts"
click node_product_repo "https://github.com/manisuryalingineni/ca_ai_demo/blob/main/src/repositories/productRepository.ts"
click node_vendor_repo "https://github.com/manisuryalingineni/ca_ai_demo/blob/main/src/repositories/vendorRepository.ts"
click node_purchase_repo "https://github.com/manisuryalingineni/ca_ai_demo/blob/main/src/repositories/purchaseRepository.ts"
click node_database "https://github.com/manisuryalingineni/ca_ai_demo/blob/main/src/database/database.ts"
click node_business_type "https://github.com/manisuryalingineni/ca_ai_demo/blob/main/src/types/business.ts"
click node_customer_type "https://github.com/manisuryalingineni/ca_ai_demo/blob/main/src/types/customer.ts"
click node_product_type "https://github.com/manisuryalingineni/ca_ai_demo/blob/main/src/types/product.ts"
click node_vendor_type "https://github.com/manisuryalingineni/ca_ai_demo/blob/main/src/types/vendor.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_app,node_setup,node_dashboard,node_customers,node_products,node_vendors,node_user toneBlue
class node_business_service,node_customer_service,node_product_service,node_vendor_service toneAmber
class node_business_repo,node_customer_repo,node_product_repo,node_vendor_repo,node_purchase_repo,node_database toneMint
class node_business_type,node_customer_type,node_product_type,node_vendor_type toneRose
```

## Components

### App screens

- [App shell](https://github.com/manisuryalingineni/ca_ai_demo/blob/main/App.tsx): `App.tsx`
- [Business setup](https://github.com/manisuryalingineni/ca_ai_demo/blob/main/app/setup/index.tsx): `app/setup/index.tsx`
- [Dashboard](https://github.com/manisuryalingineni/ca_ai_demo/blob/main/app/dashboard/index.tsx): `app/dashboard/index.tsx`
- [Customer screens](https://github.com/manisuryalingineni/ca_ai_demo/tree/main/app/customers): `app/customers`
- [Product screens](https://github.com/manisuryalingineni/ca_ai_demo/tree/main/app/products): `app/products`
- [Vendor screens](https://github.com/manisuryalingineni/ca_ai_demo/tree/main/app/vendors): `app/vendors`

### Domain services

- [Business service](https://github.com/manisuryalingineni/ca_ai_demo/blob/main/src/services/businessService.ts): `src/services/businessService.ts`
- [Customer service](https://github.com/manisuryalingineni/ca_ai_demo/blob/main/src/services/customerService.ts): `src/services/customerService.ts`
- [Product service](https://github.com/manisuryalingineni/ca_ai_demo/blob/main/src/services/productService.ts): `src/services/productService.ts`
- [Vendor service](https://github.com/manisuryalingineni/ca_ai_demo/blob/main/src/services/vendorService.ts): `src/services/vendorService.ts`

### Persistence

- [Business repository](https://github.com/manisuryalingineni/ca_ai_demo/blob/main/src/repositories/businessRepository.ts): `src/repositories/businessRepository.ts`
- [Customer repository](https://github.com/manisuryalingineni/ca_ai_demo/blob/main/src/repositories/customerRepository.ts): `src/repositories/customerRepository.ts`
- [Product repository](https://github.com/manisuryalingineni/ca_ai_demo/blob/main/src/repositories/productRepository.ts): `src/repositories/productRepository.ts`
- [Vendor repository](https://github.com/manisuryalingineni/ca_ai_demo/blob/main/src/repositories/vendorRepository.ts): `src/repositories/vendorRepository.ts`
- [Purchase repository](https://github.com/manisuryalingineni/ca_ai_demo/blob/main/src/repositories/purchaseRepository.ts): `src/repositories/purchaseRepository.ts`
- [SQLite database](https://github.com/manisuryalingineni/ca_ai_demo/blob/main/src/database/database.ts): `src/database/database.ts`

### Domain models

- [Business model](https://github.com/manisuryalingineni/ca_ai_demo/blob/main/src/types/business.ts): `src/types/business.ts`
- [Customer model](https://github.com/manisuryalingineni/ca_ai_demo/blob/main/src/types/customer.ts): `src/types/customer.ts`
- [Product model](https://github.com/manisuryalingineni/ca_ai_demo/blob/main/src/types/product.ts): `src/types/product.ts`
- [Vendor model](https://github.com/manisuryalingineni/ca_ai_demo/blob/main/src/types/vendor.ts): `src/types/vendor.ts`

### Other components

- **Retail user**

## Connections

- Retail user → App shell: uses
- App shell → Business setup: routes to
- App shell → Dashboard: routes to
- App shell → Customer screens: routes to
- App shell → Product screens: routes to
- App shell → Vendor screens: routes to
- Business setup → Business service: calls (evidence: `app/setup/index.tsx`)
- Dashboard → Business repository: reads (evidence: `app/dashboard/index.tsx`)
- Dashboard → Customer repository: reads (evidence: `app/dashboard/index.tsx`)
- Customer screens → Customer service: calls (evidence: `app/customers/index.tsx`)
- Product screens → Product service: calls (evidence: `app/products/index.tsx`)
- Vendor screens → Vendor service: calls (evidence: `app/vendors/index.tsx`)
- Business service → Business repository: delegates to (evidence: `src/services/businessService.ts`)
- Customer service → Business repository: checks business (evidence: `src/services/customerService.ts`)
- Customer service → Customer repository: delegates to (evidence: `src/services/customerService.ts`)
- Product service → Business repository: checks business (evidence: `src/services/productService.ts`)
- Product service → Product repository: delegates to (evidence: `src/services/productService.ts`)
- Vendor service → Business repository: checks business (evidence: `src/services/vendorService.ts`)
- Vendor service → Vendor repository: delegates to (evidence: `src/services/vendorService.ts`)
- Business repository → SQLite database: queries (evidence: `src/repositories/businessRepository.ts`)
- Customer repository → SQLite database: queries (evidence: `src/repositories/customerRepository.ts`)
- Product repository → SQLite database: queries (evidence: `src/repositories/productRepository.ts`)
- Vendor repository → SQLite database: queries (evidence: `src/repositories/vendorRepository.ts`)
- Purchase repository → SQLite database: queries (evidence: `src/repositories/purchaseRepository.ts`)
