# raja7744/the-corporate-blog architecture

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

- Interactive diagram: https://gitdiagram.com/raja7744/the-corporate-blog
- Repository: https://github.com/raja7744/the-corporate-blog

## Overview

This repository implements a blog publishing platform: writers and editors manage posts, while public readers browse and search published content. The backend provides authentication, post and publishing workflows, search, images, and SEO-related endpoints; a Next.js frontend provides authoring and public pages. The sampled code verifies several backend calls and data accesses. Frontend-to-backend HTTP wiring and some listed subsystems were not sampled, so those connections are omitted or marked unverified.

Main entry points: [`tcb-backend/src/lib/prisma.ts`](https://github.com/raja7744/the-corporate-blog/blob/main/tcb-backend/src/lib/prisma.ts) (Application database), [`tcb-backend/src/posts/routes/post.routes.ts`](https://github.com/raja7744/the-corporate-blog/blob/main/tcb-backend/src/posts/routes/post.routes.ts) (Post routes), [`tcb-backend/src/auth/services/token.service.ts`](https://github.com/raja7744/the-corporate-blog/blob/main/tcb-backend/src/auth/services/token.service.ts) (Token service), [`tcb-backend/src/auth/controllers/auth.controller.ts`](https://github.com/raja7744/the-corporate-blog/blob/main/tcb-backend/src/auth/controllers/auth.controller.ts) (Authentication handlers)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web application"]
  node_dashboard["Author dashboard<br/>[page.tsx]"]
  node_editor["Post editor<br/>[PostEditor.tsx]"]
  node_public_pages["Public blog pages<br/>[page.tsx]"]
  node_search_page["Search page<br/>[page.tsx]"]
end

subgraph group_identity["Identity and access"]
  node_auth_routes["Authentication routes<br/>[auth.routes.ts]"]
  node_auth_controller["Authentication handlers<br/>[auth.controller.ts]"]
  node_auth_service["Account service<br/>[auth.service.ts]"]
  node_token_service["Token service<br/>[token.service.ts]"]
  node_auth_middleware["Authentication checks<br/>[authenticate.ts]"]
end

subgraph group_content["Content management"]
  node_post_routes["Post routes<br/>[post.routes.ts]"]
  node_post_controller["Post handlers<br/>[post.controller.ts]"]
  node_post_service["Post service<br/>[post.service.ts]"]
  node_publish_controller["Publishing handlers"]
  node_publish_service["Publishing service<br/>[publish.service.ts]"]
  node_image_routes["Image routes<br/>[image.routes.ts]"]
  node_image_controller["Image handlers"]
  node_image_service["Image service<br/>[image.service.ts]"]
end

subgraph group_discovery["Reader discovery"]
  node_search_routes["Search routes<br/>[search.routes.ts]"]
  node_search_controller["Search handlers"]
  node_search_service["Search and discovery<br/>[search.service.ts]"]
  node_seo["SEO and sitemap<br/>[sitemap.routes.ts]"]
end

subgraph group_platform["Backend platform"]
  node_database[("Application database<br/>[prisma.ts]")]
  node_cache[("Search cache<br/>[cache.ts]")]
  node_error_handler["Error handling<br/>[errorHandler.ts]"]
  node_metrics["Health metrics"]
end

node_writer(("Writer or editor"))
node_reader(("Public reader"))

node_writer -.->|"manages posts"| node_dashboard
node_dashboard -.->|"opens editor"| node_editor
node_reader -.->|"reads content"| node_public_pages
node_reader -.->|"searches content"| node_search_page
node_auth_routes -->|"routes requests"| node_auth_controller
node_auth_controller -->|"registers or logs in"| node_auth_service
node_auth_controller -->|"rotates or revokes"| node_token_service
node_auth_service -->|"issues tokens"| node_token_service
node_auth_service -->|"reads and writes users"| node_database
node_token_service -->|"stores refresh tokens"| node_database
node_auth_middleware -->|"verifies token"| node_token_service
node_auth_middleware -->|"checks user"| node_database
node_post_routes -->|"routes requests"| node_post_controller
node_post_routes -->|"routes publishing"| node_publish_controller
node_post_controller -->|"manages posts"| node_post_service
node_publish_controller -->|"handles publishing"| node_publish_service
node_post_service -->|"reads and writes posts"| node_database
node_image_routes -->|"routes requests"| node_image_controller
node_image_controller -->|"handles images"| node_image_service
node_image_service -->|"uses persistence"| node_database
node_search_routes -->|"routes requests"| node_search_controller
node_search_controller -->|"searches or retrieves"| node_search_service
node_search_service -->|"queries posts and logs"| node_database
node_search_service -->|"caches popular posts"| node_cache
node_seo -->|"reads sitemap data"| node_database
node_metrics -->|"checks database health"| node_database
node_error_handler -.->|"reports exceptions"| node_database
node_editor -.->|"submits post data"| node_post_routes
node_public_pages -.->|"loads published posts"| node_post_routes
node_search_page -.->|"submits searches"| node_search_routes

click node_dashboard "https://github.com/raja7744/the-corporate-blog/blob/main/tcb-frontend/src/app/(dashboard)/dashboard/posts/page.tsx"
click node_editor "https://github.com/raja7744/the-corporate-blog/blob/main/tcb-frontend/src/components/editor/PostEditor.tsx"
click node_public_pages "https://github.com/raja7744/the-corporate-blog/blob/main/tcb-frontend/src/app/(public)/blog/%5Bslug%5D/page.tsx"
click node_search_page "https://github.com/raja7744/the-corporate-blog/blob/main/tcb-frontend/src/app/(public)/search/page.tsx"
click node_auth_routes "https://github.com/raja7744/the-corporate-blog/blob/main/tcb-backend/src/auth/routes/auth.routes.ts"
click node_auth_controller "https://github.com/raja7744/the-corporate-blog/blob/main/tcb-backend/src/auth/controllers/auth.controller.ts"
click node_auth_service "https://github.com/raja7744/the-corporate-blog/blob/main/tcb-backend/src/auth/services/auth.service.ts"
click node_token_service "https://github.com/raja7744/the-corporate-blog/blob/main/tcb-backend/src/auth/services/token.service.ts"
click node_auth_middleware "https://github.com/raja7744/the-corporate-blog/blob/main/tcb-backend/src/auth/middleware/authenticate.ts"
click node_post_routes "https://github.com/raja7744/the-corporate-blog/blob/main/tcb-backend/src/posts/routes/post.routes.ts"
click node_post_controller "https://github.com/raja7744/the-corporate-blog/blob/main/tcb-backend/src/posts/controllers/post.controller.ts"
click node_post_service "https://github.com/raja7744/the-corporate-blog/blob/main/tcb-backend/src/posts/services/post.service.ts"
click node_publish_controller "https://github.com/raja7744/the-corporate-blog/blob/main/tcb-backend/src/posts/controllers/publish.controller.ts"
click node_publish_service "https://github.com/raja7744/the-corporate-blog/blob/main/tcb-backend/src/posts/services/publish.service.ts"
click node_image_routes "https://github.com/raja7744/the-corporate-blog/blob/main/tcb-backend/src/images/routes/image.routes.ts"
click node_image_controller "https://github.com/raja7744/the-corporate-blog/blob/main/tcb-backend/src/images/controllers/image.controller.ts"
click node_image_service "https://github.com/raja7744/the-corporate-blog/blob/main/tcb-backend/src/images/services/image.service.ts"
click node_search_routes "https://github.com/raja7744/the-corporate-blog/blob/main/tcb-backend/src/search/routes/search.routes.ts"
click node_search_controller "https://github.com/raja7744/the-corporate-blog/blob/main/tcb-backend/src/search/controllers/search.controller.ts"
click node_search_service "https://github.com/raja7744/the-corporate-blog/blob/main/tcb-backend/src/search/services/search.service.ts"
click node_seo "https://github.com/raja7744/the-corporate-blog/blob/main/tcb-backend/src/seo/routes/sitemap.routes.ts"
click node_database "https://github.com/raja7744/the-corporate-blog/blob/main/tcb-backend/src/lib/prisma.ts"
click node_cache "https://github.com/raja7744/the-corporate-blog/blob/main/tcb-backend/src/lib/cache.ts"
click node_error_handler "https://github.com/raja7744/the-corporate-blog/blob/main/tcb-backend/src/middleware/errorHandler.ts"
click node_metrics "https://github.com/raja7744/the-corporate-blog/blob/main/tcb-backend/src/metrics.controller.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_dashboard,node_editor,node_public_pages,node_search_page toneBlue
class node_auth_routes,node_auth_controller,node_auth_service,node_token_service,node_auth_middleware toneAmber
class node_post_routes,node_post_controller,node_post_service,node_publish_controller,node_publish_service,node_image_routes,node_image_controller,node_image_service toneMint
class node_search_routes,node_search_controller,node_search_service,node_seo toneRose
class node_database,node_cache,node_error_handler,node_metrics,node_writer,node_reader toneIndigo
```

## Components

### Web application

- [Author dashboard](https://github.com/raja7744/the-corporate-blog/blob/main/tcb-frontend/src/app/(dashboard)/dashboard/posts/page.tsx): `tcb-frontend/src/app/(dashboard)/dashboard/posts/page.tsx`
- [Post editor](https://github.com/raja7744/the-corporate-blog/blob/main/tcb-frontend/src/components/editor/PostEditor.tsx): `tcb-frontend/src/components/editor/PostEditor.tsx`
- [Public blog pages](https://github.com/raja7744/the-corporate-blog/blob/main/tcb-frontend/src/app/(public)/blog/%5Bslug%5D/page.tsx): `tcb-frontend/src/app/(public)/blog/[slug]/page.tsx`
- [Search page](https://github.com/raja7744/the-corporate-blog/blob/main/tcb-frontend/src/app/(public)/search/page.tsx): `tcb-frontend/src/app/(public)/search/page.tsx`

### Identity and access

- [Authentication routes](https://github.com/raja7744/the-corporate-blog/blob/main/tcb-backend/src/auth/routes/auth.routes.ts): `tcb-backend/src/auth/routes/auth.routes.ts`
- [Authentication handlers](https://github.com/raja7744/the-corporate-blog/blob/main/tcb-backend/src/auth/controllers/auth.controller.ts): `tcb-backend/src/auth/controllers/auth.controller.ts`
- [Account service](https://github.com/raja7744/the-corporate-blog/blob/main/tcb-backend/src/auth/services/auth.service.ts): `tcb-backend/src/auth/services/auth.service.ts`
- [Token service](https://github.com/raja7744/the-corporate-blog/blob/main/tcb-backend/src/auth/services/token.service.ts): `tcb-backend/src/auth/services/token.service.ts`
- [Authentication checks](https://github.com/raja7744/the-corporate-blog/blob/main/tcb-backend/src/auth/middleware/authenticate.ts): `tcb-backend/src/auth/middleware/authenticate.ts`

### Content management

- [Post routes](https://github.com/raja7744/the-corporate-blog/blob/main/tcb-backend/src/posts/routes/post.routes.ts): `tcb-backend/src/posts/routes/post.routes.ts`
- [Post handlers](https://github.com/raja7744/the-corporate-blog/blob/main/tcb-backend/src/posts/controllers/post.controller.ts): `tcb-backend/src/posts/controllers/post.controller.ts`
- [Post service](https://github.com/raja7744/the-corporate-blog/blob/main/tcb-backend/src/posts/services/post.service.ts): `tcb-backend/src/posts/services/post.service.ts`
- [Publishing handlers](https://github.com/raja7744/the-corporate-blog/blob/main/tcb-backend/src/posts/controllers/publish.controller.ts): `tcb-backend/src/posts/controllers/publish.controller.ts`
- [Publishing service](https://github.com/raja7744/the-corporate-blog/blob/main/tcb-backend/src/posts/services/publish.service.ts): `tcb-backend/src/posts/services/publish.service.ts`
- [Image routes](https://github.com/raja7744/the-corporate-blog/blob/main/tcb-backend/src/images/routes/image.routes.ts): `tcb-backend/src/images/routes/image.routes.ts`
- [Image handlers](https://github.com/raja7744/the-corporate-blog/blob/main/tcb-backend/src/images/controllers/image.controller.ts): `tcb-backend/src/images/controllers/image.controller.ts`
- [Image service](https://github.com/raja7744/the-corporate-blog/blob/main/tcb-backend/src/images/services/image.service.ts): `tcb-backend/src/images/services/image.service.ts`

### Reader discovery

- [Search routes](https://github.com/raja7744/the-corporate-blog/blob/main/tcb-backend/src/search/routes/search.routes.ts): `tcb-backend/src/search/routes/search.routes.ts`
- [Search handlers](https://github.com/raja7744/the-corporate-blog/blob/main/tcb-backend/src/search/controllers/search.controller.ts): `tcb-backend/src/search/controllers/search.controller.ts`
- [Search and discovery](https://github.com/raja7744/the-corporate-blog/blob/main/tcb-backend/src/search/services/search.service.ts): `tcb-backend/src/search/services/search.service.ts`
- [SEO and sitemap](https://github.com/raja7744/the-corporate-blog/blob/main/tcb-backend/src/seo/routes/sitemap.routes.ts): `tcb-backend/src/seo/routes/sitemap.routes.ts`

### Backend platform

- [Application database](https://github.com/raja7744/the-corporate-blog/blob/main/tcb-backend/src/lib/prisma.ts): `tcb-backend/src/lib/prisma.ts`
- [Search cache](https://github.com/raja7744/the-corporate-blog/blob/main/tcb-backend/src/lib/cache.ts): `tcb-backend/src/lib/cache.ts`
- [Error handling](https://github.com/raja7744/the-corporate-blog/blob/main/tcb-backend/src/middleware/errorHandler.ts): `tcb-backend/src/middleware/errorHandler.ts`
- [Health metrics](https://github.com/raja7744/the-corporate-blog/blob/main/tcb-backend/src/metrics.controller.ts): `tcb-backend/src/metrics.controller.ts`

### Other components

- **Writer or editor**
- **Public reader**

## Connections

- Writer or editor → Author dashboard: manages posts
- Author dashboard → Post editor: opens editor
- Public reader → Public blog pages: reads content
- Public reader → Search page: searches content
- Authentication routes → Authentication handlers: routes requests (evidence: `tcb-backend/src/auth/routes/auth.routes.ts`)
- Authentication handlers → Account service: registers or logs in (evidence: `tcb-backend/src/auth/controllers/auth.controller.ts`)
- Authentication handlers → Token service: rotates or revokes (evidence: `tcb-backend/src/auth/controllers/auth.controller.ts`)
- Account service → Token service: issues tokens (evidence: `tcb-backend/src/auth/services/auth.service.ts`)
- Account service → Application database: reads and writes users (evidence: `tcb-backend/src/auth/services/auth.service.ts`)
- Token service → Application database: stores refresh tokens (evidence: `tcb-backend/src/auth/services/token.service.ts`)
- Authentication checks → Token service: verifies token (evidence: `tcb-backend/src/auth/middleware/authenticate.ts`)
- Authentication checks → Application database: checks user (evidence: `tcb-backend/src/auth/middleware/authenticate.ts`)
- Post routes → Post handlers: routes requests (evidence: `tcb-backend/src/posts/routes/post.routes.ts`)
- Post routes → Publishing handlers: routes publishing (evidence: `tcb-backend/src/posts/routes/post.routes.ts`)
- Post handlers → Post service: manages posts (evidence: `tcb-backend/src/posts/controllers/post.controller.ts`)
- Publishing handlers → Publishing service: handles publishing (evidence: `tcb-backend/src/posts/controllers/publish.controller.ts`)
- Post service → Application database: reads and writes posts (evidence: `tcb-backend/src/posts/services/post.service.ts`)
- Image routes → Image handlers: routes requests (evidence: `tcb-backend/src/images/routes/image.routes.ts`)
- Image handlers → Image service: handles images (evidence: `tcb-backend/src/images/controllers/image.controller.ts`)
- Image service → Application database: uses persistence (evidence: `tcb-backend/src/images/services/image.service.ts`)
- Search routes → Search handlers: routes requests (evidence: `tcb-backend/src/search/routes/search.routes.ts`)
- Search handlers → Search and discovery: searches or retrieves (evidence: `tcb-backend/src/search/controllers/search.controller.ts`)
- Search and discovery → Application database: queries posts and logs (evidence: `tcb-backend/src/search/services/search.service.ts`)
- Search and discovery → Search cache: caches popular posts (evidence: `tcb-backend/src/search/services/search.service.ts`)
- SEO and sitemap → Application database: reads sitemap data (evidence: `tcb-backend/src/seo/routes/sitemap.routes.ts`)
- Health metrics → Application database: checks database health (evidence: `tcb-backend/src/metrics.controller.ts`)
- Error handling → Application database: reports exceptions
- Post editor → Post routes: submits post data
- Public blog pages → Post routes: loads published posts
- Search page → Search routes: submits searches
