# zulkarnainfaizan/my-app architecture

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

- Interactive diagram: https://gitdiagram.com/zulkarnainfaizan/my-app
- Repository: https://github.com/zulkarnainfaizan/my-app

## Overview

This repository is a small product-review and chat application: a React client displays product reviews and can request an AI summary, while an optional chat interface sends prompts to a server. Review summaries are fetched or generated, cached, and returned; chat prompts are validated, sent to a language model, and associated with a conversation. Source excerpts establish the server-side calls and UI composition. Client-to-server links and unsampled product persistence are shown only as unverified where their wiring is not visible.

Main entry points: [`packages/client/src/components/reviews/ReviewList.tsx`](https://github.com/zulkarnainfaizan/my-app/blob/main/packages/client/src/components/reviews/ReviewList.tsx) (Review List), [`packages/client/src/components/chat/ChatBot.tsx`](https://github.com/zulkarnainfaizan/my-app/blob/main/packages/client/src/components/chat/ChatBot.tsx) (Chat Bot), [`packages/server/llm/client.ts`](https://github.com/zulkarnainfaizan/my-app/blob/main/packages/server/llm/client.ts) (LLM Client), [`packages/server/routes.ts`](https://github.com/zulkarnainfaizan/my-app/blob/main/packages/server/routes.ts) (API Routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Client UI"]
  node_client_entry["Client Entry<br/>[main.tsx]"]
  node_app["App View<br/>[App.tsx]"]
  node_review_list["Review List<br/>[ReviewList.tsx]"]
  node_reviews_api["Reviews API Client<br/>[reviewsApi.ts]"]
  node_star_rating["Star Rating<br/>[StarRating.tsx]"]
  node_review_skeleton["Review Skeleton<br/>[ReviewSkeleton.tsx]"]
  node_button["Button<br/>[button.tsx]"]
  node_chat_bot["Chat Bot<br/>[ChatBot.tsx]"]
  node_chat_input["Chat Input<br/>[ChatInput.tsx]"]
  node_chat_messages["Chat Messages<br/>[ChatMessages.tsx]"]
  node_typing_indicator["Typing Indicator"]
end

subgraph group_server["Server API"]
  node_routes["API Routes<br/>[routes.ts]"]
  node_review_controller["Review Controller"]
  node_chat_controller["Chat Controller<br/>[chat.controller.ts]"]
  node_server_entry["Server Entry<br/>[index.ts]"]
end

subgraph group_review["Review Summaries"]
  node_review_service["Summary Service<br/>[review.service.ts]"]
  node_llm_client["LLM Client<br/>[client.ts]"]
  node_summary_prompt["Summary Prompt"]
end

subgraph group_chat["Chat Generation"]
  node_chat_service["Chat Service<br/>[chat.service.ts]"]
end

subgraph group_storage["Persistence"]
  node_review_repository["Review Repository"]
  node_product_repository["Product Repository"]
  node_conversation_repository["Conversation Repository"]
  node_database[("Application Database<br/>[schema.prisma]")]
end

node_user(("User"))
node_openai{{"OpenAI"}}
node_huggingface{{"Hugging Face Inference"}}

node_user -->|"uses"| node_client_entry
node_client_entry -->|"renders"| node_app
node_app -->|"renders"| node_review_list
node_app -.->|"optional view"| node_chat_bot
node_review_list -->|"requests data"| node_reviews_api
node_review_list -->|"renders"| node_star_rating
node_review_list -->|"renders"| node_review_skeleton
node_review_list -->|"uses"| node_button
node_chat_bot -->|"renders"| node_chat_input
node_chat_bot -->|"renders"| node_chat_messages
node_chat_bot -->|"renders"| node_typing_indicator
node_chat_input -->|"uses"| node_button
node_reviews_api -.->|"calls API"| node_routes
node_chat_bot -.->|"posts prompt"| node_routes
node_server_entry -->|"loads routes"| node_routes
node_routes -->|"routes requests"| node_review_controller
node_routes -->|"routes requests"| node_chat_controller
node_review_controller -->|"requests summary"| node_review_service
node_review_controller -->|"checks product"| node_product_repository
node_review_controller -->|"reads reviews"| node_review_repository
node_review_service -->|"reads and stores"| node_review_repository
node_review_service -->|"generates summary"| node_llm_client
node_llm_client -->|"uses prompt"| node_summary_prompt
node_llm_client -->|"requests inference"| node_huggingface
node_chat_controller -->|"sends message"| node_chat_service
node_chat_service -->|"generates response"| node_llm_client
node_chat_service -->|"tracks response ID"| node_conversation_repository
node_llm_client -->|"generates text"| node_openai
node_review_repository -->|"reads and writes"| node_database
node_product_repository -.->|"accesses products"| node_database
node_conversation_repository -.->|"stores conversation state"| node_database

click node_client_entry "https://github.com/zulkarnainfaizan/my-app/blob/main/packages/client/src/main.tsx"
click node_app "https://github.com/zulkarnainfaizan/my-app/blob/main/packages/client/src/App.tsx"
click node_review_list "https://github.com/zulkarnainfaizan/my-app/blob/main/packages/client/src/components/reviews/ReviewList.tsx"
click node_reviews_api "https://github.com/zulkarnainfaizan/my-app/blob/main/packages/client/src/components/reviews/reviewsApi.ts"
click node_star_rating "https://github.com/zulkarnainfaizan/my-app/blob/main/packages/client/src/components/reviews/StarRating.tsx"
click node_review_skeleton "https://github.com/zulkarnainfaizan/my-app/blob/main/packages/client/src/components/reviews/ReviewSkeleton.tsx"
click node_button "https://github.com/zulkarnainfaizan/my-app/blob/main/packages/client/src/components/ui/button.tsx"
click node_chat_bot "https://github.com/zulkarnainfaizan/my-app/blob/main/packages/client/src/components/chat/ChatBot.tsx"
click node_chat_input "https://github.com/zulkarnainfaizan/my-app/blob/main/packages/client/src/components/chat/ChatInput.tsx"
click node_chat_messages "https://github.com/zulkarnainfaizan/my-app/blob/main/packages/client/src/components/chat/ChatMessages.tsx"
click node_typing_indicator "https://github.com/zulkarnainfaizan/my-app/blob/main/packages/client/src/components/chat/TypingIndicator.tsx"
click node_routes "https://github.com/zulkarnainfaizan/my-app/blob/main/packages/server/routes.ts"
click node_review_controller "https://github.com/zulkarnainfaizan/my-app/blob/main/packages/server/controllers/review.controllers.ts"
click node_chat_controller "https://github.com/zulkarnainfaizan/my-app/blob/main/packages/server/controllers/chat.controller.ts"
click node_server_entry "https://github.com/zulkarnainfaizan/my-app/blob/main/packages/server/index.ts"
click node_review_service "https://github.com/zulkarnainfaizan/my-app/blob/main/packages/server/services/review.service.ts"
click node_llm_client "https://github.com/zulkarnainfaizan/my-app/blob/main/packages/server/llm/client.ts"
click node_summary_prompt "https://github.com/zulkarnainfaizan/my-app/blob/main/packages/server/llm/prompts/summarize-reviews.txt"
click node_chat_service "https://github.com/zulkarnainfaizan/my-app/blob/main/packages/server/services/chat.service.ts"
click node_review_repository "https://github.com/zulkarnainfaizan/my-app/blob/main/packages/server/repositories/review.repository.ts"
click node_product_repository "https://github.com/zulkarnainfaizan/my-app/blob/main/packages/server/repositories/product.repository.ts"
click node_conversation_repository "https://github.com/zulkarnainfaizan/my-app/blob/main/packages/server/repositories/conversation.repository.ts"
click node_database "https://github.com/zulkarnainfaizan/my-app/blob/main/packages/server/prisma/schema.prisma"

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_client_entry,node_app,node_review_list,node_reviews_api,node_star_rating,node_review_skeleton,node_button,node_chat_bot,node_chat_input,node_chat_messages,node_typing_indicator,node_user toneBlue
class node_routes,node_review_controller,node_chat_controller,node_server_entry toneAmber
class node_review_service,node_llm_client,node_summary_prompt toneMint
class node_chat_service toneRose
class node_review_repository,node_product_repository,node_conversation_repository,node_database,node_openai,node_huggingface toneIndigo
```

## Components

### Client UI

- [Client Entry](https://github.com/zulkarnainfaizan/my-app/blob/main/packages/client/src/main.tsx): `packages/client/src/main.tsx`
- [App View](https://github.com/zulkarnainfaizan/my-app/blob/main/packages/client/src/App.tsx): `packages/client/src/App.tsx`
- [Review List](https://github.com/zulkarnainfaizan/my-app/blob/main/packages/client/src/components/reviews/ReviewList.tsx): `packages/client/src/components/reviews/ReviewList.tsx`
- [Reviews API Client](https://github.com/zulkarnainfaizan/my-app/blob/main/packages/client/src/components/reviews/reviewsApi.ts): `packages/client/src/components/reviews/reviewsApi.ts`
- [Star Rating](https://github.com/zulkarnainfaizan/my-app/blob/main/packages/client/src/components/reviews/StarRating.tsx): `packages/client/src/components/reviews/StarRating.tsx`
- [Review Skeleton](https://github.com/zulkarnainfaizan/my-app/blob/main/packages/client/src/components/reviews/ReviewSkeleton.tsx): `packages/client/src/components/reviews/ReviewSkeleton.tsx`
- [Button](https://github.com/zulkarnainfaizan/my-app/blob/main/packages/client/src/components/ui/button.tsx): `packages/client/src/components/ui/button.tsx`
- [Chat Bot](https://github.com/zulkarnainfaizan/my-app/blob/main/packages/client/src/components/chat/ChatBot.tsx): `packages/client/src/components/chat/ChatBot.tsx`
- [Chat Input](https://github.com/zulkarnainfaizan/my-app/blob/main/packages/client/src/components/chat/ChatInput.tsx): `packages/client/src/components/chat/ChatInput.tsx`
- [Chat Messages](https://github.com/zulkarnainfaizan/my-app/blob/main/packages/client/src/components/chat/ChatMessages.tsx): `packages/client/src/components/chat/ChatMessages.tsx`
- [Typing Indicator](https://github.com/zulkarnainfaizan/my-app/blob/main/packages/client/src/components/chat/TypingIndicator.tsx): `packages/client/src/components/chat/TypingIndicator.tsx`

### Server API

- [API Routes](https://github.com/zulkarnainfaizan/my-app/blob/main/packages/server/routes.ts): `packages/server/routes.ts`
- [Review Controller](https://github.com/zulkarnainfaizan/my-app/blob/main/packages/server/controllers/review.controllers.ts): `packages/server/controllers/review.controllers.ts`
- [Chat Controller](https://github.com/zulkarnainfaizan/my-app/blob/main/packages/server/controllers/chat.controller.ts): `packages/server/controllers/chat.controller.ts`
- [Server Entry](https://github.com/zulkarnainfaizan/my-app/blob/main/packages/server/index.ts): `packages/server/index.ts`

### Review Summaries

- [Summary Service](https://github.com/zulkarnainfaizan/my-app/blob/main/packages/server/services/review.service.ts): `packages/server/services/review.service.ts`
- [LLM Client](https://github.com/zulkarnainfaizan/my-app/blob/main/packages/server/llm/client.ts): `packages/server/llm/client.ts`
- [Summary Prompt](https://github.com/zulkarnainfaizan/my-app/blob/main/packages/server/llm/prompts/summarize-reviews.txt): `packages/server/llm/prompts/summarize-reviews.txt`

### Chat Generation

- [Chat Service](https://github.com/zulkarnainfaizan/my-app/blob/main/packages/server/services/chat.service.ts): `packages/server/services/chat.service.ts`

### Persistence

- [Review Repository](https://github.com/zulkarnainfaizan/my-app/blob/main/packages/server/repositories/review.repository.ts): `packages/server/repositories/review.repository.ts`
- [Product Repository](https://github.com/zulkarnainfaizan/my-app/blob/main/packages/server/repositories/product.repository.ts): `packages/server/repositories/product.repository.ts`
- [Conversation Repository](https://github.com/zulkarnainfaizan/my-app/blob/main/packages/server/repositories/conversation.repository.ts): `packages/server/repositories/conversation.repository.ts`
- [Application Database](https://github.com/zulkarnainfaizan/my-app/blob/main/packages/server/prisma/schema.prisma): `packages/server/prisma/schema.prisma`

### Other components

- **User**
- **OpenAI**
- **Hugging Face Inference**

## Connections

- User → Client Entry: uses
- Client Entry → App View: renders (evidence: `packages/client/src/main.tsx`)
- App View → Review List: renders (evidence: `packages/client/src/App.tsx`)
- App View → Chat Bot: optional view (evidence: `packages/client/src/App.tsx`)
- Review List → Reviews API Client: requests data (evidence: `packages/client/src/components/reviews/ReviewList.tsx`)
- Review List → Star Rating: renders (evidence: `packages/client/src/components/reviews/ReviewList.tsx`)
- Review List → Review Skeleton: renders (evidence: `packages/client/src/components/reviews/ReviewList.tsx`)
- Review List → Button: uses (evidence: `packages/client/src/components/reviews/ReviewList.tsx`)
- Chat Bot → Chat Input: renders (evidence: `packages/client/src/components/chat/ChatBot.tsx`)
- Chat Bot → Chat Messages: renders (evidence: `packages/client/src/components/chat/ChatBot.tsx`)
- Chat Bot → Typing Indicator: renders (evidence: `packages/client/src/components/chat/ChatBot.tsx`)
- Chat Input → Button: uses (evidence: `packages/client/src/components/chat/ChatInput.tsx`)
- Reviews API Client → API Routes: calls API
- Chat Bot → API Routes: posts prompt
- Server Entry → API Routes: loads routes (evidence: `packages/server/index.ts`)
- API Routes → Review Controller: routes requests (evidence: `packages/server/routes.ts`)
- API Routes → Chat Controller: routes requests (evidence: `packages/server/routes.ts`)
- Review Controller → Summary Service: requests summary (evidence: `packages/server/controllers/review.controllers.ts`)
- Review Controller → Product Repository: checks product (evidence: `packages/server/controllers/review.controllers.ts`)
- Review Controller → Review Repository: reads reviews (evidence: `packages/server/controllers/review.controllers.ts`)
- Summary Service → Review Repository: reads and stores (evidence: `packages/server/services/review.service.ts`)
- Summary Service → LLM Client: generates summary (evidence: `packages/server/services/review.service.ts`)
- LLM Client → Summary Prompt: uses prompt (evidence: `packages/server/llm/client.ts`)
- LLM Client → Hugging Face Inference: requests inference (evidence: `packages/server/llm/client.ts`)
- Chat Controller → Chat Service: sends message (evidence: `packages/server/controllers/chat.controller.ts`)
- Chat Service → LLM Client: generates response (evidence: `packages/server/services/chat.service.ts`)
- Chat Service → Conversation Repository: tracks response ID (evidence: `packages/server/services/chat.service.ts`)
- LLM Client → OpenAI: generates text (evidence: `packages/server/llm/client.ts`)
- Review Repository → Application Database: reads and writes (evidence: `packages/server/repositories/review.repository.ts`)
- Product Repository → Application Database: accesses products
- Conversation Repository → Application Database: stores conversation state
