# arianabi/eyecareproject architecture

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

- Interactive diagram: https://gitdiagram.com/arianabi/eyecareproject
- Repository: https://github.com/arianabi/eyecareproject

## Overview

Eyecare is a Persian RTL optical-ordering application with customer and administrator workspaces. The customer journey covers account access, optical product selection and ordering, then order tracking and invoice payment; profile and support tickets are adjacent customer capabilities. Administrators manage orders, products and categories, invoices and finances, users, tickets, settings, and analytics. The graph includes the documented product branches and visible infrastructure; most feature-action wiring is inferred from the route/action structure, while sampled-source links are shown where confirmed.

Main entry points: [`lib/db.ts`](https://github.com/arianabi/eyecareproject/blob/main/lib/db.ts) (PostgreSQL), [`app/admin/page.tsx`](https://github.com/arianabi/eyecareproject/blob/main/app/admin/page.tsx) (Admin workspace), [`app/(main)/page.tsx`](https://github.com/arianabi/eyecareproject/blob/main/app/(main)/page.tsx) (Customer workspace), [`lib/actions/auth.actions.ts`](https://github.com/arianabi/eyecareproject/blob/main/lib/actions/auth.actions.ts) (Account actions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_customer["Customer workspace"]
  node_auth_ui["Login and signup<br/>[AuthForms.tsx]"]
  node_customer_pages["Customer workspace<br/>[page.tsx]"]
  node_order_pages["Customer orders<br/>[page.tsx]"]
  node_invoice_pages["Customer invoices<br/>[page.tsx]"]
  node_profile["Profile<br/>[profile.action.ts]"]
  node_tickets["Support tickets<br/>[tickets.action.ts]"]
end

subgraph group_admin["Admin workspace"]
  node_admin_routes["Admin workspace<br/>[page.tsx]"]
  node_admin_orders["Admin orders"]
  node_admin_catalog["Catalog management"]
  node_admin_finance["Finance and invoices<br/>[page.tsx]"]
  node_admin_users["User management"]
  node_admin_tickets["Ticket management<br/>[page.tsx]"]
  node_admin_analytics["Analytics"]
  node_admin_settings["Settings"]
end

subgraph group_domain["Order and commerce"]
  node_catalog["Product catalog<br/>[products.action.ts]"]
  node_cart["Optical order"]
  node_orders["Order management<br/>[orders.action.ts]"]
  node_invoices["Invoices and payment<br/>[invoices.action.ts]"]
  node_payment_verify["Payment verification<br/>[route.ts]"]
end

subgraph group_platform["Platform services"]
  node_auth_action["Account actions<br/>[auth.actions.ts]"]
  node_auth["Authentication<br/>[Auth.ts]"]
  node_database[("PostgreSQL<br/>[db.ts]")]
  node_audit["Audit logging<br/>[audit.ts]"]
  node_order_stream["Order event stream<br/>[route.ts]"]
  node_image_storage["Image storage<br/>[image-storage.ts]"]
  node_image_route["Image delivery<br/>[route.ts]"]
  node_bale["Bale messaging<br/>[bale.actions.ts]"]
end

node_visitor(("Customer"))
node_administrator(("Administrator"))
node_payment_provider(("Payment provider"))

node_visitor -->|"opens account"| node_auth_ui
node_auth_ui -->|"submits credentials"| node_auth_action
node_auth_action -->|"signs in"| node_auth
node_auth_action -->|"creates user"| node_database
node_auth -->|"looks up user"| node_database
node_auth_action -->|"records signup"| node_audit
node_auth -->|"records session"| node_audit
node_auth_action -.->|"notifies signup"| node_bale
node_visitor -->|"uses workspace"| node_customer_pages
node_customer_pages -->|"browses products"| node_catalog
node_customer_pages -->|"starts order"| node_cart
node_cart -->|"submits order"| node_orders
node_orders -->|"persists orders"| node_database
node_customer_pages -->|"tracks orders"| node_order_pages
node_order_pages -->|"loads orders"| node_orders
node_customer_pages -->|"views invoices"| node_invoice_pages
node_invoice_pages -->|"loads invoices"| node_invoices
node_invoices -->|"starts verification"| node_payment_verify
node_payment_verify -->|"verifies payment"| node_invoices
node_payment_verify -.->|"checks payment"| node_payment_provider
node_customer_pages -->|"updates profile"| node_profile
node_customer_pages -->|"opens ticket"| node_tickets
node_administrator -->|"manages operations"| node_admin_routes
node_admin_routes -->|"manages orders"| node_admin_orders
node_admin_routes -->|"manages catalog"| node_admin_catalog
node_admin_routes -->|"reviews finances"| node_admin_finance
node_admin_routes -->|"manages users"| node_admin_users
node_admin_routes -->|"handles tickets"| node_admin_tickets
node_admin_routes -->|"reviews traffic"| node_admin_analytics
node_admin_routes -->|"changes settings"| node_admin_settings
node_admin_orders -->|"reads and writes"| node_database
node_admin_catalog -->|"reads and writes"| node_database
node_admin_users -->|"reads and writes"| node_database
node_admin_tickets -->|"reads and writes"| node_database
node_admin_finance -->|"reads financial data"| node_database
node_admin_analytics -->|"loads analytics"| node_database
node_admin_settings -->|"stores settings"| node_database
node_order_stream -->|"counts pending orders"| node_database
node_orders -->|"emits order events"| node_order_stream
node_image_storage -->|"writes image files"| node_image_route
node_image_route -->|"serves images"| node_visitor

click node_auth_ui "https://github.com/arianabi/eyecareproject/blob/main/components/forms/AuthForms.tsx"
click node_auth_action "https://github.com/arianabi/eyecareproject/blob/main/lib/actions/auth.actions.ts"
click node_auth "https://github.com/arianabi/eyecareproject/blob/main/lib/Auth.ts"
click node_customer_pages "https://github.com/arianabi/eyecareproject/blob/main/app/(main)/page.tsx"
click node_catalog "https://github.com/arianabi/eyecareproject/blob/main/lib/actions/products.action.ts"
click node_cart "https://github.com/arianabi/eyecareproject/blob/main/app/(main)/glasslens-order/GlasslensOrderPage.tsx"
click node_orders "https://github.com/arianabi/eyecareproject/blob/main/lib/actions/orders.action.ts"
click node_order_pages "https://github.com/arianabi/eyecareproject/blob/main/app/(main)/orders/page.tsx"
click node_invoices "https://github.com/arianabi/eyecareproject/blob/main/lib/actions/invoices.action.ts"
click node_invoice_pages "https://github.com/arianabi/eyecareproject/blob/main/app/(main)/invoices/page.tsx"
click node_payment_verify "https://github.com/arianabi/eyecareproject/blob/main/app/(main)/invoices/verify/route.ts"
click node_profile "https://github.com/arianabi/eyecareproject/blob/main/lib/actions/profile.action.ts"
click node_tickets "https://github.com/arianabi/eyecareproject/blob/main/lib/actions/tickets.action.ts"
click node_admin_routes "https://github.com/arianabi/eyecareproject/blob/main/app/admin/page.tsx"
click node_admin_orders "https://github.com/arianabi/eyecareproject/blob/main/lib/actions/admin.orders.action.ts"
click node_admin_catalog "https://github.com/arianabi/eyecareproject/blob/main/lib/actions/admin.products.action.ts"
click node_admin_finance "https://github.com/arianabi/eyecareproject/blob/main/app/admin/financial/page.tsx"
click node_admin_users "https://github.com/arianabi/eyecareproject/blob/main/lib/actions/admin.users.actions.ts"
click node_admin_tickets "https://github.com/arianabi/eyecareproject/blob/main/app/admin/tickets/page.tsx"
click node_admin_analytics "https://github.com/arianabi/eyecareproject/blob/main/lib/actions/analytics.actions.ts"
click node_admin_settings "https://github.com/arianabi/eyecareproject/blob/main/lib/actions/admin.settings.actions.ts"
click node_database "https://github.com/arianabi/eyecareproject/blob/main/lib/db.ts"
click node_audit "https://github.com/arianabi/eyecareproject/blob/main/lib/audit.ts"
click node_order_stream "https://github.com/arianabi/eyecareproject/blob/main/app/api/orders/order-stream/route.ts"
click node_image_storage "https://github.com/arianabi/eyecareproject/blob/main/lib/image-storage.ts"
click node_image_route "https://github.com/arianabi/eyecareproject/blob/main/app/api/images/%5Bfilename%5D/route.ts"
click node_bale "https://github.com/arianabi/eyecareproject/blob/main/lib/actions/bale.actions.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_auth_ui,node_customer_pages,node_order_pages,node_invoice_pages,node_profile,node_tickets toneBlue
class node_admin_routes,node_admin_orders,node_admin_catalog,node_admin_finance,node_admin_users,node_admin_tickets,node_admin_analytics,node_admin_settings toneAmber
class node_catalog,node_cart,node_orders,node_invoices,node_payment_verify toneMint
class node_auth_action,node_auth,node_database,node_audit,node_order_stream,node_image_storage,node_image_route,node_bale toneRose
class node_visitor,node_administrator,node_payment_provider toneIndigo
```

## Components

### Customer workspace

- [Login and signup](https://github.com/arianabi/eyecareproject/blob/main/components/forms/AuthForms.tsx): `components/forms/AuthForms.tsx`
- [Customer workspace](https://github.com/arianabi/eyecareproject/blob/main/app/(main)/page.tsx): `app/(main)/page.tsx`
- [Customer orders](https://github.com/arianabi/eyecareproject/blob/main/app/(main)/orders/page.tsx): `app/(main)/orders/page.tsx`
- [Customer invoices](https://github.com/arianabi/eyecareproject/blob/main/app/(main)/invoices/page.tsx): `app/(main)/invoices/page.tsx`
- [Profile](https://github.com/arianabi/eyecareproject/blob/main/lib/actions/profile.action.ts): `lib/actions/profile.action.ts`
- [Support tickets](https://github.com/arianabi/eyecareproject/blob/main/lib/actions/tickets.action.ts): `lib/actions/tickets.action.ts`

### Admin workspace

- [Admin workspace](https://github.com/arianabi/eyecareproject/blob/main/app/admin/page.tsx): `app/admin/page.tsx`
- [Admin orders](https://github.com/arianabi/eyecareproject/blob/main/lib/actions/admin.orders.action.ts): `lib/actions/admin.orders.action.ts`
- [Catalog management](https://github.com/arianabi/eyecareproject/blob/main/lib/actions/admin.products.action.ts): `lib/actions/admin.products.action.ts`
- [Finance and invoices](https://github.com/arianabi/eyecareproject/blob/main/app/admin/financial/page.tsx): `app/admin/financial/page.tsx`
- [User management](https://github.com/arianabi/eyecareproject/blob/main/lib/actions/admin.users.actions.ts): `lib/actions/admin.users.actions.ts`
- [Ticket management](https://github.com/arianabi/eyecareproject/blob/main/app/admin/tickets/page.tsx): `app/admin/tickets/page.tsx`
- [Analytics](https://github.com/arianabi/eyecareproject/blob/main/lib/actions/analytics.actions.ts): `lib/actions/analytics.actions.ts`
- [Settings](https://github.com/arianabi/eyecareproject/blob/main/lib/actions/admin.settings.actions.ts): `lib/actions/admin.settings.actions.ts`

### Order and commerce

- [Product catalog](https://github.com/arianabi/eyecareproject/blob/main/lib/actions/products.action.ts): `lib/actions/products.action.ts`
- [Optical order](https://github.com/arianabi/eyecareproject/blob/main/app/(main)/glasslens-order/GlasslensOrderPage.tsx): `app/(main)/glasslens-order/GlasslensOrderPage.tsx`
- [Order management](https://github.com/arianabi/eyecareproject/blob/main/lib/actions/orders.action.ts): `lib/actions/orders.action.ts`
- [Invoices and payment](https://github.com/arianabi/eyecareproject/blob/main/lib/actions/invoices.action.ts): `lib/actions/invoices.action.ts`
- [Payment verification](https://github.com/arianabi/eyecareproject/blob/main/app/(main)/invoices/verify/route.ts): `app/(main)/invoices/verify/route.ts`

### Platform services

- [Account actions](https://github.com/arianabi/eyecareproject/blob/main/lib/actions/auth.actions.ts): `lib/actions/auth.actions.ts`
- [Authentication](https://github.com/arianabi/eyecareproject/blob/main/lib/Auth.ts): `lib/Auth.ts`
- [PostgreSQL](https://github.com/arianabi/eyecareproject/blob/main/lib/db.ts): `lib/db.ts`
- [Audit logging](https://github.com/arianabi/eyecareproject/blob/main/lib/audit.ts): `lib/audit.ts`
- [Order event stream](https://github.com/arianabi/eyecareproject/blob/main/app/api/orders/order-stream/route.ts): `app/api/orders/order-stream/route.ts`
- [Image storage](https://github.com/arianabi/eyecareproject/blob/main/lib/image-storage.ts): `lib/image-storage.ts`
- [Image delivery](https://github.com/arianabi/eyecareproject/blob/main/app/api/images/%5Bfilename%5D/route.ts): `app/api/images/[filename]/route.ts`
- [Bale messaging](https://github.com/arianabi/eyecareproject/blob/main/lib/actions/bale.actions.ts): `lib/actions/bale.actions.ts`

### Other components

- **Customer**
- **Administrator**
- **Payment provider**

## Connections

- Customer → Login and signup: opens account
- Login and signup → Account actions: submits credentials
- Account actions → Authentication: signs in
- Account actions → PostgreSQL: creates user
- Authentication → PostgreSQL: looks up user
- Account actions → Audit logging: records signup
- Authentication → Audit logging: records session
- Account actions → Bale messaging: notifies signup
- Customer → Customer workspace: uses workspace
- Customer workspace → Product catalog: browses products
- Customer workspace → Optical order: starts order
- Optical order → Order management: submits order
- Order management → PostgreSQL: persists orders
- Customer workspace → Customer orders: tracks orders
- Customer orders → Order management: loads orders
- Customer workspace → Customer invoices: views invoices
- Customer invoices → Invoices and payment: loads invoices
- Invoices and payment → Payment verification: starts verification
- Payment verification → Invoices and payment: verifies payment
- Payment verification → Payment provider: checks payment
- Customer workspace → Profile: updates profile
- Customer workspace → Support tickets: opens ticket
- Administrator → Admin workspace: manages operations
- Admin workspace → Admin orders: manages orders
- Admin workspace → Catalog management: manages catalog
- Admin workspace → Finance and invoices: reviews finances
- Admin workspace → User management: manages users
- Admin workspace → Ticket management: handles tickets
- Admin workspace → Analytics: reviews traffic
- Admin workspace → Settings: changes settings
- Admin orders → PostgreSQL: reads and writes
- Catalog management → PostgreSQL: reads and writes
- User management → PostgreSQL: reads and writes
- Ticket management → PostgreSQL: reads and writes
- Finance and invoices → PostgreSQL: reads financial data
- Analytics → PostgreSQL: loads analytics
- Settings → PostgreSQL: stores settings
- Order event stream → PostgreSQL: counts pending orders
- Order management → Order event stream: emits order events
- Image storage → Image delivery: writes image files
- Image delivery → Customer: serves images
