# rajin-khan/portfolio architecture

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

- Interactive diagram: https://gitdiagram.com/rajin-khan/portfolio
- Repository: https://github.com/rajin-khan/portfolio

## Overview

#### Purpose and runtime
This is Rajin Khan’s Astro 5 portfolio: static-first project/blog/profile pages plus interactive islands and serverless features. Astro routes and content collections provide the primary site surface; React powers stateful islands. Deployment targets Vercel, which hosts API routes and scheduled work. Core setup: `astro.config.mjs`, `vercel.json`, `src/layouts/main.astro`.

#### Site composition and routing
Page routes assemble shared layouts and reusable Astro components for home, portfolio, posts, about, uses, GitHub activity, and curated content. Dynamic detail routes resolve content by slug. Key paths: `src/pages/index.astro`, `src/pages/post/[slug].astro`, `src/pages/projects/[slug].astro`.

#### Content-driven publishing
Blog posts are Markdown and projects are JSON, validated/registered through Astro content configuration. Shared libraries derive project views, reading time, table of contents, and related content; static public assets supply media. Key paths: `src/content/config.ts`, `src/content/post/`, `src/content/project/`.

#### Interactive experience islands
Selective client-side components implement the sticker guestbook, curated carousel, and A.R.I.A. assistant rather than making the site a client-rendered app. Site-wide frontend behavior and GitHub dashboard interactions live separately. Key paths: `src/components/sticker-board.jsx`, `src/components/aria/AriaApp.tsx`, `src/assets/js/github-dashboard.js`.

#### A.R.I.A. assistant pipeline
A.R.I.A. has a React launcher/application client and a dedicated chat endpoint. The server pipeline controls protocol, environment/configuration, source policy, corpus retrieval, freshness, prompt construction, provider calls, actions, and security/link safety. This isolates model-facing logic from presentation and constrains responses to approved site knowledge. Key paths: `src/pages/api/aria/chat.ts`, `src/lib/aria/retrieve.ts`, `src/lib/aria/provider.ts`.

#### Stateful integrations and automation
Server endpoints bridge the site to external services: Upstash Redis persists stickers and newsletter subscriptions; Resend delivers newsletters; GitHub activity is fetched through an API route. A Vercel cron endpoint updates the daily heartbeat sticker. Key paths: `src/pages/api/stickers.ts`, `src/pages/api/subscribe.ts`, `src/pages/api/send-newsletter.ts`, `src/pages/api/cron/heartbeat-sticker.ts`.

#### Presentation assets and external surfaces
The `public` tree is directly served for portfolio media, PDFs, video, newsletter artifacts, and the separate RAJINTALKSALOT content bundle. Client rendering uses Three.js for the About globe and React where interactivity warrants hydration. Key paths: `public/assets/`, `src/components/about-experience.astro`, `src/components/rajintalksalot.astro`.

