# azharweb90/talween architecture

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

- Interactive diagram: https://gitdiagram.com/azharweb90/talween
- Repository: https://github.com/azharweb90/talween

## Overview

This is a Talween Advertising portfolio site with project and contact APIs, MongoDB persistence, and a branded theme system. The principal backend workflows are project listing/detail and administration, plus contact submission; the homepage is an additional user-facing entry point. The source excerpts show API and theme internals, but not page rendering or the full project model. The source index supports the page-to-provider and sidebar dependency edges; other unsampled page behavior is not inferred.

Main entry points: [`components/ui/sidebar/sidebar.tsx`](https://github.com/azharweb90/talween/blob/main/components/ui/sidebar/sidebar.tsx) (Sidebar), [`app/api/contact/route.ts`](https://github.com/azharweb90/talween/blob/main/app/api/contact/route.ts) (Contact API), [`app/api/projects/route.ts`](https://github.com/azharweb90/talween/blob/main/app/api/projects/route.ts) (Project collection API), [`app/api/projects/[id]/route.ts`](https://github.com/azharweb90/talween/blob/main/app/api/projects/%5Bid%5D/route.ts) (Project detail API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_site["Site experience"]
  node_homepage["Homepage<br/>[page.tsx]"]
  node_app_shell["App shell<br/>[layout.tsx]"]
end

subgraph group_api["Portfolio APIs"]
  node_contact_api["Contact API<br/>[route.ts]"]
  node_projects_api["Project collection API<br/>[route.ts]"]
  node_project_detail_api["Project detail API<br/>[route.ts]"]
end

subgraph group_data["Persistence"]
  node_db_connection["DB connection<br/>[db.ts]"]
  node_project_model["Project model<br/>[Project.ts]"]
  node_contact_store[("Contact records")]
  node_project_store[("Project records")]
end

subgraph group_theme["Brand and theme"]
  node_theme_switcher["Theme switcher<br/>[theme-switcher.tsx]"]
  node_theme_state["Theme state<br/>[use-theme.ts]"]
  node_theme_config["Theme config<br/>[theme.ts]"]
  node_brand_config["Brand config<br/>[brand.ts]"]
  node_theme_script["Theme script<br/>[theme-script.tsx]"]
  node_dts_provider["DTS provider<br/>[dts-provider.tsx]"]
end

subgraph group_ui["UI components"]
  node_button["Button<br/>[button.tsx]"]
  node_dropdown["Dropdown menu<br/>[dropdown-menu.tsx]"]
  node_sidebar["Sidebar<br/>[sidebar.tsx]"]
  node_sheet["Sheet<br/>[sheet.tsx]"]
  node_tooltip["Tooltip<br/>[tooltip.tsx]"]
  node_mobile_hook["Mobile detection<br/>[use-mobile.ts]"]
end

node_visitor(("Visitor"))
node_admin(("Administrator"))

node_visitor -->|"opens"| node_homepage
node_visitor -->|"submits contact"| node_contact_api
node_admin -->|"lists contacts"| node_contact_api
node_visitor -->|"requests featured"| node_projects_api
node_admin -->|"creates project"| node_projects_api
node_visitor -->|"requests project"| node_project_detail_api
node_admin -->|"manages project"| node_project_detail_api
node_contact_api -->|"connects"| node_db_connection
node_projects_api -->|"connects"| node_db_connection
node_project_detail_api -->|"connects"| node_db_connection
node_contact_api -->|"reads and writes"| node_contact_store
node_projects_api -->|"reads and writes"| node_project_store
node_project_detail_api -->|"queries and updates"| node_project_model
node_project_model -.->|"models records"| node_project_store
node_app_shell -->|"loads provider"| node_dts_provider
node_homepage -.->|"uses provider"| node_dts_provider
node_theme_switcher -->|"reads and sets"| node_theme_state
node_theme_switcher -->|"renders"| node_button
node_theme_switcher -->|"renders"| node_dropdown
node_theme_state -->|"reads themes"| node_brand_config
node_theme_state -->|"reads storage key"| node_theme_config
node_theme_config -->|"reads defaults"| node_brand_config
node_theme_script -->|"uses script"| node_theme_config
node_sidebar -->|"checks viewport"| node_mobile_hook
node_sidebar -->|"renders mobile panel"| node_sheet
node_sidebar -->|"renders tooltips"| node_tooltip
node_sidebar -.->|"uses toggle button"| node_button

click node_homepage "https://github.com/azharweb90/talween/blob/main/app/page.tsx"
click node_app_shell "https://github.com/azharweb90/talween/blob/main/app/layout.tsx"
click node_contact_api "https://github.com/azharweb90/talween/blob/main/app/api/contact/route.ts"
click node_projects_api "https://github.com/azharweb90/talween/blob/main/app/api/projects/route.ts"
click node_project_detail_api "https://github.com/azharweb90/talween/blob/main/app/api/projects/%5Bid%5D/route.ts"
click node_db_connection "https://github.com/azharweb90/talween/blob/main/lib/db.ts"
click node_project_model "https://github.com/azharweb90/talween/blob/main/lib/models/Project.ts"
click node_theme_switcher "https://github.com/azharweb90/talween/blob/main/components/dts/theme-switcher.tsx"
click node_theme_state "https://github.com/azharweb90/talween/blob/main/components/dts/use-theme.ts"
click node_theme_config "https://github.com/azharweb90/talween/blob/main/components/dts/theme.ts"
click node_brand_config "https://github.com/azharweb90/talween/blob/main/styles/brand.ts"
click node_theme_script "https://github.com/azharweb90/talween/blob/main/components/dts/theme-script.tsx"
click node_dts_provider "https://github.com/azharweb90/talween/blob/main/components/dts/dts-provider.tsx"
click node_button "https://github.com/azharweb90/talween/blob/main/components/ui/button/button.tsx"
click node_dropdown "https://github.com/azharweb90/talween/blob/main/components/ui/dropdown-menu/dropdown-menu.tsx"
click node_sidebar "https://github.com/azharweb90/talween/blob/main/components/ui/sidebar/sidebar.tsx"
click node_sheet "https://github.com/azharweb90/talween/blob/main/components/ui/sheet/sheet.tsx"
click node_tooltip "https://github.com/azharweb90/talween/blob/main/components/ui/tooltip/tooltip.tsx"
click node_mobile_hook "https://github.com/azharweb90/talween/blob/main/hooks/use-mobile.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_homepage,node_app_shell toneBlue
class node_contact_api,node_projects_api,node_project_detail_api toneAmber
class node_db_connection,node_project_model,node_contact_store,node_project_store toneMint
class node_theme_switcher,node_theme_state,node_theme_config,node_brand_config,node_theme_script,node_dts_provider toneRose
class node_button,node_dropdown,node_sidebar,node_sheet,node_tooltip,node_mobile_hook,node_visitor,node_admin toneIndigo
```

## Components

### Site experience

- [Homepage](https://github.com/azharweb90/talween/blob/main/app/page.tsx): `app/page.tsx`
- [App shell](https://github.com/azharweb90/talween/blob/main/app/layout.tsx): `app/layout.tsx`

### Portfolio APIs

- [Contact API](https://github.com/azharweb90/talween/blob/main/app/api/contact/route.ts): `app/api/contact/route.ts`
- [Project collection API](https://github.com/azharweb90/talween/blob/main/app/api/projects/route.ts): `app/api/projects/route.ts`
- [Project detail API](https://github.com/azharweb90/talween/blob/main/app/api/projects/%5Bid%5D/route.ts): `app/api/projects/[id]/route.ts`

### Persistence

- [DB connection](https://github.com/azharweb90/talween/blob/main/lib/db.ts): `lib/db.ts`
- [Project model](https://github.com/azharweb90/talween/blob/main/lib/models/Project.ts): `lib/models/Project.ts`
- **Contact records**
- **Project records**

### Brand and theme

- [Theme switcher](https://github.com/azharweb90/talween/blob/main/components/dts/theme-switcher.tsx): `components/dts/theme-switcher.tsx`
- [Theme state](https://github.com/azharweb90/talween/blob/main/components/dts/use-theme.ts): `components/dts/use-theme.ts`
- [Theme config](https://github.com/azharweb90/talween/blob/main/components/dts/theme.ts): `components/dts/theme.ts`
- [Brand config](https://github.com/azharweb90/talween/blob/main/styles/brand.ts): `styles/brand.ts`
- [Theme script](https://github.com/azharweb90/talween/blob/main/components/dts/theme-script.tsx): `components/dts/theme-script.tsx`
- [DTS provider](https://github.com/azharweb90/talween/blob/main/components/dts/dts-provider.tsx): `components/dts/dts-provider.tsx`

### UI components

- [Button](https://github.com/azharweb90/talween/blob/main/components/ui/button/button.tsx): `components/ui/button/button.tsx`
- [Dropdown menu](https://github.com/azharweb90/talween/blob/main/components/ui/dropdown-menu/dropdown-menu.tsx): `components/ui/dropdown-menu/dropdown-menu.tsx`
- [Sidebar](https://github.com/azharweb90/talween/blob/main/components/ui/sidebar/sidebar.tsx): `components/ui/sidebar/sidebar.tsx`
- [Sheet](https://github.com/azharweb90/talween/blob/main/components/ui/sheet/sheet.tsx): `components/ui/sheet/sheet.tsx`
- [Tooltip](https://github.com/azharweb90/talween/blob/main/components/ui/tooltip/tooltip.tsx): `components/ui/tooltip/tooltip.tsx`
- [Mobile detection](https://github.com/azharweb90/talween/blob/main/hooks/use-mobile.ts): `hooks/use-mobile.ts`

### Other components

- **Visitor**
- **Administrator**

## Connections

- Visitor → Homepage: opens
- Visitor → Contact API: submits contact (evidence: `app/api/contact/route.ts`)
- Administrator → Contact API: lists contacts (evidence: `app/api/contact/route.ts`)
- Visitor → Project collection API: requests featured (evidence: `app/api/projects/route.ts`)
- Administrator → Project collection API: creates project (evidence: `app/api/projects/route.ts`)
- Visitor → Project detail API: requests project (evidence: `app/api/projects/[id]/route.ts`)
- Administrator → Project detail API: manages project (evidence: `app/api/projects/[id]/route.ts`)
- Contact API → DB connection: connects (evidence: `app/api/contact/route.ts`)
- Project collection API → DB connection: connects (evidence: `app/api/projects/route.ts`)
- Project detail API → DB connection: connects (evidence: `app/api/projects/[id]/route.ts`)
- Contact API → Contact records: reads and writes (evidence: `app/api/contact/route.ts`)
- Project collection API → Project records: reads and writes (evidence: `app/api/projects/route.ts`)
- Project detail API → Project model: queries and updates (evidence: `app/api/projects/[id]/route.ts`)
- Project model → Project records: models records
- App shell → DTS provider: loads provider (evidence: `app/layout.tsx`)
- Homepage → DTS provider: uses provider
- Theme switcher → Theme state: reads and sets (evidence: `components/dts/theme-switcher.tsx`)
- Theme switcher → Button: renders (evidence: `components/dts/theme-switcher.tsx`)
- Theme switcher → Dropdown menu: renders (evidence: `components/dts/theme-switcher.tsx`)
- Theme state → Brand config: reads themes (evidence: `components/dts/use-theme.ts`)
- Theme state → Theme config: reads storage key (evidence: `components/dts/use-theme.ts`)
- Theme config → Brand config: reads defaults (evidence: `components/dts/theme.ts`)
- Theme script → Theme config: uses script (evidence: `components/dts/theme-script.tsx`)
- Sidebar → Mobile detection: checks viewport (evidence: `components/ui/sidebar/sidebar.tsx`)
- Sidebar → Sheet: renders mobile panel (evidence: `components/ui/sidebar/sidebar.tsx`)
- Sidebar → Tooltip: renders tooltips (evidence: `components/ui/sidebar/sidebar.tsx`)
- Sidebar → Button: uses toggle button (evidence: `components/ui/sidebar/sidebar.tsx`)
