# shawn-di/feedback_component architecture

> Architecture diagram of the GitHub repository shawn-di/feedback_component, 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/shawn-di/feedback_component
- Repository: https://github.com/shawn-di/feedback_component

## Overview

Feedback is delivered through three client experiences: a standalone Next.js page, an embeddable Web Component, and a framework-free page. Clients collect feedback details and screenshots, then either submit to the Next.js GitHub Issue API or, when configured, to a private Lark service. The Lark path validates and maps submissions, writes a record, and optionally uploads screenshot attachments. The README also documents a theme-editor demo and event-only submission when no endpoint is configured. Some wiring for unsampled page and integration code is represented only where documented.

Main entry points: [`src/components/feedback/FeedbackForm.tsx`](https://github.com/shawn-di/feedback_component/blob/main/src/components/feedback/FeedbackForm.tsx) (Feedback form), [`src/app/api/feedback/route.ts`](https://github.com/shawn-di/feedback_component/blob/main/src/app/api/feedback/route.ts) (Feedback API), [`lib/feedback-to-lark.mjs`](https://github.com/shawn-di/feedback_component/blob/main/lib/feedback-to-lark.mjs) (Lark feedback store), [`PR/index.html`](https://github.com/shawn-di/feedback_component/blob/main/PR/index.html) (Widget demo page)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_next["Next.js feedback"]
  node_nextpage["Feedback page<br/>[page.tsx]"]
  node_form["Feedback form<br/>[FeedbackForm.tsx]"]
  node_types["Type selector<br/>[TypeSelector.tsx]"]
  node_images["Screenshot upload<br/>[ImageUpload.tsx]"]
  node_nextapi["Feedback API<br/>[route.ts]"]
end

subgraph group_embed["Embeddable clients"]
  node_widget["Feedback widget<br/>[feedback-widget.js]"]
  node_solo["Standalone page<br/>[feedback_Solo.js]"]
  node_themedemo["Theme editor demo<br/>[demo.js]"]
  node_widgetdemo["Widget demo page<br/>[index.html]"]
  node_solohtml["Standalone page markup<br/>[feedback_Solo.html]"]
end

subgraph group_github["GitHub submission"]
  node_validation["Payload validation<br/>[feedback.ts]"]
  node_githubadapter["GitHub operations<br/>[github.ts]"]
end

subgraph group_lark["Lark service"]
  node_server["Private feedback server<br/>[server.mjs]"]
  node_larkstore["Lark feedback store"]
  node_clibridge["Lark CLI bridge<br/>[lark-cli.mjs]"]
end

node_visitor(("Feedback user"))
node_githubservice(("GitHub repository"))
node_endpoint(("Configured feedback endpoint"))
node_larkcli(("lark-cli"))
node_bitable[("Lark base table")]

node_visitor -->|"opens"| node_nextpage
node_nextpage -->|"renders"| node_form
node_form -->|"selects type"| node_types
node_form -->|"manages screenshots"| node_images
node_form -->|"POSTs feedback"| node_nextapi
node_nextapi -->|"validates and formats"| node_validation
node_nextapi -->|"uploads and creates issue"| node_githubadapter
node_githubadapter -->|"writes assets and issue"| node_githubservice
node_visitor -->|"opens demo"| node_widgetdemo
node_widgetdemo -->|"loads component"| node_widget
node_visitor -->|"opens page"| node_solohtml
node_solohtml -->|"loads script"| node_solo
node_themedemo -->|"configures theme"| node_widgetdemo
node_widget -.->|"POSTs when configured"| node_endpoint
node_solo -.->|"POSTs when configured"| node_endpoint
node_visitor -.->|"submits feedback"| node_server
node_server -->|"submits payload"| node_larkstore
node_larkstore -->|"runs table commands"| node_clibridge
node_clibridge -->|"executes commands"| node_larkcli
node_larkcli -->|"reads fields and writes records"| node_bitable
node_larkstore -->|"uploads screenshot attachments"| node_bitable

click node_nextpage "https://github.com/shawn-di/feedback_component/blob/main/src/app/page.tsx"
click node_form "https://github.com/shawn-di/feedback_component/blob/main/src/components/feedback/FeedbackForm.tsx"
click node_types "https://github.com/shawn-di/feedback_component/blob/main/src/components/feedback/TypeSelector.tsx"
click node_images "https://github.com/shawn-di/feedback_component/blob/main/src/components/feedback/ImageUpload.tsx"
click node_nextapi "https://github.com/shawn-di/feedback_component/blob/main/src/app/api/feedback/route.ts"
click node_validation "https://github.com/shawn-di/feedback_component/blob/main/src/lib/feedback.ts"
click node_githubadapter "https://github.com/shawn-di/feedback_component/blob/main/src/lib/github.ts"
click node_widget "https://github.com/shawn-di/feedback_component/blob/main/PR/feedback-widget.js"
click node_solo "https://github.com/shawn-di/feedback_component/blob/main/PR/feedback_Solo.js"
click node_themedemo "https://github.com/shawn-di/feedback_component/blob/main/demo.js"
click node_widgetdemo "https://github.com/shawn-di/feedback_component/blob/main/PR/index.html"
click node_solohtml "https://github.com/shawn-di/feedback_component/blob/main/PR/feedback_Solo.html"
click node_server "https://github.com/shawn-di/feedback_component/blob/main/server.mjs"
click node_larkstore "https://github.com/shawn-di/feedback_component/blob/main/lib/feedback-to-lark.mjs"
click node_clibridge "https://github.com/shawn-di/feedback_component/blob/main/lib/lark-cli.mjs"

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_nextpage,node_form,node_types,node_images,node_nextapi,node_visitor toneBlue
class node_widget,node_solo,node_themedemo,node_widgetdemo,node_solohtml,node_bitable toneAmber
class node_validation,node_githubadapter toneMint
class node_server,node_larkstore,node_clibridge toneRose
class node_githubservice,node_endpoint,node_larkcli toneIndigo
```

## Components

### Next.js feedback

- [Feedback page](https://github.com/shawn-di/feedback_component/blob/main/src/app/page.tsx): `src/app/page.tsx`
- [Feedback form](https://github.com/shawn-di/feedback_component/blob/main/src/components/feedback/FeedbackForm.tsx): `src/components/feedback/FeedbackForm.tsx`
- [Type selector](https://github.com/shawn-di/feedback_component/blob/main/src/components/feedback/TypeSelector.tsx): `src/components/feedback/TypeSelector.tsx`
- [Screenshot upload](https://github.com/shawn-di/feedback_component/blob/main/src/components/feedback/ImageUpload.tsx): `src/components/feedback/ImageUpload.tsx`
- [Feedback API](https://github.com/shawn-di/feedback_component/blob/main/src/app/api/feedback/route.ts): `src/app/api/feedback/route.ts`

### Embeddable clients

- [Feedback widget](https://github.com/shawn-di/feedback_component/blob/main/PR/feedback-widget.js): `PR/feedback-widget.js`
- [Standalone page](https://github.com/shawn-di/feedback_component/blob/main/PR/feedback_Solo.js): `PR/feedback_Solo.js`
- [Theme editor demo](https://github.com/shawn-di/feedback_component/blob/main/demo.js): `demo.js`
- [Widget demo page](https://github.com/shawn-di/feedback_component/blob/main/PR/index.html): `PR/index.html`
- [Standalone page markup](https://github.com/shawn-di/feedback_component/blob/main/PR/feedback_Solo.html): `PR/feedback_Solo.html`

### GitHub submission

- [Payload validation](https://github.com/shawn-di/feedback_component/blob/main/src/lib/feedback.ts): `src/lib/feedback.ts`
- [GitHub operations](https://github.com/shawn-di/feedback_component/blob/main/src/lib/github.ts): `src/lib/github.ts`

### Lark service

- [Private feedback server](https://github.com/shawn-di/feedback_component/blob/main/server.mjs): `server.mjs`
- [Lark feedback store](https://github.com/shawn-di/feedback_component/blob/main/lib/feedback-to-lark.mjs): `lib/feedback-to-lark.mjs`
- [Lark CLI bridge](https://github.com/shawn-di/feedback_component/blob/main/lib/lark-cli.mjs): `lib/lark-cli.mjs`

### Other components

- **Feedback user**
- **GitHub repository**
- **Configured feedback endpoint**
- **lark-cli**
- **Lark base table**

## Connections

- Feedback user → Feedback page: opens
- Feedback page → Feedback form: renders
- Feedback form → Type selector: selects type
- Feedback form → Screenshot upload: manages screenshots
- Feedback form → Feedback API: POSTs feedback
- Feedback API → Payload validation: validates and formats
- Feedback API → GitHub operations: uploads and creates issue
- GitHub operations → GitHub repository: writes assets and issue
- Feedback user → Widget demo page: opens demo
- Widget demo page → Feedback widget: loads component
- Feedback user → Standalone page markup: opens page
- Standalone page markup → Standalone page: loads script
- Theme editor demo → Widget demo page: configures theme
- Feedback widget → Configured feedback endpoint: POSTs when configured
- Standalone page → Configured feedback endpoint: POSTs when configured
- Feedback user → Private feedback server: submits feedback
- Private feedback server → Lark feedback store: submits payload
- Lark feedback store → Lark CLI bridge: runs table commands
- Lark CLI bridge → lark-cli: executes commands
- lark-cli → Lark base table: reads fields and writes records
- Lark feedback store → Lark base table: uploads screenshot attachments
