# honoured-1-byte/the_akashic_records architecture

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

- Interactive diagram: https://gitdiagram.com/honoured-1-byte/the_akashic_records
- Repository: https://github.com/honoured-1-byte/the_akashic_records

## Overview

The Akashic Records is a server-rendered social blogging platform. Readers browse ranked and recent posts, search or autocomplete, and open articles to view and comment; signed-in authors manage posts and profiles, while users can like, bookmark, and follow. A separate bot writer generates AI-authored posts and cover art and saves them to the same blog store. The README documents reading-time discovery, Markdown/XSS-safe rendering, and Cloudinary support, but their implementation paths were not sampled; those capabilities are represented only where the tree supports a subsystem path. Edges reflect excerpts or README statements; unsampled wiring is omitted.

Main entry points: [`app.js`](https://github.com/honoured-1-byte/the_akashic_records/blob/main/app.js) (Express app), [`routes/blog.js`](https://github.com/honoured-1-byte/the_akashic_records/blob/main/routes/blog.js) (Blog routes), [`routes/user.js`](https://github.com/honoured-1-byte/the_akashic_records/blob/main/routes/user.js) (User routes), [`scripts/bot_writer.js`](https://github.com/honoured-1-byte/the_akashic_records/blob/main/scripts/bot_writer.js) (Bot writer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_express["Express app<br/>[app.js]"]
  node_templates["Server-rendered views"]
  node_browser_assets["Browser assets"]
end

subgraph group_content["Content and social"]
  node_blog_routes["Blog routes<br/>[blog.js]"]
  node_blog_store[("Blog records<br/>[blog.js]")]
  node_comments[("Comments<br/>[comments.js]")]
  node_image_service["IMGCDN upload<br/>[imgcdn.js]"]
end

subgraph group_identity["Identity"]
  node_user_routes["User routes<br/>[user.js]"]
  node_user_store[("User records<br/>[user.js]")]
  node_auth_middleware["Cookie auth<br/>[authentication.js]"]
  node_auth_service["JWT service<br/>[authentication.js]"]
end

subgraph group_discovery["Discovery"]
  node_search_trie["Autocomplete index<br/>[trie.js]"]
end

subgraph group_agents["AI publishing"]
  node_bot_writer["Bot writer<br/>[bot_writer.js]"]
end

node_reader(("Reader / author"))
node_image_host["IMGCDN"]
node_mongo[("MongoDB")]
node_gemini["Gemini generation"]
node_pollinations["Pollinations imagery"]
node_picsum["Picsum fallback"]
node_cloudinary["Cloudinary media"]

node_reader -->|"sends requests"| node_express
node_express -->|"checks cookies"| node_auth_middleware
node_auth_middleware -->|"validates token"| node_auth_service
node_express -->|"routes /blog"| node_blog_routes
node_express -->|"routes /user"| node_user_routes
node_express -->|"queries homepage"| node_blog_store
node_express -->|"rebuilds and searches"| node_search_trie
node_express -->|"renders pages"| node_templates
node_express -->|"serves static files"| node_browser_assets
node_blog_routes -->|"creates and queries"| node_blog_store
node_blog_routes -->|"queries and creates"| node_comments
node_blog_routes -->|"loads acting user"| node_user_store
node_blog_routes -->|"renders post pages"| node_templates
node_user_routes -->|"manages accounts"| node_user_store
node_user_routes -->|"loads profile posts"| node_blog_store
node_user_routes -->|"issues signup token"| node_auth_service
node_user_routes -->|"uploads profile image"| node_image_service
node_user_routes -->|"renders account pages"| node_templates
node_user_store -->|"creates login token"| node_auth_service
node_image_service -->|"uploads image"| node_image_host
node_bot_writer -->|"saves generated post"| node_blog_store
node_bot_writer -->|"generates article"| node_gemini
node_bot_writer -->|"requests cover art"| node_pollinations
node_bot_writer -->|"uses fallback image"| node_picsum
node_blog_routes -.->|"uploads cover image"| node_cloudinary
node_bot_writer -->|"connects for publishing"| node_mongo
node_express -->|"connects for application"| node_mongo

click node_express "https://github.com/honoured-1-byte/the_akashic_records/blob/main/app.js"
click node_blog_routes "https://github.com/honoured-1-byte/the_akashic_records/blob/main/routes/blog.js"
click node_user_routes "https://github.com/honoured-1-byte/the_akashic_records/blob/main/routes/user.js"
click node_blog_store "https://github.com/honoured-1-byte/the_akashic_records/blob/main/models/blog.js"
click node_comments "https://github.com/honoured-1-byte/the_akashic_records/blob/main/models/comments.js"
click node_user_store "https://github.com/honoured-1-byte/the_akashic_records/blob/main/models/user.js"
click node_auth_middleware "https://github.com/honoured-1-byte/the_akashic_records/blob/main/middlewares/authentication.js"
click node_auth_service "https://github.com/honoured-1-byte/the_akashic_records/blob/main/services/authentication.js"
click node_search_trie "https://github.com/honoured-1-byte/the_akashic_records/blob/main/services/trie.js"
click node_templates "https://github.com/honoured-1-byte/the_akashic_records/tree/main/views"
click node_browser_assets "https://github.com/honoured-1-byte/the_akashic_records/tree/main/public"
click node_image_service "https://github.com/honoured-1-byte/the_akashic_records/blob/main/services/imgcdn.js"
click node_bot_writer "https://github.com/honoured-1-byte/the_akashic_records/blob/main/scripts/bot_writer.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_express,node_templates,node_browser_assets toneBlue
class node_blog_routes,node_blog_store,node_comments,node_image_service,node_mongo toneAmber
class node_user_routes,node_user_store,node_auth_middleware,node_auth_service toneMint
class node_search_trie toneRose
class node_bot_writer,node_reader,node_image_host,node_gemini,node_pollinations,node_picsum,node_cloudinary toneIndigo
```

## Components

### Web application

- [Express app](https://github.com/honoured-1-byte/the_akashic_records/blob/main/app.js): `app.js`
- [Server-rendered views](https://github.com/honoured-1-byte/the_akashic_records/tree/main/views): `views`
- [Browser assets](https://github.com/honoured-1-byte/the_akashic_records/tree/main/public): `public`

### Content and social

- [Blog routes](https://github.com/honoured-1-byte/the_akashic_records/blob/main/routes/blog.js): `routes/blog.js`
- [Blog records](https://github.com/honoured-1-byte/the_akashic_records/blob/main/models/blog.js): `models/blog.js`
- [Comments](https://github.com/honoured-1-byte/the_akashic_records/blob/main/models/comments.js): `models/comments.js`
- [IMGCDN upload](https://github.com/honoured-1-byte/the_akashic_records/blob/main/services/imgcdn.js): `services/imgcdn.js`

### Identity

- [User routes](https://github.com/honoured-1-byte/the_akashic_records/blob/main/routes/user.js): `routes/user.js`
- [User records](https://github.com/honoured-1-byte/the_akashic_records/blob/main/models/user.js): `models/user.js`
- [Cookie auth](https://github.com/honoured-1-byte/the_akashic_records/blob/main/middlewares/authentication.js): `middlewares/authentication.js`
- [JWT service](https://github.com/honoured-1-byte/the_akashic_records/blob/main/services/authentication.js): `services/authentication.js`

### Discovery

- [Autocomplete index](https://github.com/honoured-1-byte/the_akashic_records/blob/main/services/trie.js): `services/trie.js`

### AI publishing

- [Bot writer](https://github.com/honoured-1-byte/the_akashic_records/blob/main/scripts/bot_writer.js): `scripts/bot_writer.js`

### Other components

- **Reader / author**
- **IMGCDN**
- **MongoDB**
- **Gemini generation**
- **Pollinations imagery**
- **Picsum fallback**
- **Cloudinary media**

## Connections

- Reader / author → Express app: sends requests (evidence: `README.md`)
- Express app → Cookie auth: checks cookies (evidence: `app.js`)
- Cookie auth → JWT service: validates token (evidence: `middlewares/authentication.js`)
- Express app → Blog routes: routes /blog (evidence: `app.js`)
- Express app → User routes: routes /user (evidence: `app.js`)
- Express app → Blog records: queries homepage (evidence: `app.js`)
- Express app → Autocomplete index: rebuilds and searches (evidence: `app.js`)
- Express app → Server-rendered views: renders pages (evidence: `app.js`)
- Express app → Browser assets: serves static files (evidence: `app.js`)
- Blog routes → Blog records: creates and queries (evidence: `routes/blog.js`)
- Blog routes → Comments: queries and creates (evidence: `routes/blog.js`)
- Blog routes → User records: loads acting user (evidence: `routes/blog.js`)
- Blog routes → Server-rendered views: renders post pages (evidence: `routes/blog.js`)
- User routes → User records: manages accounts (evidence: `routes/user.js`)
- User routes → Blog records: loads profile posts (evidence: `routes/user.js`)
- User routes → JWT service: issues signup token (evidence: `routes/user.js`)
- User routes → IMGCDN upload: uploads profile image (evidence: `routes/user.js`)
- User routes → Server-rendered views: renders account pages (evidence: `routes/user.js`)
- User records → JWT service: creates login token (evidence: `models/user.js`)
- IMGCDN upload → IMGCDN: uploads image (evidence: `services/imgcdn.js`)
- Bot writer → Blog records: saves generated post (evidence: `scripts/bot_writer.js`)
- Bot writer → Gemini generation: generates article (evidence: `scripts/bot_writer.js`)
- Bot writer → Pollinations imagery: requests cover art (evidence: `scripts/bot_writer.js`)
- Bot writer → Picsum fallback: uses fallback image (evidence: `scripts/bot_writer.js`)
- Blog routes → Cloudinary media: uploads cover image (evidence: `README.md`)
- Bot writer → MongoDB: connects for publishing (evidence: `scripts/bot_writer.js`)
- Express app → MongoDB: connects for application (evidence: `app.js`)
