# aniket-2111/pocketkirana architecture

> Architecture diagram of the GitHub repository aniket-2111/pocketkirana, 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/aniket-2111/pocketkirana
- Repository: https://github.com/aniket-2111/pocketkirana

## Overview

PocketKirana is a local grocery delivery platform spanning customer web and Android experiences, admin operations, and picker and delivery portals. The customer journey runs from product discovery and serviceability checks through authoritative pricing, payment, order tracking, picking, and delivery. Admin capabilities also cover catalog, inventory, dispatch, settlements, analytics, and festival campaigns. The graph uses documented capabilities and sampled route behavior; where route-to-service wiring was not sampled, it avoids asserting internal calls.

Main entry points: [`app/api/orders`](https://github.com/aniket-2111/pocketkirana/tree/main/app/api/orders) (Order lifecycle), [`app/admin`](https://github.com/aniket-2111/pocketkirana/tree/main/app/admin) (Admin console), [`app`](https://github.com/aniket-2111/pocketkirana/tree/main/app) (Customer web), [`customer-app`](https://github.com/aniket-2111/pocketkirana/tree/main/customer-app) (Customer Android)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_customer["Customer commerce"]
  node_web["Customer web"]
  node_mobile["Customer Android"]
  node_catalog["Catalog browsing<br/>[page.tsx]"]
  node_location["Location and serviceability"]
  node_checkout["Checkout"]
  node_tracking["Order tracking<br/>[page.tsx]"]
end

subgraph group_operations["Store operations"]
  node_picker["Picker workflow"]
  node_delivery["Delivery workflow"]
  node_inventory["Inventory operations"]
  node_admin["Admin console"]
  node_campaigns["Festival campaigns"]
end

subgraph group_backend["Platform services"]
  node_pricing["Pricing engine<br/>[pricingEngine.ts]"]
  node_payments["Payment routes"]
  node_orders["Order lifecycle"]
  node_notifications["Notifications<br/>[route.ts]"]
  node_functions["Cloud Functions"]
  node_invoices["Invoice generation<br/>[invoiceEngine.ts]"]
end

subgraph group_data["Data and integrations"]
  node_firebase[("Firebase services")]
  node_postgres[("PostgreSQL<br/>[postgres.ts]")]
end

node_customer(("Customer"))
node_staff(("Operations staff"))
node_phonepe["PhonePe"]

node_customer -->|"uses"| node_web
node_customer -->|"uses"| node_mobile
node_web -->|"browses"| node_catalog
node_mobile -->|"browses"| node_catalog
node_web -->|"checks serviceability"| node_location
node_mobile -->|"checks serviceability"| node_location
node_web -->|"submits cart"| node_checkout
node_mobile -->|"submits cart"| node_checkout
node_checkout -->|"calculates price"| node_pricing
node_checkout -->|"starts payment"| node_payments
node_payments -.->|"requests payment"| node_phonepe
node_payments -->|"verifies payment"| node_orders
node_customer -->|"tracks order"| node_tracking
node_staff -->|"manages operations"| node_admin
node_admin -->|"manages stock"| node_inventory
node_admin -->|"manages campaigns"| node_campaigns
node_orders -->|"supports picking"| node_picker
node_orders -->|"supports delivery"| node_delivery
node_picker -->|"updates stock"| node_inventory
node_delivery -->|"updates delivery status"| node_orders
node_admin -->|"manages invoices"| node_invoices
node_orders -->|"provides order data"| node_invoices
node_admin -->|"composes notifications"| node_notifications
node_notifications -.->|"reads fallback"| node_firebase
node_catalog -->|"reads catalog"| node_postgres
node_catalog -.->|"falls back to"| node_firebase
node_orders -.->|"lifecycle operations"| node_functions

click node_web "https://github.com/aniket-2111/pocketkirana/tree/main/app"
click node_mobile "https://github.com/aniket-2111/pocketkirana/tree/main/customer-app"
click node_catalog "https://github.com/aniket-2111/pocketkirana/blob/main/app/products/page.tsx"
click node_location "https://github.com/aniket-2111/pocketkirana/tree/main/app/api/location"
click node_checkout "https://github.com/aniket-2111/pocketkirana/tree/main/app/api/checkout"
click node_pricing "https://github.com/aniket-2111/pocketkirana/blob/main/lib/pricingEngine.ts"
click node_payments "https://github.com/aniket-2111/pocketkirana/tree/main/app/api/payments"
click node_orders "https://github.com/aniket-2111/pocketkirana/tree/main/app/api/orders"
click node_tracking "https://github.com/aniket-2111/pocketkirana/blob/main/app/orders/%5Bid%5D/track/page.tsx"
click node_picker "https://github.com/aniket-2111/pocketkirana/tree/main/components/picker"
click node_delivery "https://github.com/aniket-2111/pocketkirana/tree/main/components/partner"
click node_inventory "https://github.com/aniket-2111/pocketkirana/tree/main/app/api/inventory"
click node_admin "https://github.com/aniket-2111/pocketkirana/tree/main/app/admin"
click node_campaigns "https://github.com/aniket-2111/pocketkirana/tree/main/app/api/admin/festival-campaigns"
click node_notifications "https://github.com/aniket-2111/pocketkirana/blob/main/app/api/notifications/route.ts"
click node_firebase "https://github.com/aniket-2111/pocketkirana/blob/main/lib/firebaseServices.ts"
click node_postgres "https://github.com/aniket-2111/pocketkirana/blob/main/lib/postgres.ts"
click node_functions "https://github.com/aniket-2111/pocketkirana/tree/main/functions/src"
click node_invoices "https://github.com/aniket-2111/pocketkirana/blob/main/lib/invoiceEngine.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_web,node_mobile,node_catalog,node_location,node_checkout,node_tracking toneBlue
class node_picker,node_delivery,node_inventory,node_admin,node_campaigns toneAmber
class node_pricing,node_payments,node_orders,node_notifications,node_functions,node_invoices toneMint
class node_firebase,node_postgres toneRose
class node_customer,node_staff,node_phonepe toneIndigo
```

## Components

### Customer commerce

- [Customer web](https://github.com/aniket-2111/pocketkirana/tree/main/app): `app`
- [Customer Android](https://github.com/aniket-2111/pocketkirana/tree/main/customer-app): `customer-app`
- [Catalog browsing](https://github.com/aniket-2111/pocketkirana/blob/main/app/products/page.tsx): `app/products/page.tsx`
- [Location and serviceability](https://github.com/aniket-2111/pocketkirana/tree/main/app/api/location): `app/api/location`
- [Checkout](https://github.com/aniket-2111/pocketkirana/tree/main/app/api/checkout): `app/api/checkout`
- [Order tracking](https://github.com/aniket-2111/pocketkirana/blob/main/app/orders/%5Bid%5D/track/page.tsx): `app/orders/[id]/track/page.tsx`

### Store operations

- [Picker workflow](https://github.com/aniket-2111/pocketkirana/tree/main/components/picker): `components/picker`
- [Delivery workflow](https://github.com/aniket-2111/pocketkirana/tree/main/components/partner): `components/partner`
- [Inventory operations](https://github.com/aniket-2111/pocketkirana/tree/main/app/api/inventory): `app/api/inventory`
- [Admin console](https://github.com/aniket-2111/pocketkirana/tree/main/app/admin): `app/admin`
- [Festival campaigns](https://github.com/aniket-2111/pocketkirana/tree/main/app/api/admin/festival-campaigns): `app/api/admin/festival-campaigns`

### Platform services

- [Pricing engine](https://github.com/aniket-2111/pocketkirana/blob/main/lib/pricingEngine.ts): `lib/pricingEngine.ts`
- [Payment routes](https://github.com/aniket-2111/pocketkirana/tree/main/app/api/payments): `app/api/payments`
- [Order lifecycle](https://github.com/aniket-2111/pocketkirana/tree/main/app/api/orders): `app/api/orders`
- [Notifications](https://github.com/aniket-2111/pocketkirana/blob/main/app/api/notifications/route.ts): `app/api/notifications/route.ts`
- [Cloud Functions](https://github.com/aniket-2111/pocketkirana/tree/main/functions/src): `functions/src`
- [Invoice generation](https://github.com/aniket-2111/pocketkirana/blob/main/lib/invoiceEngine.ts): `lib/invoiceEngine.ts`

### Data and integrations

- [Firebase services](https://github.com/aniket-2111/pocketkirana/blob/main/lib/firebaseServices.ts): `lib/firebaseServices.ts`
- [PostgreSQL](https://github.com/aniket-2111/pocketkirana/blob/main/lib/postgres.ts): `lib/postgres.ts`

### Other components

- **Customer**
- **Operations staff**
- **PhonePe**

## Connections

- Customer → Customer web: uses
- Customer → Customer Android: uses
- Customer web → Catalog browsing: browses
- Customer Android → Catalog browsing: browses
- Customer web → Location and serviceability: checks serviceability
- Customer Android → Location and serviceability: checks serviceability
- Customer web → Checkout: submits cart
- Customer Android → Checkout: submits cart
- Checkout → Pricing engine: calculates price
- Checkout → Payment routes: starts payment
- Payment routes → PhonePe: requests payment
- Payment routes → Order lifecycle: verifies payment
- Customer → Order tracking: tracks order
- Operations staff → Admin console: manages operations
- Admin console → Inventory operations: manages stock
- Admin console → Festival campaigns: manages campaigns
- Order lifecycle → Picker workflow: supports picking
- Order lifecycle → Delivery workflow: supports delivery
- Picker workflow → Inventory operations: updates stock
- Delivery workflow → Order lifecycle: updates delivery status
- Admin console → Invoice generation: manages invoices
- Order lifecycle → Invoice generation: provides order data
- Admin console → Notifications: composes notifications
- Notifications → Firebase services: reads fallback
- Catalog browsing → PostgreSQL: reads catalog
- Catalog browsing → Firebase services: falls back to
- Order lifecycle → Cloud Functions: lifecycle operations
