# omonteon/product-feedback-app architecture

> Architecture diagram of the GitHub repository omonteon/product-feedback-app, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-08-31). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/omonteon/product-feedback-app
- Repository: https://github.com/omonteon/product-feedback-app

## Overview

##### Project type and purpose
- This is a front-end-only Single-Page Application (SPA) for managing product feedback.
- Built as a Frontend Mentor challenge: users can view, filter, sort, add, edit, delete feedback requests, and comment/reply.

##### File structure
- Top-level files: package.json, vite.config.ts, tsconfig.json → build/configuration for Vite & TypeScript.
- public/index.html → HTML template injected with bundled JS/CSS.
- src/
- api/FeedbackAPI.ts → abstraction over data fetching & persistence (initial JSON + localStorage).
- assets/… → static images & SVGs.
- components/… → reusable UI building blocks (Button, Card, Drawer, Tabs, etc.).
- pages/… → route-level containers (Home, FeedbackDetails, FeedbackEdit, FeedbackNew, Roadmap).
- routes/… → actual React Router v6 route definitions (file-based).
- interfaces/Feedback.ts → TypeScript types for domain models.
- main.tsx → application bootstrap (ReactDOM.render, Router, global CSS).

##### README for additional insights
- Tech stack: React, TypeScript, Vite, CSS Modules, React Router v6.
- No backend service—persistence via localStorage.
- Challenge requirements map to features in FeedbackAPI, pages, and components.

a. Main components
- Web Browser / Client
- Static Host / CDN (serves index.html, JS/CSS/images)
- React Application
- Router Layer (React Router v6)
- Pages (Home, FeedbackDetails, etc.)
- Component Library (Buttons, Cards, Drawers, Tabs…)
- API Layer (FeedbackAPI)
- Data Store (initial data.json + localStorage persistence)
- Assets (SVGs, images)
b. Relationships & interactions
1. Browser requests index.html from static host → receives bundled JS/CSS.
2. React App bootstraps in main.tsx → Router initializes routes.
3. User navigates (clicks sidebar links or tabs) → Router loads the appropriate Page component.
4. Page component calls FeedbackAPI methods (getAll, add, update, delete).
5. FeedbackAPI reads from initial data.json on first load, then reads/writes to localStorage.
6. Data passed as props to UI Components (e.g., FeedbackList → FeedbackCard, CommentThread).
7. User interactions (upvote, add comment) trigger state updates → API writes to localStorage → React re-renders.
c. Architectural patterns & design principles
- SPA pattern with client-side routing.
- Component-based architecture (atomic + composite components).
- Separation of concerns:
- Presentation (CSS Modules + React components)
- Domain logic & data access (FeedbackAPI)
- Routing (React Router v6)
- Module boundaries enforced by folder structure.
d. Key technologies
- Vite (dev server + build)
- React + ReactDOM
- React Router v6 (file-based routes under src/routes)
- TypeScript (types in src/interfaces)
- CSS Modules (scoped styles)
- localStorage (client persistence)

##### Final checklist
- All major layers (Hosting, App, Routing, Pages, Components, API, Data Store).
- Interactions labeled and numbered for clarity.
- Visual grouping (e.g., border around “src/components” modules).

## Diagram (Mermaid)

