# ltsgror/ror_blog architecture

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

- Interactive diagram: https://gitdiagram.com/ltsgror/ror_blog
- Repository: https://github.com/ltsgror/ror_blog

## Overview

RoR Blog is a localized Rails community-blog application. Readers browse and search verified posts; members create posts, discuss them, react, and manage revisions; administrators moderate posts, revisions, and users. The principal publishing workflow runs from post submission or update through background AI review and human review to verified publication. Other documented capabilities include accounts, chat, full-text search, and scheduled suspension cleanup. The graph uses the sampled controllers for concrete calls; some additional product branches are included from routes and README documentation, with uncertain internal wiring omitted.

Main entry points: [`app/jobs/moderate_post_job.rb`](https://github.com/ltsgror/ror_blog/blob/main/app/jobs/moderate_post_job.rb) (AI moderation job), [`app/models/post.rb`](https://github.com/ltsgror/ror_blog/blob/main/app/models/post.rb) (Posts), [`app/controllers/posts_controller.rb`](https://github.com/ltsgror/ror_blog/blob/main/app/controllers/posts_controller.rb) (Post workflows), [`app/controllers/admin/posts_controller.rb`](https://github.com/ltsgror/ror_blog/blob/main/app/controllers/admin/posts_controller.rb) (Admin post review)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web workflows"]
  node_posts_web["Post workflows"]
  node_admin_posts["Admin post review"]
  node_revision_review["Revision review"]
  node_accounts["Accounts and profiles"]
  node_discussion["Comments and reactions"]
  node_chat["Chat<br/>[chat_controller.rb]"]
end

subgraph group_content["Content domain"]
  node_post["Posts<br/>[post.rb]"]
  node_revision["Post revisions<br/>[post_revision.rb]"]
  node_user["Users<br/>[user.rb]"]
  node_discussion_data["Comments and reactions<br/>[comment.rb]"]
  node_chat_history["Chat history<br/>[chat_history.rb]"]
  node_moderation_settings["Moderation settings"]
end

subgraph group_async["Background services"]
  node_search["Post search"]
  node_embedding["Post embeddings"]
  node_moderation_job["AI moderation job"]
  node_moderation_client["AI moderation client<br/>[client.rb]"]
  node_generation["AI generation<br/>[service.rb]"]
  node_suspension_job["Suspension cleanup"]
end

subgraph group_integrations["External systems"]
  node_database[("PostgreSQL")]
  node_elasticsearch[("Elasticsearch")]
  node_sidekiq["Sidekiq and Redis"]
  node_ai_provider{{"AI providers"}}
end

node_visitor(("Visitor or member"))

node_visitor -->|"browses or submits"| node_posts_web
node_visitor -->|"moderates posts"| node_admin_posts
node_visitor -->|"reviews revisions"| node_revision_review
node_visitor -->|"manages account"| node_accounts
node_visitor -->|"discusses and reacts"| node_discussion
node_visitor -->|"chats"| node_chat
node_posts_web -->|"reads and updates"| node_post
node_posts_web -->|"enqueues review"| node_moderation_job
node_admin_posts -->|"queries and updates"| node_post
node_admin_posts -->|"enqueues rerun"| node_moderation_job
node_revision_review -->|"approves or rejects"| node_revision
node_accounts -->|"reads and updates"| node_user
node_discussion -->|"creates and reads"| node_discussion_data
node_chat -->|"reads and writes"| node_chat_history
node_chat -->|"requests generation"| node_generation
node_post -->|"persists"| node_database
node_revision -->|"persists"| node_database
node_user -->|"persists"| node_database
node_discussion_data -->|"persists"| node_database
node_chat_history -->|"persists"| node_database
node_moderation_settings -->|"persists"| node_database
node_post -.->|"indexes asynchronously"| node_search
node_search -->|"indexes posts"| node_elasticsearch
node_post -.->|"indexes asynchronously"| node_embedding
node_embedding -->|"stores vectors"| node_database
node_moderation_job -->|"loads and updates"| node_post
node_moderation_job -->|"reads configuration"| node_moderation_settings
node_moderation_job -->|"requests review"| node_moderation_client
node_moderation_client -.->|"sends review request"| node_ai_provider
node_generation -.->|"requests generation"| node_ai_provider
node_moderation_job -->|"runs as job"| node_sidekiq
node_search -->|"runs as job"| node_sidekiq
node_embedding -->|"runs as job"| node_sidekiq
node_suspension_job -->|"clears expired suspensions"| node_user
node_suspension_job -->|"runs as job"| node_sidekiq

click node_posts_web "https://github.com/ltsgror/ror_blog/blob/main/app/controllers/posts_controller.rb"
click node_admin_posts "https://github.com/ltsgror/ror_blog/blob/main/app/controllers/admin/posts_controller.rb"
click node_revision_review "https://github.com/ltsgror/ror_blog/blob/main/app/controllers/admin/post_revisions_controller.rb"
click node_accounts "https://github.com/ltsgror/ror_blog/blob/main/app/controllers/users_controller.rb"
click node_discussion "https://github.com/ltsgror/ror_blog/blob/main/app/controllers/comments_controller.rb"
click node_chat "https://github.com/ltsgror/ror_blog/blob/main/app/controllers/chat_controller.rb"
click node_post "https://github.com/ltsgror/ror_blog/blob/main/app/models/post.rb"
click node_revision "https://github.com/ltsgror/ror_blog/blob/main/app/models/post_revision.rb"
click node_user "https://github.com/ltsgror/ror_blog/blob/main/app/models/user.rb"
click node_discussion_data "https://github.com/ltsgror/ror_blog/blob/main/app/models/comment.rb"
click node_chat_history "https://github.com/ltsgror/ror_blog/blob/main/app/models/chat_history.rb"
click node_moderation_settings "https://github.com/ltsgror/ror_blog/blob/main/app/models/moderation_setting.rb"
click node_search "https://github.com/ltsgror/ror_blog/blob/main/app/jobs/post_search_index_job.rb"
click node_embedding "https://github.com/ltsgror/ror_blog/blob/main/app/jobs/index_post_embeddings_job.rb"
click node_moderation_job "https://github.com/ltsgror/ror_blog/blob/main/app/jobs/moderate_post_job.rb"
click node_moderation_client "https://github.com/ltsgror/ror_blog/blob/main/app/services/ai_moderation/client.rb"
click node_generation "https://github.com/ltsgror/ror_blog/blob/main/app/services/ai_generation/service.rb"
click node_suspension_job "https://github.com/ltsgror/ror_blog/blob/main/app/jobs/clear_expired_suspensions_job.rb"

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_posts_web,node_admin_posts,node_revision_review,node_accounts,node_discussion,node_chat toneBlue
class node_post,node_revision,node_user,node_discussion_data,node_chat_history,node_moderation_settings toneAmber
class node_search,node_embedding,node_moderation_job,node_moderation_client,node_generation,node_suspension_job toneMint
class node_database,node_elasticsearch,node_sidekiq,node_ai_provider toneRose
class node_visitor toneIndigo
```

## Components

### Web workflows

- [Post workflows](https://github.com/ltsgror/ror_blog/blob/main/app/controllers/posts_controller.rb): `app/controllers/posts_controller.rb`
- [Admin post review](https://github.com/ltsgror/ror_blog/blob/main/app/controllers/admin/posts_controller.rb): `app/controllers/admin/posts_controller.rb`
- [Revision review](https://github.com/ltsgror/ror_blog/blob/main/app/controllers/admin/post_revisions_controller.rb): `app/controllers/admin/post_revisions_controller.rb`
- [Accounts and profiles](https://github.com/ltsgror/ror_blog/blob/main/app/controllers/users_controller.rb): `app/controllers/users_controller.rb`
- [Comments and reactions](https://github.com/ltsgror/ror_blog/blob/main/app/controllers/comments_controller.rb): `app/controllers/comments_controller.rb`
- [Chat](https://github.com/ltsgror/ror_blog/blob/main/app/controllers/chat_controller.rb): `app/controllers/chat_controller.rb`

### Content domain

- [Posts](https://github.com/ltsgror/ror_blog/blob/main/app/models/post.rb): `app/models/post.rb`
- [Post revisions](https://github.com/ltsgror/ror_blog/blob/main/app/models/post_revision.rb): `app/models/post_revision.rb`
- [Users](https://github.com/ltsgror/ror_blog/blob/main/app/models/user.rb): `app/models/user.rb`
- [Comments and reactions](https://github.com/ltsgror/ror_blog/blob/main/app/models/comment.rb): `app/models/comment.rb`
- [Chat history](https://github.com/ltsgror/ror_blog/blob/main/app/models/chat_history.rb): `app/models/chat_history.rb`
- [Moderation settings](https://github.com/ltsgror/ror_blog/blob/main/app/models/moderation_setting.rb): `app/models/moderation_setting.rb`

### Background services

- [Post search](https://github.com/ltsgror/ror_blog/blob/main/app/jobs/post_search_index_job.rb): `app/jobs/post_search_index_job.rb`
- [Post embeddings](https://github.com/ltsgror/ror_blog/blob/main/app/jobs/index_post_embeddings_job.rb): `app/jobs/index_post_embeddings_job.rb`
- [AI moderation job](https://github.com/ltsgror/ror_blog/blob/main/app/jobs/moderate_post_job.rb): `app/jobs/moderate_post_job.rb`
- [AI moderation client](https://github.com/ltsgror/ror_blog/blob/main/app/services/ai_moderation/client.rb): `app/services/ai_moderation/client.rb`
- [AI generation](https://github.com/ltsgror/ror_blog/blob/main/app/services/ai_generation/service.rb): `app/services/ai_generation/service.rb`
- [Suspension cleanup](https://github.com/ltsgror/ror_blog/blob/main/app/jobs/clear_expired_suspensions_job.rb): `app/jobs/clear_expired_suspensions_job.rb`

### External systems

- **PostgreSQL**
- **Elasticsearch**
- **Sidekiq and Redis**
- **AI providers**

### Other components

- **Visitor or member**

## Connections

- Visitor or member → Post workflows: browses or submits
- Visitor or member → Admin post review: moderates posts
- Visitor or member → Revision review: reviews revisions
- Visitor or member → Accounts and profiles: manages account
- Visitor or member → Comments and reactions: discusses and reacts
- Visitor or member → Chat: chats
- Post workflows → Posts: reads and updates
- Post workflows → AI moderation job: enqueues review
- Admin post review → Posts: queries and updates
- Admin post review → AI moderation job: enqueues rerun
- Revision review → Post revisions: approves or rejects
- Accounts and profiles → Users: reads and updates
- Comments and reactions → Comments and reactions: creates and reads
- Chat → Chat history: reads and writes
- Chat → AI generation: requests generation
- Posts → PostgreSQL: persists
- Post revisions → PostgreSQL: persists
- Users → PostgreSQL: persists
- Comments and reactions → PostgreSQL: persists
- Chat history → PostgreSQL: persists
- Moderation settings → PostgreSQL: persists
- Posts → Post search: indexes asynchronously
- Post search → Elasticsearch: indexes posts
- Posts → Post embeddings: indexes asynchronously
- Post embeddings → PostgreSQL: stores vectors
- AI moderation job → Posts: loads and updates
- AI moderation job → Moderation settings: reads configuration
- AI moderation job → AI moderation client: requests review
- AI moderation client → AI providers: sends review request
- AI generation → AI providers: requests generation
- AI moderation job → Sidekiq and Redis: runs as job
- Post search → Sidekiq and Redis: runs as job
- Post embeddings → Sidekiq and Redis: runs as job
- Suspension cleanup → Users: clears expired suspensions
- Suspension cleanup → Sidekiq and Redis: runs as job
