# bilohlazova/happydate architecture

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

- Interactive diagram: https://gitdiagram.com/bilohlazova/happydate
- Repository: https://github.com/bilohlazova/happydate

## Overview

HappyDate is a user-facing date, people, notes, and AI gift-assistance application. Its main workflow is users maintaining people and events, then receiving a personalized home view and using chat or gift recommendations for follow-up. The graph also preserves documented authentication, notes, profile, calendar, and real-time database capabilities. Several feature branches are represented by their exact tree paths, but their internal wiring was not sampled; only evidenced relationships are connected.

Main entry points: [`src/app/api/ai/gift-suggestions/route.ts`](https://github.com/bilohlazova/happydate/blob/main/src/app/api/ai/gift-suggestions/route.ts) (Gift suggestions endpoint), [`src/app/api/ai-chat/route.ts`](https://github.com/bilohlazova/happydate/blob/main/src/app/api/ai-chat/route.ts) (Chat endpoint), [`src/lib/supabaseClient.ts`](https://github.com/bilohlazova/happydate/blob/main/src/lib/supabaseClient.ts) (Supabase client), [`src/app/api/happy/agent/route.ts`](https://github.com/bilohlazova/happydate/blob/main/src/app/api/happy/agent/route.ts) (Happy agent endpoint)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User experience"]
  node_home["Home dashboard<br/>[HomePageClient.tsx]"]
  node_chat["Assistant chat"]
  node_giftui["Gift workspace"]
end

subgraph group_assistant["AI assistance"]
  node_assistant_api["Chat endpoint<br/>[route.ts]"]
  node_chat_server["Chat response service<br/>[chatServer.ts]"]
  node_happy_agent["Happy agent endpoint<br/>[route.ts]"]
  node_agent_context["Agent context builder"]
  node_gift_api["Gift suggestions endpoint<br/>[route.ts]"]
end

subgraph group_domain["People and planning"]
  node_people["People profiles"]
  node_events["Events calendar<br/>[page.tsx]"]
  node_notes["Notes"]
  node_home_data["Home data loader<br/>[loadHome.ts]"]
  node_gift_data["Gift data access<br/>[gift.loaders.ts]"]
end

subgraph group_intelligence["Personalization"]
  node_brain["Insight engines"]
  node_knowledge["Knowledge layer<br/>[knowledgeLayer.ts]"]
  node_gift_intelligence["Gift intelligence"]
end

subgraph group_platform["Data and services"]
  node_auth["Authentication<br/>[AuthProvider.tsx]"]
  node_supabase_client["Supabase client<br/>[supabaseClient.ts]"]
  node_supabase[("Supabase services")]
  node_supabase_config["Supabase public config<br/>[publicConfig.ts]"]
  node_limiter["Assistant rate limiting<br/>[rateLimiter.ts]"]
end

node_user(("User"))
node_openai["OpenAI"]

node_user -->|"views"| node_home
node_user -->|"manages"| node_people
node_user -->|"manages"| node_events
node_user -->|"manages"| node_notes
node_user -.->|"asks"| node_chat
node_user -.->|"requests ideas"| node_giftui
node_home -->|"loads"| node_home_data
node_home_data -.->|"builds insights"| node_brain
node_chat -.->|"sends requests"| node_assistant_api
node_assistant_api -->|"creates responses"| node_chat_server
node_assistant_api -->|"checks limits"| node_limiter
node_chat_server -.->|"requests completion"| node_openai
node_happy_agent -->|"builds context"| node_agent_context
node_happy_agent -.->|"requests completion"| node_openai
node_gift_api -->|"loads gift data"| node_gift_data
node_gift_api -->|"validates suggestions"| node_gift_intelligence
node_gift_api -.->|"generates ideas"| node_openai
node_auth -.->|"uses"| node_supabase_client
node_supabase_client -->|"loads config"| node_supabase_config
node_supabase_client -->|"connects"| node_supabase
node_people -.->|"stores profile data"| node_supabase
node_events -.->|"stores events"| node_supabase
node_notes -.->|"stores notes"| node_supabase

click node_home "https://github.com/bilohlazova/happydate/blob/main/src/components/HomePageClient.tsx"
click node_chat "https://github.com/bilohlazova/happydate/blob/main/src/components/ChatAssistantModal.tsx"
click node_people "https://github.com/bilohlazova/happydate/blob/main/src/components/people/PeoplePageContent.tsx"
click node_events "https://github.com/bilohlazova/happydate/blob/main/src/app/events/%5Bid%5D/page.tsx"
click node_notes "https://github.com/bilohlazova/happydate/blob/main/src/app/notes/NotesPageContent.tsx"
click node_giftui "https://github.com/bilohlazova/happydate/blob/main/src/components/gift/GiftDiscoveryPanel.tsx"
click node_home_data "https://github.com/bilohlazova/happydate/blob/main/src/lib/home/loadHome.ts"
click node_brain "https://github.com/bilohlazova/happydate/blob/main/src/lib/brain/engines/memoryInsightEngine.ts"
click node_knowledge "https://github.com/bilohlazova/happydate/blob/main/src/lib/knowledge/knowledgeLayer.ts"
click node_assistant_api "https://github.com/bilohlazova/happydate/blob/main/src/app/api/ai-chat/route.ts"
click node_chat_server "https://github.com/bilohlazova/happydate/blob/main/src/lib/assistant/chatServer.ts"
click node_happy_agent "https://github.com/bilohlazova/happydate/blob/main/src/app/api/happy/agent/route.ts"
click node_agent_context "https://github.com/bilohlazova/happydate/blob/main/src/lib/happy/agent-context/buildHappyAgentContext.server.ts"
click node_gift_api "https://github.com/bilohlazova/happydate/blob/main/src/app/api/ai/gift-suggestions/route.ts"
click node_gift_intelligence "https://github.com/bilohlazova/happydate/blob/main/src/lib/gift-intelligence/giftRecommendationPrompt.ts"
click node_gift_data "https://github.com/bilohlazova/happydate/blob/main/src/lib/gifts/gift.loaders.ts"
click node_auth "https://github.com/bilohlazova/happydate/blob/main/src/components/AuthProvider.tsx"
click node_supabase_client "https://github.com/bilohlazova/happydate/blob/main/src/lib/supabaseClient.ts"
click node_supabase_config "https://github.com/bilohlazova/happydate/blob/main/src/lib/supabase/publicConfig.ts"
click node_limiter "https://github.com/bilohlazova/happydate/blob/main/src/lib/assistant/rateLimiter.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_home,node_chat,node_giftui,node_user toneBlue
class node_assistant_api,node_chat_server,node_happy_agent,node_agent_context,node_gift_api toneAmber
class node_people,node_events,node_notes,node_home_data,node_gift_data toneMint
class node_brain,node_knowledge,node_gift_intelligence toneRose
class node_auth,node_supabase_client,node_supabase,node_supabase_config,node_limiter,node_openai toneIndigo
```

## Components

### User experience

- [Home dashboard](https://github.com/bilohlazova/happydate/blob/main/src/components/HomePageClient.tsx): `src/components/HomePageClient.tsx`
- [Assistant chat](https://github.com/bilohlazova/happydate/blob/main/src/components/ChatAssistantModal.tsx): `src/components/ChatAssistantModal.tsx`
- [Gift workspace](https://github.com/bilohlazova/happydate/blob/main/src/components/gift/GiftDiscoveryPanel.tsx): `src/components/gift/GiftDiscoveryPanel.tsx`

### AI assistance

- [Chat endpoint](https://github.com/bilohlazova/happydate/blob/main/src/app/api/ai-chat/route.ts): `src/app/api/ai-chat/route.ts`
- [Chat response service](https://github.com/bilohlazova/happydate/blob/main/src/lib/assistant/chatServer.ts): `src/lib/assistant/chatServer.ts`
- [Happy agent endpoint](https://github.com/bilohlazova/happydate/blob/main/src/app/api/happy/agent/route.ts): `src/app/api/happy/agent/route.ts`
- [Agent context builder](https://github.com/bilohlazova/happydate/blob/main/src/lib/happy/agent-context/buildHappyAgentContext.server.ts): `src/lib/happy/agent-context/buildHappyAgentContext.server.ts`
- [Gift suggestions endpoint](https://github.com/bilohlazova/happydate/blob/main/src/app/api/ai/gift-suggestions/route.ts): `src/app/api/ai/gift-suggestions/route.ts`

### People and planning

- [People profiles](https://github.com/bilohlazova/happydate/blob/main/src/components/people/PeoplePageContent.tsx): `src/components/people/PeoplePageContent.tsx`
- [Events calendar](https://github.com/bilohlazova/happydate/blob/main/src/app/events/%5Bid%5D/page.tsx): `src/app/events/[id]/page.tsx`
- [Notes](https://github.com/bilohlazova/happydate/blob/main/src/app/notes/NotesPageContent.tsx): `src/app/notes/NotesPageContent.tsx`
- [Home data loader](https://github.com/bilohlazova/happydate/blob/main/src/lib/home/loadHome.ts): `src/lib/home/loadHome.ts`
- [Gift data access](https://github.com/bilohlazova/happydate/blob/main/src/lib/gifts/gift.loaders.ts): `src/lib/gifts/gift.loaders.ts`

### Personalization

- [Insight engines](https://github.com/bilohlazova/happydate/blob/main/src/lib/brain/engines/memoryInsightEngine.ts): `src/lib/brain/engines/memoryInsightEngine.ts`
- [Knowledge layer](https://github.com/bilohlazova/happydate/blob/main/src/lib/knowledge/knowledgeLayer.ts): `src/lib/knowledge/knowledgeLayer.ts`
- [Gift intelligence](https://github.com/bilohlazova/happydate/blob/main/src/lib/gift-intelligence/giftRecommendationPrompt.ts): `src/lib/gift-intelligence/giftRecommendationPrompt.ts`

### Data and services

- [Authentication](https://github.com/bilohlazova/happydate/blob/main/src/components/AuthProvider.tsx): `src/components/AuthProvider.tsx`
- [Supabase client](https://github.com/bilohlazova/happydate/blob/main/src/lib/supabaseClient.ts): `src/lib/supabaseClient.ts`
- **Supabase services**
- [Supabase public config](https://github.com/bilohlazova/happydate/blob/main/src/lib/supabase/publicConfig.ts): `src/lib/supabase/publicConfig.ts`
- [Assistant rate limiting](https://github.com/bilohlazova/happydate/blob/main/src/lib/assistant/rateLimiter.ts): `src/lib/assistant/rateLimiter.ts`

### Other components

- **User**
- **OpenAI**

## Connections

- User → Home dashboard: views (evidence: `README.md`)
- User → People profiles: manages (evidence: `README.md`)
- User → Events calendar: manages (evidence: `README.md`)
- User → Notes: manages (evidence: `README.md`)
- User → Assistant chat: asks
- User → Gift workspace: requests ideas
- Home dashboard → Home data loader: loads (evidence: `src/components/HomePageClient.tsx`)
- Home data loader → Insight engines: builds insights
- Assistant chat → Chat endpoint: sends requests
- Chat endpoint → Chat response service: creates responses (evidence: `src/app/api/ai-chat/route.ts`)
- Chat endpoint → Assistant rate limiting: checks limits (evidence: `src/app/api/ai-chat/route.ts`)
- Chat response service → OpenAI: requests completion
- Happy agent endpoint → Agent context builder: builds context (evidence: `src/app/api/happy/agent/route.ts`)
- Happy agent endpoint → OpenAI: requests completion
- Gift suggestions endpoint → Gift data access: loads gift data (evidence: `src/app/api/ai/gift-suggestions/route.ts`)
- Gift suggestions endpoint → Gift intelligence: validates suggestions (evidence: `src/app/api/ai/gift-suggestions/route.ts`)
- Gift suggestions endpoint → OpenAI: generates ideas
- Authentication → Supabase client: uses
- Supabase client → Supabase public config: loads config (evidence: `src/lib/supabaseClient.ts`)
- Supabase client → Supabase services: connects (evidence: `README.md`)
- People profiles → Supabase services: stores profile data
- Events calendar → Supabase services: stores events
- Notes → Supabase services: stores notes
