# shubhodeepdutta21/basics_of_builds architecture

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

- Interactive diagram: https://gitdiagram.com/shubhodeepdutta21/basics_of_builds
- Repository: https://github.com/shubhodeepdutta21/basics_of_builds

## Overview

BOB helps electronics hobbyists use their existing parts to find or invent buildable projects, then get project-aware assistance. Users sign in, manage an inventory, compare it with the project catalog, and can request an AI-generated project or chat about a project. Additional branches provide profiles and a community prototype. The excerpts show the inventory’s Supabase persistence and AI request/auth flow; community and several page-to-data relationships are supported by the SOURCE INDEX. The community is documented as in progress.

Main entry points: [`src/lib/supabaseClient.ts`](https://github.com/shubhodeepdutta21/basics_of_builds/blob/main/src/lib/supabaseClient.ts) (Supabase client), [`src/app/discovery/page.tsx`](https://github.com/shubhodeepdutta21/basics_of_builds/blob/main/src/app/discovery/page.tsx) (Project discovery), [`src/app/api/generate/route.ts`](https://github.com/shubhodeepdutta21/basics_of_builds/blob/main/src/app/api/generate/route.ts) (Project generation API), [`src/lib/authFetch.ts`](https://github.com/shubhodeepdutta21/basics_of_builds/blob/main/src/lib/authFetch.ts) (Authenticated fetch)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_catalog["Catalog and discovery"]
  node_catalog_page["Project discovery<br/>[page.tsx]"]
  node_catalog_state["Catalog state<br/>[CatalogContext.tsx]"]
  node_catalog_data["Catalog queries<br/>[catalog.ts]"]
  node_project_detail["Project details<br/>[page.tsx]"]
  node_matching["Readiness scoring<br/>[matching.ts]"]
end

subgraph group_inventory["Inventory"]
  node_inventory_page["Parts inventory<br/>[page.tsx]"]
  node_inventory_state["Inventory state"]
  node_inventory_store[("Supabase inventory")]
end

subgraph group_ai["AI assistance"]
  node_generate_api["Project generation API<br/>[route.ts]"]
  node_chatbot_ui["Project assistant<br/>[chatbot.tsx]"]
  node_chatbot_api["Assistant API<br/>[route.ts]"]
  node_groq{{"Groq AI"}}
end

subgraph group_identity["Identity and community"]
  node_login["Sign-in<br/>[page.tsx]"]
  node_account["Account profile<br/>[page.tsx]"]
  node_profile_data["Profile queries<br/>[profile.ts]"]
  node_community["Community feed<br/>[page.tsx]"]
  node_community_post["Post detail<br/>[page.tsx]"]
  node_posts_data["Posts and reactions<br/>[posts.ts]"]
  node_comments_ui["Post comments"]
  node_comments_data["Comment queries<br/>[comments.ts]"]
  node_community_store[("Supabase community data")]
end

subgraph group_shared["Shared services"]
  node_auth_fetch["Authenticated fetch<br/>[authFetch.ts]"]
  node_server_auth["Server token checks<br/>[serverAuth.ts]"]
  node_rate_limit["Rate limiting<br/>[rateLimit.ts]"]
  node_supabase_client["Supabase client<br/>[supabaseClient.ts]"]
  node_supabase_auth{{"Supabase Auth"}}
  node_redis{{"Upstash Redis"}}
end

node_user(("Hobbyist"))

node_user -->|"manages parts"| node_inventory_page
node_inventory_page -->|"updates inventory"| node_inventory_state
node_inventory_state -->|"reads and writes"| node_inventory_store
node_user -->|"discovers projects"| node_catalog_page
node_catalog_page -->|"uses catalog"| node_catalog_state
node_catalog_state -->|"loads catalog"| node_catalog_data
node_catalog_data -->|"queries through"| node_supabase_client
node_catalog_page -->|"reads owned parts"| node_inventory_state
node_catalog_page -->|"scores projects"| node_matching
node_project_detail -->|"computes readiness"| node_matching
node_user -->|"requests invention"| node_generate_api
node_catalog_page -->|"sends inventory"| node_auth_fetch
node_auth_fetch -->|"posts request"| node_generate_api
node_auth_fetch -->|"gets session token"| node_supabase_client
node_generate_api -->|"checks user"| node_server_auth
node_generate_api -->|"limits requests"| node_rate_limit
node_generate_api -->|"requests project JSON"| node_groq
node_user -->|"asks project questions"| node_chatbot_ui
node_project_detail -->|"shows assistant"| node_chatbot_ui
node_chatbot_ui -->|"sends question"| node_auth_fetch
node_auth_fetch -->|"posts question"| node_chatbot_api
node_chatbot_api -->|"checks user"| node_server_auth
node_chatbot_api -->|"limits requests"| node_rate_limit
node_chatbot_api -->|"requests AI reply"| node_groq
node_rate_limit -.->|"uses when configured"| node_redis
node_user -->|"signs in"| node_login
node_login -->|"uses auth client"| node_supabase_client
node_supabase_client -->|"authenticates"| node_supabase_auth
node_account -->|"loads and saves"| node_profile_data
node_profile_data -->|"queries profiles"| node_supabase_client
node_user -->|"browses community"| node_community
node_community -->|"loads posts"| node_posts_data
node_community_post -->|"loads post"| node_posts_data
node_community_post -->|"renders comments"| node_comments_ui
node_comments_ui -->|"loads comments"| node_comments_data
node_posts_data -->|"queries posts"| node_supabase_client
node_comments_data -->|"queries comments"| node_supabase_client
node_supabase_client -->|"accesses community data"| node_community_store

click node_inventory_page "https://github.com/shubhodeepdutta21/basics_of_builds/blob/main/src/app/inventory/page.tsx"
click node_inventory_state "https://github.com/shubhodeepdutta21/basics_of_builds/blob/main/src/lib/InventoryContext.tsx"
click node_catalog_page "https://github.com/shubhodeepdutta21/basics_of_builds/blob/main/src/app/discovery/page.tsx"
click node_catalog_state "https://github.com/shubhodeepdutta21/basics_of_builds/blob/main/src/lib/CatalogContext.tsx"
click node_catalog_data "https://github.com/shubhodeepdutta21/basics_of_builds/blob/main/src/lib/catalog.ts"
click node_project_detail "https://github.com/shubhodeepdutta21/basics_of_builds/blob/main/src/app/projects/%5Bid%5D/page.tsx"
click node_matching "https://github.com/shubhodeepdutta21/basics_of_builds/blob/main/src/lib/matching.ts"
click node_generate_api "https://github.com/shubhodeepdutta21/basics_of_builds/blob/main/src/app/api/generate/route.ts"
click node_chatbot_ui "https://github.com/shubhodeepdutta21/basics_of_builds/blob/main/src/app/components/chatbot.tsx"
click node_chatbot_api "https://github.com/shubhodeepdutta21/basics_of_builds/blob/main/src/app/api/chatbot/route.ts"
click node_auth_fetch "https://github.com/shubhodeepdutta21/basics_of_builds/blob/main/src/lib/authFetch.ts"
click node_server_auth "https://github.com/shubhodeepdutta21/basics_of_builds/blob/main/src/lib/serverAuth.ts"
click node_rate_limit "https://github.com/shubhodeepdutta21/basics_of_builds/blob/main/src/lib/rateLimit.ts"
click node_supabase_client "https://github.com/shubhodeepdutta21/basics_of_builds/blob/main/src/lib/supabaseClient.ts"
click node_login "https://github.com/shubhodeepdutta21/basics_of_builds/blob/main/src/app/login/page.tsx"
click node_account "https://github.com/shubhodeepdutta21/basics_of_builds/blob/main/src/app/account/page.tsx"
click node_profile_data "https://github.com/shubhodeepdutta21/basics_of_builds/blob/main/src/lib/profile.ts"
click node_community "https://github.com/shubhodeepdutta21/basics_of_builds/blob/main/src/app/community/page.tsx"
click node_community_post "https://github.com/shubhodeepdutta21/basics_of_builds/blob/main/src/app/community/post/%5Bid%5D/page.tsx"
click node_posts_data "https://github.com/shubhodeepdutta21/basics_of_builds/blob/main/src/lib/posts.ts"
click node_comments_ui "https://github.com/shubhodeepdutta21/basics_of_builds/blob/main/src/app/components/CommentsSection.tsx"
click node_comments_data "https://github.com/shubhodeepdutta21/basics_of_builds/blob/main/src/lib/comments.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_catalog_page,node_catalog_state,node_catalog_data,node_project_detail,node_matching toneBlue
class node_inventory_page,node_inventory_state,node_inventory_store toneAmber
class node_generate_api,node_chatbot_ui,node_chatbot_api,node_groq toneMint
class node_login,node_account,node_profile_data,node_community,node_community_post,node_posts_data,node_comments_ui,node_comments_data,node_community_store toneRose
class node_auth_fetch,node_server_auth,node_rate_limit,node_supabase_client,node_supabase_auth,node_redis,node_user toneIndigo
```

## Components

### Catalog and discovery

- [Project discovery](https://github.com/shubhodeepdutta21/basics_of_builds/blob/main/src/app/discovery/page.tsx): `src/app/discovery/page.tsx`
- [Catalog state](https://github.com/shubhodeepdutta21/basics_of_builds/blob/main/src/lib/CatalogContext.tsx): `src/lib/CatalogContext.tsx`
- [Catalog queries](https://github.com/shubhodeepdutta21/basics_of_builds/blob/main/src/lib/catalog.ts): `src/lib/catalog.ts`
- [Project details](https://github.com/shubhodeepdutta21/basics_of_builds/blob/main/src/app/projects/%5Bid%5D/page.tsx): `src/app/projects/[id]/page.tsx`
- [Readiness scoring](https://github.com/shubhodeepdutta21/basics_of_builds/blob/main/src/lib/matching.ts): `src/lib/matching.ts`

### Inventory

- [Parts inventory](https://github.com/shubhodeepdutta21/basics_of_builds/blob/main/src/app/inventory/page.tsx): `src/app/inventory/page.tsx`
- [Inventory state](https://github.com/shubhodeepdutta21/basics_of_builds/blob/main/src/lib/InventoryContext.tsx): `src/lib/InventoryContext.tsx`
- **Supabase inventory**

### AI assistance

- [Project generation API](https://github.com/shubhodeepdutta21/basics_of_builds/blob/main/src/app/api/generate/route.ts): `src/app/api/generate/route.ts`
- [Project assistant](https://github.com/shubhodeepdutta21/basics_of_builds/blob/main/src/app/components/chatbot.tsx): `src/app/components/chatbot.tsx`
- [Assistant API](https://github.com/shubhodeepdutta21/basics_of_builds/blob/main/src/app/api/chatbot/route.ts): `src/app/api/chatbot/route.ts`
- **Groq AI**

### Identity and community

- [Sign-in](https://github.com/shubhodeepdutta21/basics_of_builds/blob/main/src/app/login/page.tsx): `src/app/login/page.tsx`
- [Account profile](https://github.com/shubhodeepdutta21/basics_of_builds/blob/main/src/app/account/page.tsx): `src/app/account/page.tsx`
- [Profile queries](https://github.com/shubhodeepdutta21/basics_of_builds/blob/main/src/lib/profile.ts): `src/lib/profile.ts`
- [Community feed](https://github.com/shubhodeepdutta21/basics_of_builds/blob/main/src/app/community/page.tsx): `src/app/community/page.tsx`
- [Post detail](https://github.com/shubhodeepdutta21/basics_of_builds/blob/main/src/app/community/post/%5Bid%5D/page.tsx): `src/app/community/post/[id]/page.tsx`
- [Posts and reactions](https://github.com/shubhodeepdutta21/basics_of_builds/blob/main/src/lib/posts.ts): `src/lib/posts.ts`
- [Post comments](https://github.com/shubhodeepdutta21/basics_of_builds/blob/main/src/app/components/CommentsSection.tsx): `src/app/components/CommentsSection.tsx`
- [Comment queries](https://github.com/shubhodeepdutta21/basics_of_builds/blob/main/src/lib/comments.ts): `src/lib/comments.ts`
- **Supabase community data**

### Shared services

- [Authenticated fetch](https://github.com/shubhodeepdutta21/basics_of_builds/blob/main/src/lib/authFetch.ts): `src/lib/authFetch.ts`
- [Server token checks](https://github.com/shubhodeepdutta21/basics_of_builds/blob/main/src/lib/serverAuth.ts): `src/lib/serverAuth.ts`
- [Rate limiting](https://github.com/shubhodeepdutta21/basics_of_builds/blob/main/src/lib/rateLimit.ts): `src/lib/rateLimit.ts`
- [Supabase client](https://github.com/shubhodeepdutta21/basics_of_builds/blob/main/src/lib/supabaseClient.ts): `src/lib/supabaseClient.ts`
- **Supabase Auth**
- **Upstash Redis**

### Other components

- **Hobbyist**

## Connections

- Hobbyist → Parts inventory: manages parts (evidence: `README.md`)
- Parts inventory → Inventory state: updates inventory (evidence: `src/app/inventory/page.tsx`)
- Inventory state → Supabase inventory: reads and writes (evidence: `src/lib/InventoryContext.tsx`)
- Hobbyist → Project discovery: discovers projects (evidence: `README.md`)
- Project discovery → Catalog state: uses catalog (evidence: `src/app/discovery/page.tsx`)
- Catalog state → Catalog queries: loads catalog (evidence: `src/lib/CatalogContext.tsx`)
- Catalog queries → Supabase client: queries through (evidence: `src/lib/catalog.ts`)
- Project discovery → Inventory state: reads owned parts (evidence: `src/app/discovery/page.tsx`)
- Project discovery → Readiness scoring: scores projects (evidence: `src/app/discovery/page.tsx`)
- Project details → Readiness scoring: computes readiness (evidence: `src/app/projects/[id]/page.tsx`)
- Hobbyist → Project generation API: requests invention (evidence: `README.md`)
- Project discovery → Authenticated fetch: sends inventory (evidence: `src/app/discovery/page.tsx`)
- Authenticated fetch → Project generation API: posts request
- Authenticated fetch → Supabase client: gets session token (evidence: `src/lib/authFetch.ts`)
- Project generation API → Server token checks: checks user (evidence: `src/app/api/generate/route.ts`)
- Project generation API → Rate limiting: limits requests (evidence: `src/app/api/generate/route.ts`)
- Project generation API → Groq AI: requests project JSON (evidence: `src/app/api/generate/route.ts`)
- Hobbyist → Project assistant: asks project questions (evidence: `README.md`)
- Project details → Project assistant: shows assistant (evidence: `src/app/projects/[id]/page.tsx`)
- Project assistant → Authenticated fetch: sends question (evidence: `src/app/components/chatbot.tsx`)
- Authenticated fetch → Assistant API: posts question
- Assistant API → Server token checks: checks user (evidence: `src/app/api/chatbot/route.ts`)
- Assistant API → Rate limiting: limits requests (evidence: `src/app/api/chatbot/route.ts`)
- Assistant API → Groq AI: requests AI reply (evidence: `README.md`)
- Rate limiting → Upstash Redis: uses when configured (evidence: `README.md`)
- Hobbyist → Sign-in: signs in (evidence: `README.md`)
- Sign-in → Supabase client: uses auth client (evidence: `src/app/login/page.tsx`)
- Supabase client → Supabase Auth: authenticates (evidence: `src/lib/supabaseClient.ts`)
- Account profile → Profile queries: loads and saves (evidence: `src/app/account/page.tsx`)
- Profile queries → Supabase client: queries profiles (evidence: `src/lib/profile.ts`)
- Hobbyist → Community feed: browses community (evidence: `README.md`)
- Community feed → Posts and reactions: loads posts (evidence: `src/app/community/page.tsx`)
- Post detail → Posts and reactions: loads post (evidence: `src/app/community/post/[id]/page.tsx`)
- Post detail → Post comments: renders comments (evidence: `src/app/community/post/[id]/page.tsx`)
- Post comments → Comment queries: loads comments (evidence: `src/app/components/CommentsSection.tsx`)
- Posts and reactions → Supabase client: queries posts (evidence: `src/lib/posts.ts`)
- Comment queries → Supabase client: queries comments (evidence: `src/lib/comments.ts`)
- Supabase client → Supabase community data: accesses community data
