# sarathkumargit/k-tech-mobile architecture

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

- Interactive diagram: https://gitdiagram.com/sarathkumargit/k-tech-mobile
- Repository: https://github.com/sarathkumargit/k-tech-mobile

## Overview

K-Tech is a Supabase-backed mobile-phone e-commerce site with storefront, checkout, customer accounts, repairs and an administrative panel. The principal customer flow is browsing products and offers, adding products to a signed-in cart, then placing an order; separate admin workflows manage catalog, orders, users, repairs and shop settings. The README documents the Supabase Auth, Postgres/RLS and Storage boundary. Routes and service files not excerpted are represented at their exact paths based on the tree and README; their internal call relationships are not assumed.

Main entry points: [`src/lib/supabase.ts`](https://github.com/sarathkumargit/k-tech-mobile/blob/main/src/lib/supabase.ts) (Supabase client), [`src/services/productService.ts`](https://github.com/sarathkumargit/k-tech-mobile/blob/main/src/services/productService.ts) (Catalog service), [`src/routes/index.tsx`](https://github.com/sarathkumargit/k-tech-mobile/blob/main/src/routes/index.tsx) (Store pages), [`src/routes/admin.index.tsx`](https://github.com/sarathkumargit/k-tech-mobile/blob/main/src/routes/admin.index.tsx) (Admin pages)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Shopfront"]
  node_storepages["Store pages<br/>[index.tsx]"]
  node_shopbrowse["Browse catalog<br/>[shop.tsx]"]
  node_productdetail["Product detail<br/>[product.$slug.tsx]"]
  node_productcards["Product cards<br/>[product-card.tsx]"]
  node_repair["Repair booking<br/>[repair-modal.tsx]"]
end

subgraph group_commerce["Commerce"]
  node_repairservice["Repair records<br/>[repairService.ts]"]
  node_cartpage["Cart<br/>[cart.tsx]"]
  node_carthook["Cart state<br/>[use-cart.ts]"]
  node_cartservice["Cart operations<br/>[cartService.ts]"]
  node_checkout["Checkout<br/>[checkout.tsx]"]
  node_orderservice["Order operations<br/>[orderService.ts]"]
  node_productservice["Catalog service<br/>[productService.ts]"]
  node_categoryservice["Category service<br/>[categoryService.ts]"]
  node_offerservice["Offer service<br/>[offerService.ts]"]
end

subgraph group_identity["Identity"]
  node_account["Account pages<br/>[account.tsx]"]
  node_authcontext["Session and profile<br/>[auth-context.tsx]"]
  node_authroutes["Sign-in and signup<br/>[login.tsx]"]
  node_userservice["User service<br/>[userService.ts]"]
end

subgraph group_admin["Administration"]
  node_adminroutes["Admin pages<br/>[admin.index.tsx]"]
  node_productform["Product editor<br/>[product-form.tsx]"]
  node_adminservices["Admin services<br/>[adminService.ts]"]
end

subgraph group_platform["Data platform"]
  node_settingshook["Site settings state"]
  node_settingsservice["Settings service<br/>[settingsService.ts]"]
  node_storageservice["Image storage<br/>[storageService.ts]"]
  node_supabaseclient["Supabase client<br/>[supabase.ts]"]
  node_supabase[("Supabase backend")]
  node_dbtypes["Database types<br/>[database.ts]"]
end

node_shopper(("Shopper"))
node_adminuser(("Admin user"))

node_shopper -->|"opens"| node_storepages
node_shopper -->|"browses"| node_shopbrowse
node_shopper -->|"manages cart"| node_cartpage
node_shopper -->|"checks out"| node_checkout
node_adminuser -->|"manages shop"| node_adminroutes
node_storepages -->|"renders"| node_productcards
node_storepages -.->|"loads catalog"| node_productservice
node_storepages -.->|"loads categories"| node_categoryservice
node_storepages -->|"opens booking"| node_repair
node_shopbrowse -.->|"loads catalog"| node_productservice
node_productdetail -.->|"loads product"| node_productservice
node_productdetail -.->|"adds item"| node_carthook
node_productcards -->|"adds item"| node_carthook
node_repair -.->|"submits request"| node_repairservice
node_cartpage -->|"uses state"| node_carthook
node_carthook -->|"runs mutations"| node_cartservice
node_cartservice -->|"resolves products"| node_productservice
node_checkout -->|"reads cart"| node_carthook
node_checkout -.->|"places order"| node_orderservice
node_authroutes -.->|"uses session"| node_authcontext
node_account -.->|"uses session"| node_authcontext
node_authcontext -->|"loads profile"| node_userservice
node_authcontext -->|"checks configuration"| node_supabaseclient
node_adminroutes -.->|"edits products"| node_productform
node_adminroutes -.->|"manages catalog"| node_productservice
node_adminroutes -.->|"manages offers"| node_offerservice
node_adminroutes -.->|"runs admin tasks"| node_adminservices
node_productform -->|"saves products"| node_productservice
node_productservice -->|"cleans images"| node_storageservice
node_settingshook -->|"loads settings"| node_settingsservice
node_settingsservice -.->|"reads settings"| node_supabaseclient
node_categoryservice -.->|"queries data"| node_supabaseclient
node_offerservice -.->|"queries data"| node_supabaseclient
node_orderservice -->|"queries data"| node_supabaseclient
node_userservice -->|"queries data"| node_supabaseclient
node_authcontext -.->|"auth via service"| node_supabaseclient
node_cartservice -->|"reads and writes"| node_supabaseclient
node_productservice -->|"queries catalog"| node_supabaseclient
node_storageservice -.->|"uploads files"| node_supabaseclient
node_supabaseclient -->|"connects"| node_supabase
node_supabaseclient -->|"types client"| node_dbtypes

click node_storepages "https://github.com/sarathkumargit/k-tech-mobile/blob/main/src/routes/index.tsx"
click node_shopbrowse "https://github.com/sarathkumargit/k-tech-mobile/blob/main/src/routes/shop.tsx"
click node_productdetail "https://github.com/sarathkumargit/k-tech-mobile/blob/main/src/routes/product.%24slug.tsx"
click node_productcards "https://github.com/sarathkumargit/k-tech-mobile/blob/main/src/components/product-card.tsx"
click node_repair "https://github.com/sarathkumargit/k-tech-mobile/blob/main/src/components/repair-modal.tsx"
click node_repairservice "https://github.com/sarathkumargit/k-tech-mobile/blob/main/src/services/repairService.ts"
click node_cartpage "https://github.com/sarathkumargit/k-tech-mobile/blob/main/src/routes/cart.tsx"
click node_carthook "https://github.com/sarathkumargit/k-tech-mobile/blob/main/src/hooks/use-cart.ts"
click node_cartservice "https://github.com/sarathkumargit/k-tech-mobile/blob/main/src/services/cartService.ts"
click node_checkout "https://github.com/sarathkumargit/k-tech-mobile/blob/main/src/routes/checkout.tsx"
click node_orderservice "https://github.com/sarathkumargit/k-tech-mobile/blob/main/src/services/orderService.ts"
click node_account "https://github.com/sarathkumargit/k-tech-mobile/blob/main/src/routes/account.tsx"
click node_authcontext "https://github.com/sarathkumargit/k-tech-mobile/blob/main/src/lib/auth-context.tsx"
click node_authroutes "https://github.com/sarathkumargit/k-tech-mobile/blob/main/src/routes/login.tsx"
click node_adminroutes "https://github.com/sarathkumargit/k-tech-mobile/blob/main/src/routes/admin.index.tsx"
click node_productform "https://github.com/sarathkumargit/k-tech-mobile/blob/main/src/components/admin/product-form.tsx"
click node_productservice "https://github.com/sarathkumargit/k-tech-mobile/blob/main/src/services/productService.ts"
click node_adminservices "https://github.com/sarathkumargit/k-tech-mobile/blob/main/src/services/adminService.ts"
click node_userservice "https://github.com/sarathkumargit/k-tech-mobile/blob/main/src/services/userService.ts"
click node_settingshook "https://github.com/sarathkumargit/k-tech-mobile/blob/main/src/hooks/use-site-settings.ts"
click node_settingsservice "https://github.com/sarathkumargit/k-tech-mobile/blob/main/src/services/settingsService.ts"
click node_categoryservice "https://github.com/sarathkumargit/k-tech-mobile/blob/main/src/services/categoryService.ts"
click node_offerservice "https://github.com/sarathkumargit/k-tech-mobile/blob/main/src/services/offerService.ts"
click node_storageservice "https://github.com/sarathkumargit/k-tech-mobile/blob/main/src/services/storageService.ts"
click node_supabaseclient "https://github.com/sarathkumargit/k-tech-mobile/blob/main/src/lib/supabase.ts"
click node_dbtypes "https://github.com/sarathkumargit/k-tech-mobile/blob/main/src/types/database.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_storepages,node_shopbrowse,node_productdetail,node_productcards,node_repair,node_adminuser toneBlue
class node_repairservice,node_cartpage,node_carthook,node_cartservice,node_checkout,node_orderservice,node_productservice,node_categoryservice,node_offerservice toneAmber
class node_account,node_authcontext,node_authroutes,node_userservice toneMint
class node_adminroutes,node_productform,node_adminservices toneRose
class node_settingshook,node_settingsservice,node_storageservice,node_supabaseclient,node_supabase,node_dbtypes,node_shopper toneIndigo
```

## Components

### Shopfront

- [Store pages](https://github.com/sarathkumargit/k-tech-mobile/blob/main/src/routes/index.tsx): `src/routes/index.tsx`
- [Browse catalog](https://github.com/sarathkumargit/k-tech-mobile/blob/main/src/routes/shop.tsx): `src/routes/shop.tsx`
- [Product detail](https://github.com/sarathkumargit/k-tech-mobile/blob/main/src/routes/product.%24slug.tsx): `src/routes/product.$slug.tsx`
- [Product cards](https://github.com/sarathkumargit/k-tech-mobile/blob/main/src/components/product-card.tsx): `src/components/product-card.tsx`
- [Repair booking](https://github.com/sarathkumargit/k-tech-mobile/blob/main/src/components/repair-modal.tsx): `src/components/repair-modal.tsx`

### Commerce

- [Repair records](https://github.com/sarathkumargit/k-tech-mobile/blob/main/src/services/repairService.ts): `src/services/repairService.ts`
- [Cart](https://github.com/sarathkumargit/k-tech-mobile/blob/main/src/routes/cart.tsx): `src/routes/cart.tsx`
- [Cart state](https://github.com/sarathkumargit/k-tech-mobile/blob/main/src/hooks/use-cart.ts): `src/hooks/use-cart.ts`
- [Cart operations](https://github.com/sarathkumargit/k-tech-mobile/blob/main/src/services/cartService.ts): `src/services/cartService.ts`
- [Checkout](https://github.com/sarathkumargit/k-tech-mobile/blob/main/src/routes/checkout.tsx): `src/routes/checkout.tsx`
- [Order operations](https://github.com/sarathkumargit/k-tech-mobile/blob/main/src/services/orderService.ts): `src/services/orderService.ts`
- [Catalog service](https://github.com/sarathkumargit/k-tech-mobile/blob/main/src/services/productService.ts): `src/services/productService.ts`
- [Category service](https://github.com/sarathkumargit/k-tech-mobile/blob/main/src/services/categoryService.ts): `src/services/categoryService.ts`
- [Offer service](https://github.com/sarathkumargit/k-tech-mobile/blob/main/src/services/offerService.ts): `src/services/offerService.ts`

### Identity

- [Account pages](https://github.com/sarathkumargit/k-tech-mobile/blob/main/src/routes/account.tsx): `src/routes/account.tsx`
- [Session and profile](https://github.com/sarathkumargit/k-tech-mobile/blob/main/src/lib/auth-context.tsx): `src/lib/auth-context.tsx`
- [Sign-in and signup](https://github.com/sarathkumargit/k-tech-mobile/blob/main/src/routes/login.tsx): `src/routes/login.tsx`
- [User service](https://github.com/sarathkumargit/k-tech-mobile/blob/main/src/services/userService.ts): `src/services/userService.ts`

### Administration

- [Admin pages](https://github.com/sarathkumargit/k-tech-mobile/blob/main/src/routes/admin.index.tsx): `src/routes/admin.index.tsx`
- [Product editor](https://github.com/sarathkumargit/k-tech-mobile/blob/main/src/components/admin/product-form.tsx): `src/components/admin/product-form.tsx`
- [Admin services](https://github.com/sarathkumargit/k-tech-mobile/blob/main/src/services/adminService.ts): `src/services/adminService.ts`

### Data platform

- [Site settings state](https://github.com/sarathkumargit/k-tech-mobile/blob/main/src/hooks/use-site-settings.ts): `src/hooks/use-site-settings.ts`
- [Settings service](https://github.com/sarathkumargit/k-tech-mobile/blob/main/src/services/settingsService.ts): `src/services/settingsService.ts`
- [Image storage](https://github.com/sarathkumargit/k-tech-mobile/blob/main/src/services/storageService.ts): `src/services/storageService.ts`
- [Supabase client](https://github.com/sarathkumargit/k-tech-mobile/blob/main/src/lib/supabase.ts): `src/lib/supabase.ts`
- **Supabase backend**
- [Database types](https://github.com/sarathkumargit/k-tech-mobile/blob/main/src/types/database.ts): `src/types/database.ts`

### Other components

- **Shopper**
- **Admin user**

## Connections

- Shopper → Store pages: opens (evidence: `README.md`)
- Shopper → Browse catalog: browses (evidence: `README.md`)
- Shopper → Cart: manages cart (evidence: `src/routes/cart.tsx`)
- Shopper → Checkout: checks out (evidence: `src/routes/checkout.tsx`)
- Admin user → Admin pages: manages shop (evidence: `README.md`)
- Store pages → Product cards: renders (evidence: `src/routes/index.tsx`)
- Store pages → Catalog service: loads catalog (evidence: `src/routes/index.tsx`)
- Store pages → Category service: loads categories (evidence: `src/routes/index.tsx`)
- Store pages → Repair booking: opens booking (evidence: `src/routes/index.tsx`)
- Browse catalog → Catalog service: loads catalog
- Product detail → Catalog service: loads product (evidence: `src/routes/product.$slug.tsx`)
- Product detail → Cart state: adds item (evidence: `src/routes/product.$slug.tsx`)
- Product cards → Cart state: adds item (evidence: `src/components/product-card.tsx`)
- Repair booking → Repair records: submits request
- Cart → Cart state: uses state (evidence: `src/routes/cart.tsx`)
- Cart state → Cart operations: runs mutations (evidence: `src/hooks/use-cart.ts`)
- Cart operations → Catalog service: resolves products (evidence: `src/services/cartService.ts`)
- Checkout → Cart state: reads cart (evidence: `src/routes/checkout.tsx`)
- Checkout → Order operations: places order (evidence: `src/routes/checkout.tsx`)
- Sign-in and signup → Session and profile: uses session
- Account pages → Session and profile: uses session
- Session and profile → User service: loads profile (evidence: `src/lib/auth-context.tsx`)
- Session and profile → Supabase client: checks configuration (evidence: `src/lib/auth-context.tsx`)
- Admin pages → Product editor: edits products
- Admin pages → Catalog service: manages catalog
- Admin pages → Offer service: manages offers
- Admin pages → Admin services: runs admin tasks
- Product editor → Catalog service: saves products (evidence: `src/components/admin/product-form.tsx`)
- Catalog service → Image storage: cleans images (evidence: `src/services/productService.ts`)
- Site settings state → Settings service: loads settings (evidence: `src/hooks/use-site-settings.ts`)
- Settings service → Supabase client: reads settings (evidence: `README.md`)
- Category service → Supabase client: queries data (evidence: `README.md`)
- Offer service → Supabase client: queries data (evidence: `README.md`)
- Order operations → Supabase client: queries data (evidence: `src/services/orderService.ts`)
- User service → Supabase client: queries data (evidence: `src/services/userService.ts`)
- Session and profile → Supabase client: auth via service (evidence: `src/lib/auth-context.tsx`)
- Cart operations → Supabase client: reads and writes (evidence: `src/services/cartService.ts`)
- Catalog service → Supabase client: queries catalog (evidence: `src/services/productService.ts`)
- Image storage → Supabase client: uploads files (evidence: `README.md`)
- Supabase client → Supabase backend: connects (evidence: `src/lib/supabase.ts`)
- Supabase client → Database types: types client (evidence: `src/lib/supabase.ts`)
