# bethanyrobertson/portfolio-navigator architecture

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

- Interactive diagram: https://gitdiagram.com/bethanyrobertson/portfolio-navigator
- Repository: https://github.com/bethanyrobertson/portfolio-navigator

## Overview

##### Project Type and Purpose
- AI Portfolio Chatbot is a full-stack, server-rendered Next.js application with a conversational interface.
- Purpose: let visitors explore a developer/designer’s portfolio via an OpenAI-powered chat instead of traditional navigation.

##### File Structure
- Top level
- app/ – Next.js App Router folder (React server/client components, API routes)
- src/ – Mirror of app/, plus components/, data/, hooks/, lib/, types/
- public/assets/ – Static files (resume, avatars, SVGs)
- scripts/ – Automation: quick‐setup.js, validate‐content.js
- .env, next.config.js, tailwind.config.ts, package.json, tsconfig.json
- API back end
- app/api/chat/route.ts – chat endpoint wrapping OpenAI API
- app/api/health/route.ts – health check
- Front end
- app/layout.tsx, page.tsx – root layout & home page
- src/components/chat – ChatInterface, HomePageChat, thumbnail casestudy
- src/components/ui – generic Button, Input, ScrollArea
- src/sections, src/styles/chat.css – additional styling and UI demos
- Data/config
- src/data/assistant-config.ts – controls AI persona, progressive‐disclosure content hierarchy
- src/data/portfolio-knowledge.ts – portfolio content (experience, projects, skills)
- Hooks & Utilities
- src/hooks/useChat.ts & useSecureChat.ts – manage chat state & API calls
- src/lib/utils.ts – helper functions
- No database layer – all content is file‐based; external dependency is OpenAI API

##### README Insights
- 4-level Progressive Disclosure system drives conversation depth
- Deployment recommended on Vercel
- Customizable via single config file (assistant-config.ts) and portfolio-knowledge.ts
- Tech stack: Next.js 15, React 19, TypeScript, Tailwind CSS, Radix UI, Framer Motion, OpenAI GPT-4

##### Essential Architectural Elements
- Don’t over-compartmentalize; focus on meaningful boundaries:
- Client UI
- Next.js Server (API + SSR/SSG)
- Configuration files
- Static assets
- External AI service
- Detail the chat flow from user input to AI response and back

## Diagram (Mermaid)

```mermaid
flowchart TD
    User["User's Browser"]:::frontend

    subgraph "Frontend Layer"
        Layout["Root Layout"]:::frontend
        Page["Home Page"]:::frontend
        ChatIF["ChatInterface UI"]:::frontend
        HPC["HomePageChat Preview"]:::frontend
        Thumb["Case Study Thumbnail"]:::frontend
        Btn["Button UI"]:::frontend
        Input["Input UI"]:::frontend
        Scroll["ScrollArea UI"]:::frontend
    end

    subgraph "Next.js Application"
        subgraph "Server-Side (Serverless Functions)"
            APIChat["/api/chat"]:::backend
            APIHealth["/api/health"]:::backend
        end
        subgraph "Logic & Data"
            Config["assistant-config.ts"]:::config
            Knowledge["portfolio-knowledge.ts"]:::config
            UseChat["useChat Hook"]:::backend
            UseSecure["useSecureChat Hook"]:::backend
            Utils["Utils Library"]:::backend
        end
        subgraph "Styles"
            ChatCSS["chat.css"]:::script
            GlobalCSS["globals.css"]:::script
        end
    end

    Static["Static Assets"]:::storage

    subgraph "Automation Scripts"
        Quick["quick-setup.js"]:::script
        Val["validate-content.js"]:::script
    end

    subgraph "External Services"
        OpenAI["OpenAI GPT-4 API"]:::external
        Vercel["Vercel Platform"]:::external
    end

    User --> Page
    Page --> ChatIF
    Page --> HPC
    HPC --> Thumb
    ChatIF --> Btn
    ChatIF --> Input
    ChatIF --> Scroll
    ChatIF --> UseChat
    UseChat --> APIChat
    UseChat --> UseSecure
    APIChat --> Config
    APIChat --> Knowledge
    APIChat --> Utils
    APIChat --> OpenAI
    OpenAI --> APIChat
    APIChat --> UseChat
    User --> Static
    Vercel --> APIChat
    Vercel --> APIHealth
    Vercel --> Page
    Vercel --> Static

    click Layout "https://github.com/bethanyrobertson/portfolio-navigator/blob/main/app/layout.tsx"
    click Page "https://github.com/bethanyrobertson/portfolio-navigator/blob/main/app/page.tsx"
    click APIChat "https://github.com/bethanyrobertson/portfolio-navigator/blob/main/app/api/chat/route.ts"
    click APIHealth "https://github.com/bethanyrobertson/portfolio-navigator/blob/main/app/api/health/route.ts"
    click ChatIF "https://github.com/bethanyrobertson/portfolio-navigator/blob/main/src/components/chat/ChatInterface.tsx"
    click HPC "https://github.com/bethanyrobertson/portfolio-navigator/blob/main/src/components/chat/HomePageChat.tsx"
    click Thumb "https://github.com/bethanyrobertson/portfolio-navigator/blob/main/src/components/chat/thumbnailcasestudy.tsx"
    click Btn "https://github.com/bethanyrobertson/portfolio-navigator/blob/main/src/components/ui/button.tsx"
    click Input "https://github.com/bethanyrobertson/portfolio-navigator/blob/main/src/components/ui/input.tsx"
    click Scroll "https://github.com/bethanyrobertson/portfolio-navigator/blob/main/src/components/ui/scroll-area.tsx"
    click Config "https://github.com/bethanyrobertson/portfolio-navigator/blob/main/src/data/assistant-config.ts"
    click Knowledge "https://github.com/bethanyrobertson/portfolio-navigator/blob/main/src/data/portfolio-knowledge.ts"
    click UseChat "https://github.com/bethanyrobertson/portfolio-navigator/blob/main/src/hooks/useChat.ts"
    click UseSecure "https://github.com/bethanyrobertson/portfolio-navigator/blob/main/src/hooks/useSecureChat.ts"
    click Utils "https://github.com/bethanyrobertson/portfolio-navigator/blob/main/src/lib/utils.ts"
    click ChatCSS "https://github.com/bethanyrobertson/portfolio-navigator/blob/main/src/styles/chat.css"
    click GlobalCSS "https://github.com/bethanyrobertson/portfolio-navigator/blob/main/app/globals.css"
    click Static "https://github.com/bethanyrobertson/portfolio-navigator/tree/main/public/assets/"
    click Quick "https://github.com/bethanyrobertson/portfolio-navigator/blob/main/scripts/quick-setup.js"
    click Val "https://github.com/bethanyrobertson/portfolio-navigator/blob/main/scripts/validate-content.js"

    classDef frontend fill:#ccffcc,stroke:#333,stroke-width:1px
    classDef backend fill:#cce5ff,stroke:#333,stroke-width:1px
    classDef external fill:#ffd699,stroke:#333,stroke-width:1px
    classDef storage fill:#eeeeee,stroke:#333,stroke-width:1px
    classDef config fill:#e5ccff,stroke:#333,stroke-width:1px
    classDef script fill:#f0e68c,stroke:#333,stroke-width:1px
```
