# bhardwajtanuj/rival-blog-platform architecture

> Architecture diagram of the GitHub repository bhardwajtanuj/rival-blog-platform, 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/bhardwajtanuj/rival-blog-platform
- Repository: https://github.com/bhardwajtanuj/rival-blog-platform

## Overview

Rival Blog is a blogging platform: users register or log in, create and manage posts, publish them to a public feed, and engage through likes and comments. The NestJS backend separates route controllers from domain services, with Prisma providing database access. The README also describes Cortex summaries, optional Redis-backed summary jobs, and rate limiting, but those implementations are not present in the supplied tree; they are shown as documented capabilities without asserting internal wiring.

Main entry points: [`frontend`](https://github.com/bhardwajtanuj/rival-blog-platform/tree/main/frontend) (Web client), [`backend/src/prisma/prisma.service.ts`](https://github.com/bhardwajtanuj/rival-blog-platform/blob/main/backend/src/prisma/prisma.service.ts) (Prisma access), [`backend/src/posts/posts.controller.ts`](https://github.com/bhardwajtanuj/rival-blog-platform/blob/main/backend/src/posts/posts.controller.ts) (Post routes), [`backend/prisma/schema.prisma`](https://github.com/bhardwajtanuj/rival-blog-platform/blob/main/backend/prisma/schema.prisma) (PostgreSQL)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["User interface"]
  node_web["Web client"]
  node_app["Nest application<br/>[app.module.ts]"]
  node_ratelimit["Rate limiting"]
end

subgraph group_identity["Identity"]
  node_authapi["Auth routes<br/>[auth.controller.ts]"]
  node_authlogic["Auth service<br/>[auth.service.ts]"]
  node_jwtguard["JWT guard<br/>[jwt-auth.guard.ts]"]
end

subgraph group_content["Blog content"]
  node_postsapi["Post routes"]
  node_postlogic["Post service<br/>[posts.service.ts]"]
  node_publicfeed["Public feed"]
  node_summaries["AI summaries"]
end

subgraph group_engagement["Engagement"]
  node_comments["Comments"]
  node_likes["Likes<br/>[likes.service.ts]"]
end

subgraph group_storage["Persistence and infrastructure"]
  node_prisma["Prisma access<br/>[prisma.service.ts]"]
  node_database[("PostgreSQL<br/>[schema.prisma]")]
  node_jobs["Async summary jobs"]
end

node_reader(("User"))
node_cortex{{"Cortex API"}}
node_redis[("Redis")]

node_reader -->|"uses"| node_web
node_web -->|"registers or logs in"| node_authapi
node_web -->|"manages posts"| node_postsapi
node_web -->|"views feed"| node_publicfeed
node_web -->|"adds comments"| node_comments
node_web -->|"likes posts"| node_likes
node_app -->|"registers"| node_authapi
node_app -->|"registers"| node_postsapi
node_app -->|"loads module"| node_prisma
node_authapi -->|"delegates to"| node_authlogic
node_authlogic -->|"queries users"| node_prisma
node_authlogic -->|"reads and creates users"| node_database
node_postsapi -->|"delegates to"| node_postlogic
node_postsapi -->|"requires authentication"| node_jwtguard
node_postlogic -->|"uses"| node_prisma
node_postlogic -->|"reads and writes posts"| node_database
node_publicfeed -->|"queries public posts"| node_prisma
node_comments -->|"uses"| node_prisma
node_comments -->|"reads and writes comments"| node_database
node_likes -->|"uses"| node_prisma
node_prisma -->|"connects to"| node_database
node_web -.->|"shows summaries"| node_summaries
node_summaries -.->|"uses integration"| node_cortex
node_summaries -.->|"queues work"| node_jobs
node_jobs -.->|"may use"| node_redis
node_web -.->|"can trigger limits"| node_ratelimit

click node_web "https://github.com/bhardwajtanuj/rival-blog-platform/tree/main/frontend"
click node_app "https://github.com/bhardwajtanuj/rival-blog-platform/blob/main/backend/src/app.module.ts"
click node_authapi "https://github.com/bhardwajtanuj/rival-blog-platform/blob/main/backend/src/auth/auth.controller.ts"
click node_authlogic "https://github.com/bhardwajtanuj/rival-blog-platform/blob/main/backend/src/auth/auth.service.ts"
click node_jwtguard "https://github.com/bhardwajtanuj/rival-blog-platform/blob/main/backend/src/common/guards/jwt-auth.guard.ts"
click node_postsapi "https://github.com/bhardwajtanuj/rival-blog-platform/blob/main/backend/src/posts/posts.controller.ts"
click node_postlogic "https://github.com/bhardwajtanuj/rival-blog-platform/blob/main/backend/src/posts/posts.service.ts"
click node_publicfeed "https://github.com/bhardwajtanuj/rival-blog-platform/blob/main/backend/src/public/public.controller.ts"
click node_comments "https://github.com/bhardwajtanuj/rival-blog-platform/blob/main/backend/src/comments/comments.service.ts"
click node_likes "https://github.com/bhardwajtanuj/rival-blog-platform/blob/main/backend/src/likes/likes.service.ts"
click node_prisma "https://github.com/bhardwajtanuj/rival-blog-platform/blob/main/backend/src/prisma/prisma.service.ts"
click node_database "https://github.com/bhardwajtanuj/rival-blog-platform/blob/main/backend/prisma/schema.prisma"
click node_summaries "https://github.com/bhardwajtanuj/rival-blog-platform/tree/main/backend/src"
click node_jobs "https://github.com/bhardwajtanuj/rival-blog-platform/tree/main/backend/src"
click node_ratelimit "https://github.com/bhardwajtanuj/rival-blog-platform/tree/main/backend/src"

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_web,node_app,node_ratelimit,node_reader toneBlue
class node_authapi,node_authlogic,node_jwtguard,node_redis toneAmber
class node_postsapi,node_postlogic,node_publicfeed,node_summaries,node_cortex toneMint
class node_comments,node_likes toneRose
class node_prisma,node_database,node_jobs toneIndigo
```

## Components

### User interface

- [Web client](https://github.com/bhardwajtanuj/rival-blog-platform/tree/main/frontend): `frontend`
- [Nest application](https://github.com/bhardwajtanuj/rival-blog-platform/blob/main/backend/src/app.module.ts): `backend/src/app.module.ts`
- [Rate limiting](https://github.com/bhardwajtanuj/rival-blog-platform/tree/main/backend/src): `backend/src`

### Identity

- [Auth routes](https://github.com/bhardwajtanuj/rival-blog-platform/blob/main/backend/src/auth/auth.controller.ts): `backend/src/auth/auth.controller.ts`
- [Auth service](https://github.com/bhardwajtanuj/rival-blog-platform/blob/main/backend/src/auth/auth.service.ts): `backend/src/auth/auth.service.ts`
- [JWT guard](https://github.com/bhardwajtanuj/rival-blog-platform/blob/main/backend/src/common/guards/jwt-auth.guard.ts): `backend/src/common/guards/jwt-auth.guard.ts`

### Blog content

- [Post routes](https://github.com/bhardwajtanuj/rival-blog-platform/blob/main/backend/src/posts/posts.controller.ts): `backend/src/posts/posts.controller.ts`
- [Post service](https://github.com/bhardwajtanuj/rival-blog-platform/blob/main/backend/src/posts/posts.service.ts): `backend/src/posts/posts.service.ts`
- [Public feed](https://github.com/bhardwajtanuj/rival-blog-platform/blob/main/backend/src/public/public.controller.ts): `backend/src/public/public.controller.ts`
- [AI summaries](https://github.com/bhardwajtanuj/rival-blog-platform/tree/main/backend/src): `backend/src`

### Engagement

- [Comments](https://github.com/bhardwajtanuj/rival-blog-platform/blob/main/backend/src/comments/comments.service.ts): `backend/src/comments/comments.service.ts`
- [Likes](https://github.com/bhardwajtanuj/rival-blog-platform/blob/main/backend/src/likes/likes.service.ts): `backend/src/likes/likes.service.ts`

### Persistence and infrastructure

- [Prisma access](https://github.com/bhardwajtanuj/rival-blog-platform/blob/main/backend/src/prisma/prisma.service.ts): `backend/src/prisma/prisma.service.ts`
- [PostgreSQL](https://github.com/bhardwajtanuj/rival-blog-platform/blob/main/backend/prisma/schema.prisma): `backend/prisma/schema.prisma`
- [Async summary jobs](https://github.com/bhardwajtanuj/rival-blog-platform/tree/main/backend/src): `backend/src`

### Other components

- **User**
- **Cortex API**
- **Redis**

## Connections

- User → Web client: uses (evidence: `README.md`)
- Web client → Auth routes: registers or logs in (evidence: `README.md`)
- Web client → Post routes: manages posts (evidence: `README.md`)
- Web client → Public feed: views feed (evidence: `README.md`)
- Web client → Comments: adds comments (evidence: `README.md`)
- Web client → Likes: likes posts (evidence: `README.md`)
- Nest application → Auth routes: registers (evidence: `backend/src/app.module.ts`)
- Nest application → Post routes: registers (evidence: `backend/src/app.module.ts`)
- Nest application → Prisma access: loads module (evidence: `backend/src/app.module.ts`)
- Auth routes → Auth service: delegates to (evidence: `backend/src/auth/auth.controller.ts`)
- Auth service → Prisma access: queries users (evidence: `backend/src/auth/auth.service.ts`)
- Auth service → PostgreSQL: reads and creates users (evidence: `backend/src/auth/auth.service.ts`)
- Post routes → Post service: delegates to (evidence: `backend/src/posts/posts.controller.ts`)
- Post routes → JWT guard: requires authentication (evidence: `backend/src/posts/posts.controller.ts`)
- Post service → Prisma access: uses (evidence: `backend/src/posts/posts.service.ts`)
- Post service → PostgreSQL: reads and writes posts (evidence: `backend/src/posts/posts.service.ts`)
- Public feed → Prisma access: queries public posts (evidence: `backend/src/public/public.controller.ts`)
- Comments → Prisma access: uses (evidence: `backend/src/comments/comments.service.ts`)
- Comments → PostgreSQL: reads and writes comments (evidence: `backend/src/comments/comments.service.ts`)
- Likes → Prisma access: uses (evidence: `backend/src/likes/likes.service.ts`)
- Prisma access → PostgreSQL: connects to (evidence: `backend/src/prisma/prisma.service.ts`)
- Web client → AI summaries: shows summaries (evidence: `README.md`)
- AI summaries → Cortex API: uses integration (evidence: `README.md`)
- AI summaries → Async summary jobs: queues work (evidence: `README.md`)
- Async summary jobs → Redis: may use (evidence: `README.md`)
- Web client → Rate limiting: can trigger limits (evidence: `README.md`)