Main entry points: [`src/pages/index.astro`](https://github.com/rajin-khan/portfolio/blob/main/src/pages/index.astro) (Site pages), [`src/components/sticker-board.jsx`](https://github.com/rajin-khan/portfolio/blob/main/src/components/sticker-board.jsx) (Interactive islands), [`src/content/config.ts`](https://github.com/rajin-khan/portfolio/blob/main/src/content/config.ts) (Content collections), [`src/pages/api/aria/chat.ts`](https://github.com/rajin-khan/portfolio/blob/main/src/pages/api/aria/chat.ts) (A.R.I.A. chat API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_site["Static site"]
  node_astro{{"Astro site runtime<br/>Astro 5<br/>[astro.config.mjs]"}}
  node_layout["Main layout<br/>Astro layout<br/>[main.astro]"]
  node_routes["Site pages<br/>Astro routes<br/>[index.astro]"]
  node_post_detail["Post detail route<br/>dynamic route<br/>[&#91;slug&#93;.astro]"]
  node_project_detail["Project detail route<br/>dynamic route<br/>[&#91;slug&#93;.astro]"]
  node_astro_components["Astro presentation<br/>components"]
  node_islands["Interactive islands<br/>React/client JS<br/>[sticker-board.jsx]"]
  node_github_dashboard["GitHub dashboard client<br/>browser script"]
end

subgraph group_content["Publishing"]
  node_content_config["Content collections<br/>Astro content config<br/>[config.ts]"]
  node_posts["Blog posts<br/>Markdown corpus"]
  node_projects["Project records<br/>JSON corpus"]
  node_public_assets["Public media bundle<br/>static assets"]
end

subgraph group_aria["A.R.I.A."]
  node_aria_client["A.R.I.A. client<br/>React application<br/>[AriaApp.tsx]"]
  node_aria_chat{{"A.R.I.A. chat API<br/>Vercel API route<br/>[chat.ts]"}}
  node_aria_retrieval["Corpus retrieval<br/>retrieval layer<br/>[retrieve.ts]"]
  node_aria_provider["Model provider<br/>provider adapter<br/>[provider.ts]"]
end

subgraph group_integrations["Serverless integrations"]
  node_stickers_api{{"Sticker API<br/>Vercel API route<br/>[stickers.ts]"}}
  node_subscribe_api{{"Subscription API<br/>Vercel API route<br/>[subscribe.ts]"}}
  node_newsletter_api{{"Newsletter sender<br/>Vercel API route<br/>[send-newsletter.ts]"}}
  node_heartbeat_cron{{"Heartbeat cron<br/>scheduled API route"}}
  node_redis[("Upstash Redis<br/>external datastore")]
  node_resend["Resend<br/>email service"]
  node_github_api["GitHub activity API<br/>external API"]
  node_vercel{{"Vercel<br/>hosting and scheduler<br/>[vercel.json]"}}
end

node_astro -->|"builds"| node_routes
node_routes -->|"uses"| node_layout
node_routes -->|"composes"| node_astro_components
node_routes -->|"queries"| node_content_config
node_post_detail -->|"resolves slug"| node_posts
node_project_detail -->|"resolves slug"| node_projects
node_content_config -->|"validates"| node_posts
node_content_config -->|"validates"| node_projects
node_astro_components -->|"serves media"| node_public_assets
node_routes -.->|"hydrates selectively"| node_islands
node_github_dashboard -->|"fetches activity"| node_github_api
node_islands -->|"guestbook requests"| node_stickers_api
node_aria_client -->|"sends chat"| node_aria_chat
node_islands -->|"mounts"| node_aria_client
node_aria_chat -->|"retrieves sources"| node_aria_retrieval
node_aria_chat -->|"constructs prompt and calls"| node_aria_provider
node_stickers_api -->|"stores stickers"| node_redis
node_subscribe_api -->|"stores subscriptions"| node_redis
node_newsletter_api -->|"sends email"| node_resend
node_heartbeat_cron -->|"updates sticker"| node_stickers_api
node_vercel -->|"deploys"| node_astro
node_vercel -->|"schedules"| node_heartbeat_cron

click node_astro "https://github.com/rajin-khan/portfolio/blob/main/astro.config.mjs"
click node_layout "https://github.com/rajin-khan/portfolio/blob/main/src/layouts/main.astro"
click node_routes "https://github.com/rajin-khan/portfolio/blob/main/src/pages/index.astro"
click node_post_detail "https://github.com/rajin-khan/portfolio/blob/main/src/pages/post/%5Bslug%5D.astro"
click node_project_detail "https://github.com/rajin-khan/portfolio/blob/main/src/pages/projects/%5Bslug%5D.astro"
click node_astro_components "https://github.com/rajin-khan/portfolio/blob/main/src/components/about-experience.astro"
click node_islands "https://github.com/rajin-khan/portfolio/blob/main/src/components/sticker-board.jsx"
click node_github_dashboard "https://github.com/rajin-khan/portfolio/blob/main/src/assets/js/github-dashboard.js"
click node_content_config "https://github.com/rajin-khan/portfolio/blob/main/src/content/config.ts"
click node_aria_client "https://github.com/rajin-khan/portfolio/blob/main/src/components/aria/AriaApp.tsx"
click node_aria_chat "https://github.com/rajin-khan/portfolio/blob/main/src/pages/api/aria/chat.ts"
click node_aria_retrieval "https://github.com/rajin-khan/portfolio/blob/main/src/lib/aria/retrieve.ts"
click node_aria_provider "https://github.com/rajin-khan/portfolio/blob/main/src/lib/aria/provider.ts"
click node_stickers_api "https://github.com/rajin-khan/portfolio/blob/main/src/pages/api/stickers.ts"
click node_subscribe_api "https://github.com/rajin-khan/portfolio/blob/main/src/pages/api/subscribe.ts"
click node_newsletter_api "https://github.com/rajin-khan/portfolio/blob/main/src/pages/api/send-newsletter.ts"
click node_heartbeat_cron "https://github.com/rajin-khan/portfolio/blob/main/src/pages/api/cron/heartbeat-sticker.ts"
click node_vercel "https://github.com/rajin-khan/portfolio/blob/main/vercel.json"

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_astro,node_layout,node_routes,node_post_detail,node_project_detail,node_astro_components,node_islands,node_github_dashboard toneBlue
class node_content_config,node_posts,node_projects,node_public_assets toneAmber
class node_aria_client,node_aria_chat,node_aria_retrieval,node_aria_provider toneMint
class node_stickers_api,node_subscribe_api,node_newsletter_api,node_heartbeat_cron,node_redis,node_resend,node_github_api,node_vercel toneRose
```

## Components

### Static site

- [Astro site runtime](https://github.com/rajin-khan/portfolio/blob/main/astro.config.mjs): Astro 5 · Builds static-first pages and Vercel functions. · `astro.config.mjs`
- [Main layout](https://github.com/rajin-khan/portfolio/blob/main/src/layouts/main.astro): Astro layout · `src/layouts/main.astro`
- [Site pages](https://github.com/rajin-khan/portfolio/blob/main/src/pages/index.astro): Astro routes · Home, profile, curated, portfolio, posts, and uses pages. · `src/pages/index.astro`
- [Post detail route](https://github.com/rajin-khan/portfolio/blob/main/src/pages/post/%5Bslug%5D.astro): dynamic route · `src/pages/post/[slug].astro`
- [Project detail route](https://github.com/rajin-khan/portfolio/blob/main/src/pages/projects/%5Bslug%5D.astro): dynamic route · `src/pages/projects/[slug].astro`
- [Astro presentation](https://github.com/rajin-khan/portfolio/blob/main/src/components/about-experience.astro): components · Shared page composition, including globe and RAJINTALKSALOT surfaces. · `src/components/about-experience.astro`
- [Interactive islands](https://github.com/rajin-khan/portfolio/blob/main/src/components/sticker-board.jsx): React/client JS · Hydrated guestbook, carousel, assistant, and dashboard interactions. · `src/components/sticker-board.jsx`
- [GitHub dashboard client](https://github.com/rajin-khan/portfolio/blob/main/src/assets/js/github-dashboard.js): browser script · `src/assets/js/github-dashboard.js`

### Publishing

- [Content collections](https://github.com/rajin-khan/portfolio/blob/main/src/content/config.ts): Astro content config · Validates and registers posts and projects. · `src/content/config.ts`
- **Blog posts**: Markdown corpus
- **Project records**: JSON corpus
- **Public media bundle**: static assets · Portfolio media, PDFs, video, newsletter artifacts, and RAJINTALKSALOT content.

### A.R.I.A.

- [A.R.I.A. client](https://github.com/rajin-khan/portfolio/blob/main/src/components/aria/AriaApp.tsx): React application · Launcher and conversational interface. · `src/components/aria/AriaApp.tsx`
- [A.R.I.A. chat API](https://github.com/rajin-khan/portfolio/blob/main/src/pages/api/aria/chat.ts): Vercel API route · Applies source, security, and response protocol controls. · `src/pages/api/aria/chat.ts`
- [Corpus retrieval](https://github.com/rajin-khan/portfolio/blob/main/src/lib/aria/retrieve.ts): retrieval layer · Finds approved site knowledge and freshness context. · `src/lib/aria/retrieve.ts`
- [Model provider](https://github.com/rajin-khan/portfolio/blob/main/src/lib/aria/provider.ts): provider adapter · Executes constrained provider calls. · `src/lib/aria/provider.ts`

### Serverless integrations

- [Sticker API](https://github.com/rajin-khan/portfolio/blob/main/src/pages/api/stickers.ts): Vercel API route · Persists guestbook stickers. · `src/pages/api/stickers.ts`
- [Subscription API](https://github.com/rajin-khan/portfolio/blob/main/src/pages/api/subscribe.ts): Vercel API route · Persists newsletter subscriptions. · `src/pages/api/subscribe.ts`
- [Newsletter sender](https://github.com/rajin-khan/portfolio/blob/main/src/pages/api/send-newsletter.ts): Vercel API route · Delivers newsletters through Resend. · `src/pages/api/send-newsletter.ts`
- [Heartbeat cron](https://github.com/rajin-khan/portfolio/blob/main/src/pages/api/cron/heartbeat-sticker.ts): scheduled API route · Updates the daily heartbeat sticker. · `src/pages/api/cron/heartbeat-sticker.ts`
- **Upstash Redis**: external datastore · Stores stickers and subscriptions.
- **Resend**: email service
- **GitHub activity API**: external API · Supplies activity data to the site dashboard.
- [Vercel](https://github.com/rajin-khan/portfolio/blob/main/vercel.json): hosting and scheduler · Hosts the site, API routes, and cron work. · `vercel.json`

## Connections

- Astro site runtime → Site pages: builds
- Site pages → Main layout: uses
- Site pages → Astro presentation: composes
- Site pages → Content collections: queries
- Post detail route → Blog posts: resolves slug
- Project detail route → Project records: resolves slug
- Content collections → Blog posts: validates
- Content collections → Project records: validates
- Astro presentation → Public media bundle: serves media
- Site pages → Interactive islands: hydrates selectively
- GitHub dashboard client → GitHub activity API: fetches activity
- Interactive islands → Sticker API: guestbook requests
- A.R.I.A. client → A.R.I.A. chat API: sends chat
- Interactive islands → A.R.I.A. client: mounts
- A.R.I.A. chat API → Corpus retrieval: retrieves sources
- A.R.I.A. chat API → Model provider: constructs prompt and calls
- Sticker API → Upstash Redis: stores stickers
- Subscription API → Upstash Redis: stores subscriptions
- Newsletter sender → Resend: sends email
- Heartbeat cron → Sticker API: updates sticker
- Vercel → Astro site runtime: deploys
- Vercel → Heartbeat cron: schedules
