# dev-pitterpan/painel-web-automacao architecture

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

- Interactive diagram: https://gitdiagram.com/dev-pitterpan/painel-web-automacao
- Repository: https://github.com/dev-pitterpan/painel-web-automacao

## Overview

Pitter Pan Festas is a Next.js dashboard for reviewing product-processing history, monitoring integrations, managing Shopify products, and administering users. The main path is dashboard requests through the API to Google Sheets and metric aggregation, then presentation of results. Separate workflows handle Shopify catalog sync and direct product operations, n8n reprocessing, WinThor status sync, and account management. Some UI-to-API wiring and unsampled routes are not shown; those links are omitted unless the README documents them.

Main entry points: [`lib/auth.ts`](https://github.com/dev-pitterpan/painel-web-automacao/blob/main/lib/auth.ts) (Identity and catalog state), [`app/api/dashboard/route.ts`](https://github.com/dev-pitterpan/painel-web-automacao/blob/main/app/api/dashboard/route.ts) (Dashboard endpoint), [`app/api/shopify-products/route.ts`](https://github.com/dev-pitterpan/painel-web-automacao/blob/main/app/api/shopify-products/route.ts) (Catalog endpoint), [`app/api/shopify/product-editor/route.ts`](https://github.com/dev-pitterpan/painel-web-automacao/blob/main/app/api/shopify/product-editor/route.ts) (Product editor endpoint)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Dashboard UI"]
  node_dashboard["Dashboard view"]
  node_reports["Reports<br/>[ReportsClient.tsx]"]
  node_catalog_ui["Product catalog UI"]
  node_product_details["Product details"]
  node_product_panels["Product panel state"]
  node_thumbnails["Product thumbnails"]
  node_excluded_ui["Excluded products UI"]
  node_health_ui["Integration health UI"]
  node_users_ui["User administration UI<br/>[UsersClient.tsx]"]
end

subgraph group_api["API workflows"]
  node_dashboard_api["Dashboard endpoint<br/>[route.ts]"]
  node_catalog_api["Catalog endpoint<br/>[route.ts]"]
  node_editor_api["Product editor endpoint<br/>[route.ts]"]
  node_bulk_api["Bulk product actions<br/>[route.ts]"]
  node_reprocess_api["Reprocessing endpoint<br/>[route.ts]"]
  node_winthor_api["WinThor status endpoint<br/>[route.ts]"]
  node_audit_api["Audit endpoint<br/>[route.ts]"]
  node_users_api["User management endpoint<br/>[route.ts]"]
end

subgraph group_services["Data and integrations"]
  node_sheets["Processing history<br/>[googleSheets.ts]"]
  node_metrics["Metric aggregation<br/>[metrics.ts]"]
  node_shopify_admin["Shopify Admin API<br/>[shopify-admin.ts]"]
end

subgraph group_identity["Identity and administration"]
  node_auth[("Identity and catalog state<br/>[auth.ts]")]
end

node_operator(("Dashboard user"))
node_shopify["Shopify"]
node_google[("Google Sheets")]
node_n8n["n8n automation"]
node_winthor["WinThor export"]

node_operator -->|"views"| node_dashboard
node_dashboard_api -->|"reads history"| node_sheets
node_dashboard_api -->|"builds metrics"| node_metrics
node_dashboard_api -->|"loads settings"| node_auth
node_dashboard -.->|"requests data"| node_dashboard_api
node_reports -.->|"loads history"| node_dashboard_api
node_catalog_ui -->|"opens details"| node_product_details
node_product_panels -->|"renders"| node_product_details
node_thumbnails -->|"fetches details"| node_catalog_api
node_catalog_api -->|"reads catalog"| node_auth
node_catalog_ui -.->|"loads catalog"| node_catalog_api
node_editor_api -->|"loads product"| node_auth
node_editor_api -->|"updates product"| node_shopify_admin
node_editor_api -->|"edits product"| node_shopify
node_bulk_api -->|"runs bulk actions"| node_shopify_admin
node_catalog_api -->|"accepts catalog sync"| node_shopify
node_shopify -->|"sends webhooks"| node_catalog_api
node_reprocess_api -->|"dispatches reprocess"| node_n8n
node_winthor -->|"uploads statuses"| node_winthor_api
node_winthor_api -.->|"stores statuses"| node_auth
node_excluded_ui -.->|"loads exclusions"| node_auth
node_health_ui -.->|"shows status"| node_operator
node_users_api -->|"manages accounts"| node_auth
node_users_ui -.->|"administers users"| node_users_api
node_audit_api -.->|"records audit"| node_auth
node_google -->|"provides history"| node_sheets

click node_dashboard "https://github.com/dev-pitterpan/painel-web-automacao/blob/main/components/DashboardClient.tsx"
click node_reports "https://github.com/dev-pitterpan/painel-web-automacao/blob/main/components/ReportsClient.tsx"
click node_catalog_ui "https://github.com/dev-pitterpan/painel-web-automacao/blob/main/components/ShopifyProductsClient.tsx"
click node_product_details "https://github.com/dev-pitterpan/painel-web-automacao/blob/main/components/ProductDetailsDrawer.tsx"
click node_product_panels "https://github.com/dev-pitterpan/painel-web-automacao/blob/main/components/ProductPanelProvider.tsx"
click node_thumbnails "https://github.com/dev-pitterpan/painel-web-automacao/blob/main/components/ProductThumbnail.tsx"
click node_excluded_ui "https://github.com/dev-pitterpan/painel-web-automacao/blob/main/components/ExcludedProductsClient.tsx"
click node_health_ui "https://github.com/dev-pitterpan/painel-web-automacao/blob/main/components/IntegrationHealthClient.tsx"
click node_users_ui "https://github.com/dev-pitterpan/painel-web-automacao/blob/main/components/UsersClient.tsx"
click node_dashboard_api "https://github.com/dev-pitterpan/painel-web-automacao/blob/main/app/api/dashboard/route.ts"
click node_catalog_api "https://github.com/dev-pitterpan/painel-web-automacao/blob/main/app/api/shopify-products/route.ts"
click node_editor_api "https://github.com/dev-pitterpan/painel-web-automacao/blob/main/app/api/shopify/product-editor/route.ts"
click node_bulk_api "https://github.com/dev-pitterpan/painel-web-automacao/blob/main/app/api/shopify/product-bulk/route.ts"
click node_reprocess_api "https://github.com/dev-pitterpan/painel-web-automacao/blob/main/app/api/n8n/reprocess/route.ts"
click node_winthor_api "https://github.com/dev-pitterpan/painel-web-automacao/blob/main/app/api/winthor-products/route.ts"
click node_audit_api "https://github.com/dev-pitterpan/painel-web-automacao/blob/main/app/api/audit/route.ts"
click node_sheets "https://github.com/dev-pitterpan/painel-web-automacao/blob/main/lib/googleSheets.ts"
click node_metrics "https://github.com/dev-pitterpan/painel-web-automacao/blob/main/lib/metrics.ts"
click node_auth "https://github.com/dev-pitterpan/painel-web-automacao/blob/main/lib/auth.ts"
click node_users_api "https://github.com/dev-pitterpan/painel-web-automacao/blob/main/app/api/users/route.ts"
click node_shopify_admin "https://github.com/dev-pitterpan/painel-web-automacao/blob/main/lib/shopify-admin.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_dashboard,node_reports,node_catalog_ui,node_product_details,node_product_panels,node_thumbnails,node_excluded_ui,node_health_ui,node_users_ui,node_operator toneBlue
class node_dashboard_api,node_catalog_api,node_editor_api,node_bulk_api,node_reprocess_api,node_winthor_api,node_audit_api,node_users_api,node_google toneAmber
class node_sheets,node_metrics,node_shopify_admin toneMint
class node_auth toneRose
class node_shopify,node_n8n,node_winthor toneIndigo
```

## Components

### Dashboard UI

- [Dashboard view](https://github.com/dev-pitterpan/painel-web-automacao/blob/main/components/DashboardClient.tsx): `components/DashboardClient.tsx`
- [Reports](https://github.com/dev-pitterpan/painel-web-automacao/blob/main/components/ReportsClient.tsx): `components/ReportsClient.tsx`
- [Product catalog UI](https://github.com/dev-pitterpan/painel-web-automacao/blob/main/components/ShopifyProductsClient.tsx): `components/ShopifyProductsClient.tsx`
- [Product details](https://github.com/dev-pitterpan/painel-web-automacao/blob/main/components/ProductDetailsDrawer.tsx): `components/ProductDetailsDrawer.tsx`
- [Product panel state](https://github.com/dev-pitterpan/painel-web-automacao/blob/main/components/ProductPanelProvider.tsx): `components/ProductPanelProvider.tsx`
- [Product thumbnails](https://github.com/dev-pitterpan/painel-web-automacao/blob/main/components/ProductThumbnail.tsx): `components/ProductThumbnail.tsx`
- [Excluded products UI](https://github.com/dev-pitterpan/painel-web-automacao/blob/main/components/ExcludedProductsClient.tsx): `components/ExcludedProductsClient.tsx`
- [Integration health UI](https://github.com/dev-pitterpan/painel-web-automacao/blob/main/components/IntegrationHealthClient.tsx): `components/IntegrationHealthClient.tsx`
- [User administration UI](https://github.com/dev-pitterpan/painel-web-automacao/blob/main/components/UsersClient.tsx): `components/UsersClient.tsx`

### API workflows

- [Dashboard endpoint](https://github.com/dev-pitterpan/painel-web-automacao/blob/main/app/api/dashboard/route.ts): `app/api/dashboard/route.ts`
- [Catalog endpoint](https://github.com/dev-pitterpan/painel-web-automacao/blob/main/app/api/shopify-products/route.ts): `app/api/shopify-products/route.ts`
- [Product editor endpoint](https://github.com/dev-pitterpan/painel-web-automacao/blob/main/app/api/shopify/product-editor/route.ts): `app/api/shopify/product-editor/route.ts`
- [Bulk product actions](https://github.com/dev-pitterpan/painel-web-automacao/blob/main/app/api/shopify/product-bulk/route.ts): `app/api/shopify/product-bulk/route.ts`
- [Reprocessing endpoint](https://github.com/dev-pitterpan/painel-web-automacao/blob/main/app/api/n8n/reprocess/route.ts): `app/api/n8n/reprocess/route.ts`
- [WinThor status endpoint](https://github.com/dev-pitterpan/painel-web-automacao/blob/main/app/api/winthor-products/route.ts): `app/api/winthor-products/route.ts`
- [Audit endpoint](https://github.com/dev-pitterpan/painel-web-automacao/blob/main/app/api/audit/route.ts): `app/api/audit/route.ts`
- [User management endpoint](https://github.com/dev-pitterpan/painel-web-automacao/blob/main/app/api/users/route.ts): `app/api/users/route.ts`

### Data and integrations

- [Processing history](https://github.com/dev-pitterpan/painel-web-automacao/blob/main/lib/googleSheets.ts): `lib/googleSheets.ts`
- [Metric aggregation](https://github.com/dev-pitterpan/painel-web-automacao/blob/main/lib/metrics.ts): `lib/metrics.ts`
- [Shopify Admin API](https://github.com/dev-pitterpan/painel-web-automacao/blob/main/lib/shopify-admin.ts): `lib/shopify-admin.ts`

### Identity and administration

- [Identity and catalog state](https://github.com/dev-pitterpan/painel-web-automacao/blob/main/lib/auth.ts): `lib/auth.ts`

### Other components

- **Dashboard user**
- **Shopify**
- **Google Sheets**
- **n8n automation**
- **WinThor export**

## Connections

- Dashboard user → Dashboard view: views (evidence: `README.md`)
- Dashboard endpoint → Processing history: reads history (evidence: `app/api/dashboard/route.ts`)
- Dashboard endpoint → Metric aggregation: builds metrics (evidence: `app/api/dashboard/route.ts`)
- Dashboard endpoint → Identity and catalog state: loads settings (evidence: `app/api/dashboard/route.ts`)
- Dashboard view → Dashboard endpoint: requests data
- Reports → Dashboard endpoint: loads history
- Product catalog UI → Product details: opens details (evidence: `components/ShopifyProductsClient.tsx`)
- Product panel state → Product details: renders (evidence: `components/ProductPanelProvider.tsx`)
- Product thumbnails → Catalog endpoint: fetches details (evidence: `components/ProductThumbnail.tsx`)
- Catalog endpoint → Identity and catalog state: reads catalog (evidence: `app/api/shopify-products/route.ts`)
- Product catalog UI → Catalog endpoint: loads catalog
- Product editor endpoint → Identity and catalog state: loads product (evidence: `app/api/shopify/product-editor/route.ts`)
- Product editor endpoint → Shopify Admin API: updates product (evidence: `app/api/shopify/product-editor/route.ts`)
- Product editor endpoint → Shopify: edits product (evidence: `README.md`)
- Bulk product actions → Shopify Admin API: runs bulk actions (evidence: `app/api/shopify/product-bulk/route.ts`)
- Catalog endpoint → Shopify: accepts catalog sync (evidence: `README.md`)
- Shopify → Catalog endpoint: sends webhooks (evidence: `README.md`)
- Reprocessing endpoint → n8n automation: dispatches reprocess (evidence: `README.md`)
- WinThor export → WinThor status endpoint: uploads statuses (evidence: `README.md`)
- WinThor status endpoint → Identity and catalog state: stores statuses (evidence: `app/api/winthor-products/route.ts`)
- Excluded products UI → Identity and catalog state: loads exclusions
- Integration health UI → Dashboard user: shows status
- User management endpoint → Identity and catalog state: manages accounts (evidence: `app/api/users/route.ts`)
- User administration UI → User management endpoint: administers users
- Audit endpoint → Identity and catalog state: records audit
- Google Sheets → Processing history: provides history (evidence: `README.md`)
