# shalinbtw/portfolio architecture

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

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

## Overview

This is a personal writing site: visitors browse a post index, open articles, or submit a contact message. The React application selects pages and renders article content from a local post collection; its contact form sends to a Cloudflare Worker, which validates and rate-limits submissions before emailing them. The README documents static asset hosting and SPA fallback alongside the API Worker. Relationships for the browser-to-Worker request and contact handling are visible in source; hosting behavior is documented in the README.

Main entry points: [`src/App.tsx`](https://github.com/shalinbtw/portfolio/blob/main/src/App.tsx) (Page routing and layouts), [`worker/index.ts`](https://github.com/shalinbtw/portfolio/blob/main/worker/index.ts) (Contact API validation), [`src/main.tsx`](https://github.com/shalinbtw/portfolio/blob/main/src/main.tsx) (React entry point), [`src/components/ContactForm.tsx`](https://github.com/shalinbtw/portfolio/blob/main/src/components/ContactForm.tsx) (Contact form states)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Writing site"]
  node_app["Page routing and layouts<br/>[App.tsx]"]
  node_bootstrap["React entry point<br/>[main.tsx]"]
  node_appstyles["Editorial styles<br/>[App.css]"]
  node_globalstyles["Global typography<br/>[index.css]"]
end

subgraph group_content["Post content"]
  node_posts["Post content and metadata<br/>[posts.ts]"]
end

subgraph group_contact["Contact delivery"]
  node_contactform["Contact form states<br/>[ContactForm.tsx]"]
  node_worker["Contact API validation<br/>[index.ts]"]
  node_ratelimit[("Contact rate limiter")]
  node_email["Cloudflare Email Routing"]
end

subgraph group_hosting["Cloudflare hosting"]
  node_staticassets["Static assets and SPA fallback<br/>[wrangler.jsonc]"]
end

node_visitor(("Site visitor"))

node_visitor -->|"requests pages"| node_staticassets
node_staticassets -->|"serves app"| node_app
node_bootstrap -->|"renders"| node_app
node_bootstrap -->|"loads styles"| node_globalstyles
node_app -->|"reads posts"| node_posts
node_app -->|"renders form"| node_contactform
node_app -->|"loads styles"| node_appstyles
node_contactform -->|"posts submission"| node_worker
node_worker -->|"checks limit"| node_ratelimit
node_worker -->|"sends message"| node_email

click node_app "https://github.com/shalinbtw/portfolio/blob/main/src/App.tsx"
click node_bootstrap "https://github.com/shalinbtw/portfolio/blob/main/src/main.tsx"
click node_appstyles "https://github.com/shalinbtw/portfolio/blob/main/src/App.css"
click node_globalstyles "https://github.com/shalinbtw/portfolio/blob/main/src/index.css"
click node_posts "https://github.com/shalinbtw/portfolio/blob/main/src/posts.ts"
click node_contactform "https://github.com/shalinbtw/portfolio/blob/main/src/components/ContactForm.tsx"
click node_worker "https://github.com/shalinbtw/portfolio/blob/main/worker/index.ts"
click node_staticassets "https://github.com/shalinbtw/portfolio/blob/main/wrangler.jsonc"

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_app,node_bootstrap,node_appstyles,node_globalstyles toneBlue
class node_posts toneAmber
class node_contactform,node_worker,node_ratelimit,node_email toneMint
class node_staticassets toneRose
class node_visitor toneIndigo
```

## Components

### Writing site

- [Page routing and layouts](https://github.com/shalinbtw/portfolio/blob/main/src/App.tsx): `src/App.tsx`
- [React entry point](https://github.com/shalinbtw/portfolio/blob/main/src/main.tsx): `src/main.tsx`
- [Editorial styles](https://github.com/shalinbtw/portfolio/blob/main/src/App.css): `src/App.css`
- [Global typography](https://github.com/shalinbtw/portfolio/blob/main/src/index.css): `src/index.css`

### Post content

- [Post content and metadata](https://github.com/shalinbtw/portfolio/blob/main/src/posts.ts): `src/posts.ts`

### Contact delivery

- [Contact form states](https://github.com/shalinbtw/portfolio/blob/main/src/components/ContactForm.tsx): `src/components/ContactForm.tsx`
- [Contact API validation](https://github.com/shalinbtw/portfolio/blob/main/worker/index.ts): `worker/index.ts`
- **Contact rate limiter**
- **Cloudflare Email Routing**

### Cloudflare hosting

- [Static assets and SPA fallback](https://github.com/shalinbtw/portfolio/blob/main/wrangler.jsonc): `wrangler.jsonc`

### Other components

- **Site visitor**

## Connections

- Site visitor → Static assets and SPA fallback: requests pages (evidence: `README.md`)
- Static assets and SPA fallback → Page routing and layouts: serves app (evidence: `README.md`)
- React entry point → Page routing and layouts: renders (evidence: `src/main.tsx`)
- React entry point → Global typography: loads styles (evidence: `src/main.tsx`)
- Page routing and layouts → Post content and metadata: reads posts (evidence: `src/App.tsx`)
- Page routing and layouts → Contact form states: renders form (evidence: `src/App.tsx`)
- Page routing and layouts → Editorial styles: loads styles (evidence: `src/App.tsx`)
- Contact form states → Contact API validation: posts submission (evidence: `src/components/ContactForm.tsx`)
- Contact API validation → Contact rate limiter: checks limit (evidence: `worker/index.ts`)
- Contact API validation → Cloudflare Email Routing: sends message (evidence: `worker/index.ts`)
