# keeganknudsen/first-chair architecture

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

- Interactive diagram: https://gitdiagram.com/keeganknudsen/first-chair
- Repository: https://github.com/keeganknudsen/first-chair

## Overview

First Chair is a skiing blog whose current visitor workflow is to browse a post list, open a post by slug, and read its content. The React client fetches post data from an Express API backed by PostgreSQL; the API also exposes a database health check. The graph includes the documented migration and seed workflows. Relationship evidence is limited to the README and the source excerpts and index provided; deployment hosts are shown only where the README documents their roles.

Main entry points: [`server/src/db.ts`](https://github.com/keeganknudsen/first-chair/blob/main/server/src/db.ts) (Postgres pool), [`client/src/App.tsx`](https://github.com/keeganknudsen/first-chair/blob/main/client/src/App.tsx) (App routes), [`server/src/app.ts`](https://github.com/keeganknudsen/first-chair/blob/main/server/src/app.ts) (Express app), [`client/src/main.tsx`](https://github.com/keeganknudsen/first-chair/blob/main/client/src/main.tsx) (React entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Blog client"]
  node_react_entry["React entry<br/>[main.tsx]"]
  node_app_routes["App routes<br/>[App.tsx]"]
  node_post_list["Post list page<br/>[PostListPage.tsx]"]
  node_post_detail["Post detail page<br/>[PostPage.tsx]"]
  node_client_api["Post API client<br/>[api.ts]"]
end

subgraph group_api["API service"]
  node_express_app["Express app<br/>[app.ts]"]
  node_api_start["API startup<br/>[index.ts]"]
  node_post_routes["Post endpoints<br/>[posts.ts]"]
  node_health_check["Database health<br/>[app.ts]"]
end

subgraph group_data["Post data"]
  node_pg_pool["Postgres pool<br/>[db.ts]"]
  node_postgres[("Post database")]
end

subgraph group_ops["Database setup"]
  node_migration_runner["Migration runner<br/>[migrate.ts]"]
  node_post_schema["Post schema"]
  node_seed_posts["Seed posts<br/>[seed.ts]"]
end

node_visitor(("Blog visitor"))
node_vercel["Vercel hosting"]
node_render["Render API hosting"]

node_visitor -->|"opens blog"| node_react_entry
node_react_entry -->|"renders"| node_app_routes
node_app_routes -->|"routes to"| node_post_list
node_app_routes -->|"routes to"| node_post_detail
node_post_list -->|"fetches list"| node_client_api
node_post_detail -->|"fetches post"| node_client_api
node_client_api -->|"requests posts"| node_post_routes
node_api_start -->|"starts"| node_express_app
node_express_app -->|"mounts routes"| node_post_routes
node_express_app -->|"defines endpoint"| node_health_check
node_post_routes -->|"queries"| node_pg_pool
node_health_check -->|"checks connection"| node_pg_pool
node_pg_pool -->|"queries"| node_postgres
node_migration_runner -->|"runs migrations"| node_pg_pool
node_migration_runner -->|"applies SQL"| node_post_schema
node_seed_posts -->|"upserts posts"| node_pg_pool
node_seed_posts -.->|"populates"| node_postgres
node_vercel -->|"serves client"| node_react_entry
node_render -->|"hosts API"| node_api_start

click node_react_entry "https://github.com/keeganknudsen/first-chair/blob/main/client/src/main.tsx"
click node_app_routes "https://github.com/keeganknudsen/first-chair/blob/main/client/src/App.tsx"
click node_post_list "https://github.com/keeganknudsen/first-chair/blob/main/client/src/pages/PostListPage.tsx"
click node_post_detail "https://github.com/keeganknudsen/first-chair/blob/main/client/src/pages/PostPage.tsx"
click node_client_api "https://github.com/keeganknudsen/first-chair/blob/main/client/src/api.ts"
click node_express_app "https://github.com/keeganknudsen/first-chair/blob/main/server/src/app.ts"
click node_api_start "https://github.com/keeganknudsen/first-chair/blob/main/server/src/index.ts"
click node_post_routes "https://github.com/keeganknudsen/first-chair/blob/main/server/src/routes/posts.ts"
click node_health_check "https://github.com/keeganknudsen/first-chair/blob/main/server/src/app.ts"
click node_pg_pool "https://github.com/keeganknudsen/first-chair/blob/main/server/src/db.ts"
click node_migration_runner "https://github.com/keeganknudsen/first-chair/blob/main/server/src/migrate.ts"
click node_post_schema "https://github.com/keeganknudsen/first-chair/blob/main/server/migrations/001_create_posts.sql"
click node_seed_posts "https://github.com/keeganknudsen/first-chair/blob/main/server/src/seed.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_react_entry,node_app_routes,node_post_list,node_post_detail,node_client_api toneBlue
class node_express_app,node_api_start,node_post_routes,node_health_check toneAmber
class node_pg_pool,node_postgres,node_render toneMint
class node_migration_runner,node_post_schema,node_seed_posts toneRose
class node_visitor,node_vercel toneIndigo
```

## Components

### Blog client

- [React entry](https://github.com/keeganknudsen/first-chair/blob/main/client/src/main.tsx): `client/src/main.tsx`
- [App routes](https://github.com/keeganknudsen/first-chair/blob/main/client/src/App.tsx): `client/src/App.tsx`
- [Post list page](https://github.com/keeganknudsen/first-chair/blob/main/client/src/pages/PostListPage.tsx): `client/src/pages/PostListPage.tsx`
- [Post detail page](https://github.com/keeganknudsen/first-chair/blob/main/client/src/pages/PostPage.tsx): `client/src/pages/PostPage.tsx`
- [Post API client](https://github.com/keeganknudsen/first-chair/blob/main/client/src/api.ts): `client/src/api.ts`

### API service

- [Express app](https://github.com/keeganknudsen/first-chair/blob/main/server/src/app.ts): `server/src/app.ts`
- [API startup](https://github.com/keeganknudsen/first-chair/blob/main/server/src/index.ts): `server/src/index.ts`
- [Post endpoints](https://github.com/keeganknudsen/first-chair/blob/main/server/src/routes/posts.ts): `server/src/routes/posts.ts`
- [Database health](https://github.com/keeganknudsen/first-chair/blob/main/server/src/app.ts): `server/src/app.ts`

### Post data

- [Postgres pool](https://github.com/keeganknudsen/first-chair/blob/main/server/src/db.ts): `server/src/db.ts`
- **Post database**

### Database setup

- [Migration runner](https://github.com/keeganknudsen/first-chair/blob/main/server/src/migrate.ts): `server/src/migrate.ts`
- [Post schema](https://github.com/keeganknudsen/first-chair/blob/main/server/migrations/001_create_posts.sql): `server/migrations/001_create_posts.sql`
- [Seed posts](https://github.com/keeganknudsen/first-chair/blob/main/server/src/seed.ts): `server/src/seed.ts`

### Other components

- **Blog visitor**
- **Vercel hosting**
- **Render API hosting**

## Connections

- Blog visitor → React entry: opens blog (evidence: `README.md`)
- React entry → App routes: renders (evidence: `client/src/main.tsx`)
- App routes → Post list page: routes to (evidence: `client/src/App.tsx`)
- App routes → Post detail page: routes to (evidence: `client/src/App.tsx`)
- Post list page → Post API client: fetches list (evidence: `client/src/pages/PostListPage.tsx`)
- Post detail page → Post API client: fetches post (evidence: `client/src/pages/PostPage.tsx`)
- Post API client → Post endpoints: requests posts (evidence: `README.md`)
- API startup → Express app: starts (evidence: `server/src/index.ts`)
- Express app → Post endpoints: mounts routes (evidence: `server/src/app.ts`)
- Express app → Database health: defines endpoint (evidence: `server/src/app.ts`)
- Post endpoints → Postgres pool: queries (evidence: `server/src/routes/posts.ts`)
- Database health → Postgres pool: checks connection (evidence: `server/src/app.ts`)
- Postgres pool → Post database: queries (evidence: `README.md`)
- Migration runner → Postgres pool: runs migrations (evidence: `server/src/migrate.ts`)
- Migration runner → Post schema: applies SQL (evidence: `server/src/migrate.ts`)
- Seed posts → Postgres pool: upserts posts (evidence: `server/src/seed.ts`)
- Seed posts → Post database: populates
- Vercel hosting → React entry: serves client (evidence: `README.md`)
- Render API hosting → API startup: hosts API (evidence: `README.md`)