```mermaid
graph TD
  subgraph "Hosting & Bundling"
    Host[/"Static Host / CDN"/]:::hosting
    HTML["index.html"]:::hosting
  end

  subgraph "React Application Bootstrapping"
    Main["main.tsx"]:::core
    App["App.tsx"]:::core
  end

  subgraph "Routing Layer (React Router v6)"
    RoutesDir["src/routes"]:::core
    RIndex["index.tsx"]:::core
    RFeedback["feedback/index.tsx"]:::core
    RNew["feedback/new.tsx"]:::core
    REdit["feedback/edit.tsx"]:::core
    RRoadmap["roadmap/index.tsx"]:::core
  end

  subgraph "Pages (Route-level Containers)"
    Home["Home.tsx"]:::ui
    FBDetails["FeedbackDetails.tsx"]:::ui
    FBEdit["FeedbackEdit.tsx"]:::ui
    FBNew["FeedbackNew.tsx"]:::ui
    Roadmap["Roadmap.tsx"]:::ui
  end

  subgraph "Component Library"
    Button["Button.tsx"]:::ui
    Card["Card.tsx"]:::ui
    Drawer["Drawer.tsx"]:::ui
    Tabs["Tabs"]:::ui
    OtherComp["Other UI Components"]:::ui
  end

  subgraph "API Layer"
    API["FeedbackAPI.ts"]:::data
    Interfaces["Feedback.ts"]:::data
  end

  subgraph "Data Store"
    JSON["data.json"]:::storage
    LS[(localStorage)]:::storage
  end

  subgraph "Assets"
    AssetsDir["src/assets"]:::asset
  end

  Host -->|serves| HTML
  HTML -->|loads| Main
  Main -->|initializes| App
  App -->|uses| RoutesDir
  RoutesDir --> RIndex
  RoutesDir --> RFeedback
  RoutesDir --> RNew
  RoutesDir --> REdit
  RoutesDir --> RRoadmap

  RIndex -->|renders| Home
  RFeedback -->|renders| FBDetails
  RNew -->|renders| FBNew
  REdit -->|renders| FBEdit
  RRoadmap -->|renders| Roadmap

  Home -->|uses| Button
  Home -->|uses| Card
  Home -->|uses| OtherComp
  FBDetails -->|uses| Card
  FBDetails -->|uses| CommentThread[Comment & Replies]:::ui
  FBEdit -->|uses| FeedbackForm[Feedback Form]:::ui
  FBNew -->|uses| FeedbackForm
  Roadmap -->|uses| Tabs
  Roadmap -->|uses| OtherComp

  Home -->|calls| API
  FBDetails -->|calls| API
  FBEdit -->|calls| API
  FBNew -->|calls| API
  Roadmap -->|calls| API

  API -->|reads| JSON
  API -->|reads/writes| LS
  API -->|uses| Interfaces

  Home -->|loads assets| AssetsDir
  FBDetails -->|loads assets| AssetsDir
  FBEdit -->|loads assets| AssetsDir
  FBNew -->|loads assets| AssetsDir
  Roadmap -->|loads assets| AssetsDir

  classDef hosting fill:#d3d3d3,stroke:#333,stroke-width:1px;
  classDef core fill:#add8e6,stroke:#333,stroke-width:1px;
  classDef ui fill:#90ee90,stroke:#333,stroke-width:1px;
  classDef data fill:#ffa500,stroke:#333,stroke-width:1px;
  classDef storage fill:#ffff99,stroke:#333,stroke-width:1px;
  classDef asset fill:#dda0dd,stroke:#333,stroke-width:1px;

  click HTML "https://github.com/omonteon/product-feedback-app/blob/main/index.html"
  click Main "https://github.com/omonteon/product-feedback-app/blob/main/src/main.tsx"
  click App "https://github.com/omonteon/product-feedback-app/blob/main/src/App.tsx"
  click RoutesDir "https://github.com/omonteon/product-feedback-app/tree/main/src/routes/"
  click RIndex "https://github.com/omonteon/product-feedback-app/blob/main/src/routes/index.tsx"
  click RFeedback "https://github.com/omonteon/product-feedback-app/blob/main/src/routes/feedback/index.tsx"
  click RNew "https://github.com/omonteon/product-feedback-app/blob/main/src/routes/feedback/new.tsx"
  click REdit "https://github.com/omonteon/product-feedback-app/blob/main/src/routes/feedback/edit.tsx"
  click RRoadmap "https://github.com/omonteon/product-feedback-app/blob/main/src/routes/roadmap/index.tsx"
  click Home "https://github.com/omonteon/product-feedback-app/blob/main/src/pages/Home/Home.tsx"
  click FBDetails "https://github.com/omonteon/product-feedback-app/blob/main/src/pages/FeedbackDetails/FeedbackDetails.tsx"
  click FBEdit "https://github.com/omonteon/product-feedback-app/blob/main/src/pages/FeedbackEdit/FeedbackEdit.tsx"
  click FBNew "https://github.com/omonteon/product-feedback-app/blob/main/src/pages/FeedbackNew/FeedbackNew.tsx"
  click Roadmap "https://github.com/omonteon/product-feedback-app/blob/main/src/pages/Roadmap/Roadmap.tsx"
  click Button "https://github.com/omonteon/product-feedback-app/blob/main/src/components/Button/Button.tsx"
  click Card "https://github.com/omonteon/product-feedback-app/blob/main/src/components/Card/Card.tsx"
  click Drawer "https://github.com/omonteon/product-feedback-app/blob/main/src/components/Drawer/Drawer.tsx"
  click Tabs "https://github.com/omonteon/product-feedback-app/tree/main/src/components/Tabs/"
  click API "https://github.com/omonteon/product-feedback-app/blob/main/src/api/FeedbackAPI.ts"
  click Interfaces "https://github.com/omonteon/product-feedback-app/blob/main/src/interfaces/Feedback.ts"
  click JSON "https://github.com/omonteon/product-feedback-app/blob/main/src/data.json"
  click AssetsDir "https://github.com/omonteon/product-feedback-app/tree/main/src/assets/"
```
