# yosef0110/ai-daily-copilot architecture

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

- Interactive diagram: https://gitdiagram.com/yosef0110/ai-daily-copilot
- Repository: https://github.com/yosef0110/ai-daily-copilot

## Overview

AI Daily Copilot is a small-business management application spanning a Next.js web app, a FastAPI AI service, and Supabase/PostgreSQL. The main workflow is managing products and stock, recording and analyzing transactions, and using dashboard, forecast, import, and Copilot features to turn that business data into results. README-level links describe the overall service architecture; source-index references and excerpts support the shown AI-service wiring. Some web-to-AI and page-to-API links are documented only at a high level, so those edges are dashed.

Main entry points: [`ai-service/app/main.py`](https://github.com/yosef0110/ai-daily-copilot/blob/main/ai-service/app/main.py) (FastAPI Application), [`ai-service/app/routers/forecasting.py`](https://github.com/yosef0110/ai-daily-copilot/blob/main/ai-service/app/routers/forecasting.py) (Forecast Endpoints), [`ai-service/app/routers/imports.py`](https://github.com/yosef0110/ai-daily-copilot/blob/main/ai-service/app/routers/imports.py) (Import Endpoints), [`ai-service/app/services/copilot_service.py`](https://github.com/yosef0110/ai-daily-copilot/blob/main/ai-service/app/services/copilot_service.py) (Copilot Response Service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Business Web App"]
  node_dashboard["Dashboard<br/>[page.tsx]"]
  node_products["Product Management<br/>[page.tsx]"]
  node_inventory["Inventory Management<br/>[page.tsx]"]
  node_transactions["Transaction Analytics<br/>[page.tsx]"]
  node_imports_ui["Data Import<br/>[page.tsx]"]
  node_forecast_ui["Sales Forecasting<br/>[page.tsx]"]
  node_copilot_ui["AI Copilot<br/>[AICopilot.tsx]"]
  node_auth_ui["Authentication Pages<br/>[page.tsx]"]
end

subgraph group_api["Web API"]
  node_product_api["Product API<br/>[route.ts]"]
  node_inventory_api["Inventory API<br/>[route.ts]"]
  node_transaction_api["Transaction APIs<br/>[route.ts]"]
  node_insights_api["Insights API<br/>[route.ts]"]
  node_copilot_api["Copilot API<br/>[route.ts]"]
  node_forecast_api["Forecast History API<br/>[route.ts]"]
  node_auth_api["Authentication API<br/>[route.ts]"]
end

subgraph group_ai["AI Service"]
  node_fastapi["FastAPI Application<br/>[main.py]"]
  node_forecast_router["Forecast Endpoints<br/>[forecasting.py]"]
  node_forecast_engine["Forecast Models"]
  node_forecast_advice["Forecast Recommendations"]
  node_import_router["Import Endpoints<br/>[imports.py]"]
  node_excel_import["Spreadsheet Import<br/>[excel_import.py]"]
  node_receipt["Receipt Extraction"]
  node_copilot_router["Copilot Endpoint<br/>[copilot.py]"]
  node_copilot_service["Copilot Response Service<br/>[copilot_service.py]"]
  node_copilot_schema["Copilot Context Schema<br/>[copilot.py]"]
end

subgraph group_data["Business Data"]
  node_supabase[("Supabase / PostgreSQL")]
end

node_owner(("Business User"))
node_ollama["Ollama / Qwen"]
node_gemini["Gemini API"]

node_owner -->|"views"| node_dashboard
node_owner -->|"manages products"| node_products
node_owner -->|"manages stock"| node_inventory
node_owner -->|"reviews sales"| node_transactions
node_owner -->|"imports data"| node_imports_ui
node_owner -->|"requests forecasts"| node_forecast_ui
node_owner -->|"asks questions"| node_copilot_ui
node_owner -->|"signs in"| node_auth_ui
node_products -.->|"requests products"| node_product_api
node_inventory -.->|"requests stock"| node_inventory_api
node_transactions -.->|"requests analytics"| node_transaction_api
node_dashboard -.->|"requests insights"| node_insights_api
node_forecast_ui -.->|"requests history"| node_forecast_api
node_copilot_ui -.->|"sends questions"| node_copilot_api
node_auth_ui -.->|"submits credentials"| node_auth_api
node_product_api -->|"reads and writes"| node_supabase
node_inventory_api -->|"reads and writes"| node_supabase
node_transaction_api -->|"reads data"| node_supabase
node_auth_api -->|"uses authentication"| node_supabase
node_copilot_api -.->|"forwards context"| node_fastapi
node_forecast_api -.->|"requests forecast"| node_fastapi
node_fastapi -->|"registers router"| node_forecast_router
node_fastapi -->|"registers router"| node_copilot_router
node_fastapi -->|"registers router"| node_import_router
node_forecast_router -->|"calls"| node_forecast_engine
node_forecast_router -->|"calls"| node_forecast_advice
node_import_router -->|"calls"| node_excel_import
node_import_router -->|"calls"| node_receipt
node_copilot_router -->|"calls"| node_copilot_service
node_copilot_service -->|"uses context"| node_copilot_schema
node_copilot_service -->|"sends prompt"| node_ollama
node_receipt -.->|"extracts receipt data"| node_gemini

click node_dashboard "https://github.com/yosef0110/ai-daily-copilot/blob/main/web/app/(app)/dashboard/page.tsx"
click node_products "https://github.com/yosef0110/ai-daily-copilot/blob/main/web/app/(app)/products/page.tsx"
click node_inventory "https://github.com/yosef0110/ai-daily-copilot/blob/main/web/app/(app)/inventory/page.tsx"
click node_transactions "https://github.com/yosef0110/ai-daily-copilot/blob/main/web/app/(app)/transactions/page.tsx"
click node_imports_ui "https://github.com/yosef0110/ai-daily-copilot/blob/main/web/app/(app)/imports/page.tsx"
click node_forecast_ui "https://github.com/yosef0110/ai-daily-copilot/blob/main/web/app/(app)/forecast/page.tsx"
click node_copilot_ui "https://github.com/yosef0110/ai-daily-copilot/blob/main/web/components/copilot/AICopilot.tsx"
click node_auth_ui "https://github.com/yosef0110/ai-daily-copilot/blob/main/web/app/login/page.tsx"
click node_product_api "https://github.com/yosef0110/ai-daily-copilot/blob/main/web/app/api/products/route.ts"
click node_inventory_api "https://github.com/yosef0110/ai-daily-copilot/blob/main/web/app/api/inventory/route.ts"
click node_transaction_api "https://github.com/yosef0110/ai-daily-copilot/blob/main/web/app/api/transactions/route.ts"
click node_insights_api "https://github.com/yosef0110/ai-daily-copilot/blob/main/web/app/api/insights/route.ts"
click node_copilot_api "https://github.com/yosef0110/ai-daily-copilot/blob/main/web/app/api/copilot/route.ts"
click node_forecast_api "https://github.com/yosef0110/ai-daily-copilot/blob/main/web/app/api/forecasting/history/route.ts"
click node_auth_api "https://github.com/yosef0110/ai-daily-copilot/blob/main/web/app/api/auth/login/route.ts"
click node_fastapi "https://github.com/yosef0110/ai-daily-copilot/blob/main/ai-service/app/main.py"
click node_forecast_router "https://github.com/yosef0110/ai-daily-copilot/blob/main/ai-service/app/routers/forecasting.py"
click node_forecast_engine "https://github.com/yosef0110/ai-daily-copilot/blob/main/ai-service/app/services/forecast_service.py"
click node_forecast_advice "https://github.com/yosef0110/ai-daily-copilot/blob/main/ai-service/app/services/forecast_recommendation_service.py"
click node_import_router "https://github.com/yosef0110/ai-daily-copilot/blob/main/ai-service/app/routers/imports.py"
click node_excel_import "https://github.com/yosef0110/ai-daily-copilot/blob/main/ai-service/app/services/excel_import.py"
click node_receipt "https://github.com/yosef0110/ai-daily-copilot/blob/main/ai-service/app/services/receipt_extraction.py"
click node_copilot_router "https://github.com/yosef0110/ai-daily-copilot/blob/main/ai-service/app/routers/copilot.py"
click node_copilot_service "https://github.com/yosef0110/ai-daily-copilot/blob/main/ai-service/app/services/copilot_service.py"
click node_copilot_schema "https://github.com/yosef0110/ai-daily-copilot/blob/main/ai-service/app/schemas/copilot.py"

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_dashboard,node_products,node_inventory,node_transactions,node_imports_ui,node_forecast_ui,node_copilot_ui,node_auth_ui,node_owner toneBlue
class node_product_api,node_inventory_api,node_transaction_api,node_insights_api,node_copilot_api,node_forecast_api,node_auth_api toneAmber
class node_fastapi,node_forecast_router,node_forecast_engine,node_forecast_advice,node_import_router,node_excel_import,node_receipt,node_copilot_router,node_copilot_service,node_copilot_schema,node_gemini toneMint
class node_supabase toneRose
class node_ollama toneIndigo
```

## Components

### Business Web App

- [Dashboard](https://github.com/yosef0110/ai-daily-copilot/blob/main/web/app/(app)/dashboard/page.tsx): `web/app/(app)/dashboard/page.tsx`
- [Product Management](https://github.com/yosef0110/ai-daily-copilot/blob/main/web/app/(app)/products/page.tsx): `web/app/(app)/products/page.tsx`
- [Inventory Management](https://github.com/yosef0110/ai-daily-copilot/blob/main/web/app/(app)/inventory/page.tsx): `web/app/(app)/inventory/page.tsx`
- [Transaction Analytics](https://github.com/yosef0110/ai-daily-copilot/blob/main/web/app/(app)/transactions/page.tsx): `web/app/(app)/transactions/page.tsx`
- [Data Import](https://github.com/yosef0110/ai-daily-copilot/blob/main/web/app/(app)/imports/page.tsx): `web/app/(app)/imports/page.tsx`
- [Sales Forecasting](https://github.com/yosef0110/ai-daily-copilot/blob/main/web/app/(app)/forecast/page.tsx): `web/app/(app)/forecast/page.tsx`
- [AI Copilot](https://github.com/yosef0110/ai-daily-copilot/blob/main/web/components/copilot/AICopilot.tsx): `web/components/copilot/AICopilot.tsx`
- [Authentication Pages](https://github.com/yosef0110/ai-daily-copilot/blob/main/web/app/login/page.tsx): `web/app/login/page.tsx`

### Web API

- [Product API](https://github.com/yosef0110/ai-daily-copilot/blob/main/web/app/api/products/route.ts): `web/app/api/products/route.ts`
- [Inventory API](https://github.com/yosef0110/ai-daily-copilot/blob/main/web/app/api/inventory/route.ts): `web/app/api/inventory/route.ts`
- [Transaction APIs](https://github.com/yosef0110/ai-daily-copilot/blob/main/web/app/api/transactions/route.ts): `web/app/api/transactions/route.ts`
- [Insights API](https://github.com/yosef0110/ai-daily-copilot/blob/main/web/app/api/insights/route.ts): `web/app/api/insights/route.ts`
- [Copilot API](https://github.com/yosef0110/ai-daily-copilot/blob/main/web/app/api/copilot/route.ts): `web/app/api/copilot/route.ts`
- [Forecast History API](https://github.com/yosef0110/ai-daily-copilot/blob/main/web/app/api/forecasting/history/route.ts): `web/app/api/forecasting/history/route.ts`
- [Authentication API](https://github.com/yosef0110/ai-daily-copilot/blob/main/web/app/api/auth/login/route.ts): `web/app/api/auth/login/route.ts`

### AI Service

- [FastAPI Application](https://github.com/yosef0110/ai-daily-copilot/blob/main/ai-service/app/main.py): `ai-service/app/main.py`
- [Forecast Endpoints](https://github.com/yosef0110/ai-daily-copilot/blob/main/ai-service/app/routers/forecasting.py): `ai-service/app/routers/forecasting.py`
- [Forecast Models](https://github.com/yosef0110/ai-daily-copilot/blob/main/ai-service/app/services/forecast_service.py): `ai-service/app/services/forecast_service.py`
- [Forecast Recommendations](https://github.com/yosef0110/ai-daily-copilot/blob/main/ai-service/app/services/forecast_recommendation_service.py): `ai-service/app/services/forecast_recommendation_service.py`
- [Import Endpoints](https://github.com/yosef0110/ai-daily-copilot/blob/main/ai-service/app/routers/imports.py): `ai-service/app/routers/imports.py`
- [Spreadsheet Import](https://github.com/yosef0110/ai-daily-copilot/blob/main/ai-service/app/services/excel_import.py): `ai-service/app/services/excel_import.py`
- [Receipt Extraction](https://github.com/yosef0110/ai-daily-copilot/blob/main/ai-service/app/services/receipt_extraction.py): `ai-service/app/services/receipt_extraction.py`
- [Copilot Endpoint](https://github.com/yosef0110/ai-daily-copilot/blob/main/ai-service/app/routers/copilot.py): `ai-service/app/routers/copilot.py`
- [Copilot Response Service](https://github.com/yosef0110/ai-daily-copilot/blob/main/ai-service/app/services/copilot_service.py): `ai-service/app/services/copilot_service.py`
- [Copilot Context Schema](https://github.com/yosef0110/ai-daily-copilot/blob/main/ai-service/app/schemas/copilot.py): `ai-service/app/schemas/copilot.py`

### Business Data

- **Supabase / PostgreSQL**

### Other components

- **Business User**
- **Ollama / Qwen**
- **Gemini API**

## Connections

- Business User → Dashboard: views (evidence: `README.md`)
- Business User → Product Management: manages products (evidence: `README.md`)
- Business User → Inventory Management: manages stock (evidence: `README.md`)
- Business User → Transaction Analytics: reviews sales (evidence: `README.md`)
- Business User → Data Import: imports data (evidence: `README.md`)
- Business User → Sales Forecasting: requests forecasts (evidence: `README.md`)
- Business User → AI Copilot: asks questions (evidence: `README.md`)
- Business User → Authentication Pages: signs in (evidence: `README.md`)
- Product Management → Product API: requests products
- Inventory Management → Inventory API: requests stock
- Transaction Analytics → Transaction APIs: requests analytics
- Dashboard → Insights API: requests insights
- Sales Forecasting → Forecast History API: requests history
- AI Copilot → Copilot API: sends questions
- Authentication Pages → Authentication API: submits credentials
- Product API → Supabase / PostgreSQL: reads and writes (evidence: `README.md`)
- Inventory API → Supabase / PostgreSQL: reads and writes (evidence: `README.md`)
- Transaction APIs → Supabase / PostgreSQL: reads data (evidence: `README.md`)
- Authentication API → Supabase / PostgreSQL: uses authentication (evidence: `README.md`)
- Copilot API → FastAPI Application: forwards context
- Forecast History API → FastAPI Application: requests forecast
- FastAPI Application → Forecast Endpoints: registers router (evidence: `ai-service/app/main.py`)
- FastAPI Application → Copilot Endpoint: registers router (evidence: `ai-service/app/main.py`)
- FastAPI Application → Import Endpoints: registers router (evidence: `ai-service/app/main.py`)
- Forecast Endpoints → Forecast Models: calls (evidence: `ai-service/app/routers/forecasting.py`)
- Forecast Endpoints → Forecast Recommendations: calls (evidence: `ai-service/app/routers/forecasting.py`)
- Import Endpoints → Spreadsheet Import: calls (evidence: `ai-service/app/routers/imports.py`)
- Import Endpoints → Receipt Extraction: calls (evidence: `ai-service/app/routers/imports.py`)
- Copilot Endpoint → Copilot Response Service: calls (evidence: `ai-service/app/routers/copilot.py`)
- Copilot Response Service → Copilot Context Schema: uses context (evidence: `ai-service/app/services/copilot_service.py`)
- Copilot Response Service → Ollama / Qwen: sends prompt (evidence: `ai-service/app/services/copilot_service.py`)
- Receipt Extraction → Gemini API: extracts receipt data (evidence: `README.md`)
