# benikk/chalk architecture

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

- Interactive diagram: https://gitdiagram.com/benikk/chalk
- Repository: https://github.com/benikk/chalk

## Overview

Chalk is a campus writing community: people create accounts, publish labeled posts, discover and interact with posts, and manage profiles and follows. The browser’s shared API client sends JSON requests to the Express application, whose routes dispatch to controllers and persistence. The README documents additional profile themes, moderation, and account recovery; sampled source confirms the auth and post paths, while several other feature links are documented rather than verified in page code.

Main entry points: [`server/models/users.js`](https://github.com/benikk/chalk/blob/main/server/models/users.js) (User records), [`server/controllers/auth.js`](https://github.com/benikk/chalk/blob/main/server/controllers/auth.js) (Account workflows), [`public/js/api.js`](https://github.com/benikk/chalk/blob/main/public/js/api.js) (API client), [`server/models/posts.js`](https://github.com/benikk/chalk/blob/main/server/models/posts.js) (Post records)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Website client"]
  node_browser["Chalk website"]
  node_client_api["API client<br/>[api.js]"]
  node_post_ui["Post interactions<br/>[render.js]"]
  node_profile_ui["Profile experience<br/>[profile.js]"]
  node_themes["Profile themes<br/>[themes.js]"]
end

subgraph group_api["API and domain"]
  node_app["Express application<br/>[app.js]"]
  node_auth_routes["Account routes<br/>[auth.js]"]
  node_post_routes["Post routes<br/>[posts.js]"]
  node_posts["Post workflows<br/>[posts.js]"]
  node_comments["Comment workflows<br/>[comments.js]"]
end

subgraph group_identity["Accounts and profiles"]
  node_auth["Account workflows<br/>[auth.js]"]
  node_users["People workflows<br/>[users.js]"]
  node_profile_settings["Account settings<br/>[me.js]"]
  node_moderation["Moderation<br/>[admin.js]"]
end

subgraph group_data["Persistence and services"]
  node_user_store["User records<br/>[users.js]"]
  node_post_store["Post records<br/>[posts.js]"]
  node_other_models["Social records"]
  node_database[("PostgreSQL database")]
  node_email["Email delivery<br/>[email.js]"]
  node_photo_service["Photo storage<br/>[photos.js]"]
end

node_people(("Community members"))
node_email_provider["Email provider"]
node_photo_provider["Photo provider"]

node_people -->|"uses"| node_browser
node_browser -->|"requests through"| node_client_api
node_client_api -->|"calls JSON API"| node_app
node_post_ui -.->|"post actions"| node_client_api
node_profile_ui -->|"profile actions"| node_client_api
node_profile_ui -->|"applies"| node_themes
node_app -->|"mounts"| node_auth_routes
node_app -->|"mounts"| node_post_routes
node_auth_routes -->|"dispatches"| node_auth
node_post_routes -->|"dispatches"| node_posts
node_post_routes -->|"dispatches"| node_comments
node_auth -->|"reads and writes"| node_user_store
node_auth -->|"uses token records"| node_other_models
node_auth -->|"sends account email"| node_email
node_email -.->|"delivers through"| node_email_provider
node_posts -->|"reads and writes"| node_post_store
node_posts -->|"uses social records"| node_other_models
node_comments -->|"uses comment records"| node_other_models
node_comments -->|"checks posts"| node_post_store
node_users -->|"reads profiles"| node_user_store
node_users -->|"loads user posts"| node_post_store
node_profile_settings -.->|"updates account"| node_user_store
node_profile_settings -.->|"manages avatar"| node_photo_service
node_photo_service -.->|"stores photos"| node_photo_provider
node_moderation -.->|"manages roles"| node_user_store
node_user_store -->|"queries"| node_database
node_post_store -->|"queries"| node_database
node_other_models -.->|"queries"| node_database

click node_browser "https://github.com/benikk/chalk/tree/main/public/js/pages"
click node_client_api "https://github.com/benikk/chalk/blob/main/public/js/api.js"
click node_post_ui "https://github.com/benikk/chalk/blob/main/public/js/render.js"
click node_profile_ui "https://github.com/benikk/chalk/blob/main/public/js/pages/profile.js"
click node_themes "https://github.com/benikk/chalk/blob/main/public/js/themes.js"
click node_app "https://github.com/benikk/chalk/blob/main/server/app.js"
click node_auth_routes "https://github.com/benikk/chalk/blob/main/server/routes/auth.js"
click node_post_routes "https://github.com/benikk/chalk/blob/main/server/routes/posts.js"
click node_auth "https://github.com/benikk/chalk/blob/main/server/controllers/auth.js"
click node_posts "https://github.com/benikk/chalk/blob/main/server/controllers/posts.js"
click node_comments "https://github.com/benikk/chalk/blob/main/server/controllers/comments.js"
click node_users "https://github.com/benikk/chalk/blob/main/server/controllers/users.js"
click node_profile_settings "https://github.com/benikk/chalk/blob/main/server/controllers/me.js"
click node_moderation "https://github.com/benikk/chalk/blob/main/server/controllers/admin.js"
click node_user_store "https://github.com/benikk/chalk/blob/main/server/models/users.js"
click node_post_store "https://github.com/benikk/chalk/blob/main/server/models/posts.js"
click node_other_models "https://github.com/benikk/chalk/tree/main/server/models"
click node_email "https://github.com/benikk/chalk/blob/main/server/services/email.js"
click node_photo_service "https://github.com/benikk/chalk/blob/main/server/services/photos.js"

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_browser,node_client_api,node_post_ui,node_profile_ui,node_themes toneBlue
class node_app,node_auth_routes,node_post_routes,node_posts,node_comments toneAmber
class node_auth,node_users,node_profile_settings,node_moderation toneMint
class node_user_store,node_post_store,node_other_models,node_database,node_email,node_photo_service toneRose
class node_people,node_email_provider,node_photo_provider toneIndigo
```

## Components

### Website client

- [Chalk website](https://github.com/benikk/chalk/tree/main/public/js/pages): `public/js/pages`
- [API client](https://github.com/benikk/chalk/blob/main/public/js/api.js): `public/js/api.js`
- [Post interactions](https://github.com/benikk/chalk/blob/main/public/js/render.js): `public/js/render.js`
- [Profile experience](https://github.com/benikk/chalk/blob/main/public/js/pages/profile.js): `public/js/pages/profile.js`
- [Profile themes](https://github.com/benikk/chalk/blob/main/public/js/themes.js): `public/js/themes.js`

### API and domain

- [Express application](https://github.com/benikk/chalk/blob/main/server/app.js): `server/app.js`
- [Account routes](https://github.com/benikk/chalk/blob/main/server/routes/auth.js): `server/routes/auth.js`
- [Post routes](https://github.com/benikk/chalk/blob/main/server/routes/posts.js): `server/routes/posts.js`
- [Post workflows](https://github.com/benikk/chalk/blob/main/server/controllers/posts.js): `server/controllers/posts.js`
- [Comment workflows](https://github.com/benikk/chalk/blob/main/server/controllers/comments.js): `server/controllers/comments.js`

### Accounts and profiles

- [Account workflows](https://github.com/benikk/chalk/blob/main/server/controllers/auth.js): `server/controllers/auth.js`
- [People workflows](https://github.com/benikk/chalk/blob/main/server/controllers/users.js): `server/controllers/users.js`
- [Account settings](https://github.com/benikk/chalk/blob/main/server/controllers/me.js): `server/controllers/me.js`
- [Moderation](https://github.com/benikk/chalk/blob/main/server/controllers/admin.js): `server/controllers/admin.js`

### Persistence and services

- [User records](https://github.com/benikk/chalk/blob/main/server/models/users.js): `server/models/users.js`
- [Post records](https://github.com/benikk/chalk/blob/main/server/models/posts.js): `server/models/posts.js`
- [Social records](https://github.com/benikk/chalk/tree/main/server/models): `server/models`
- **PostgreSQL database**
- [Email delivery](https://github.com/benikk/chalk/blob/main/server/services/email.js): `server/services/email.js`
- [Photo storage](https://github.com/benikk/chalk/blob/main/server/services/photos.js): `server/services/photos.js`

### Other components

- **Community members**
- **Email provider**
- **Photo provider**

## Connections

- Community members → Chalk website: uses (evidence: `README.md`)
- Chalk website → API client: requests through (evidence: `README.md`)
- API client → Express application: calls JSON API (evidence: `README.md`)
- Post interactions → API client: post actions
- Profile experience → API client: profile actions (evidence: `public/js/pages/profile.js`)
- Profile experience → Profile themes: applies (evidence: `public/js/pages/profile.js`)
- Express application → Account routes: mounts (evidence: `server/app.js`)
- Express application → Post routes: mounts (evidence: `server/app.js`)
- Account routes → Account workflows: dispatches (evidence: `server/routes/auth.js`)
- Post routes → Post workflows: dispatches (evidence: `server/routes/posts.js`)
- Post routes → Comment workflows: dispatches (evidence: `server/routes/posts.js`)
- Account workflows → User records: reads and writes (evidence: `server/controllers/auth.js`)
- Account workflows → Social records: uses token records (evidence: `server/controllers/auth.js`)
- Account workflows → Email delivery: sends account email (evidence: `server/controllers/auth.js`)
- Email delivery → Email provider: delivers through
- Post workflows → Post records: reads and writes (evidence: `server/controllers/posts.js`)
- Post workflows → Social records: uses social records (evidence: `server/controllers/posts.js`)
- Comment workflows → Social records: uses comment records (evidence: `server/controllers/comments.js`)
- Comment workflows → Post records: checks posts (evidence: `server/controllers/comments.js`)
- People workflows → User records: reads profiles (evidence: `server/controllers/users.js`)
- People workflows → Post records: loads user posts (evidence: `server/controllers/users.js`)
- Account settings → User records: updates account
- Account settings → Photo storage: manages avatar
- Photo storage → Photo provider: stores photos
- Moderation → User records: manages roles
- User records → PostgreSQL database: queries (evidence: `server/models/users.js`)
- Post records → PostgreSQL database: queries (evidence: `server/models/posts.js`)
- Social records → PostgreSQL database: queries
