# tejuingalagi/blog-management-system architecture

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

- Interactive diagram: https://gitdiagram.com/tejuingalagi/blog-management-system
- Repository: https://github.com/tejuingalagi/blog-management-system

## Overview

This is a Spring Boot REST backend for secure blog publishing and interaction. The main workflow runs from a client request through JWT filtering and a REST controller into service logic and persistent blog, user, comment, or like data; controllers shape responses for the client. Separate flows support signup/signin and token issuance, profile management, and optional Cloudinary image updates. The README documents role-based authorization and stateless security; sampled source confirms token utilities, filtering, and user lookup, but the security configuration and several service implementations were not sampled, so those internal links are kept conservative.

Main entry points: [`src/main/java/com/blog/utils/JwtRequestFilter.java`](https://github.com/tejuingalagi/blog-management-system/blob/main/src/main/java/com/blog/utils/JwtRequestFilter.java) (JWT Filter), [`src/main/java/com/blog/rest/UserController.java`](https://github.com/tejuingalagi/blog-management-system/blob/main/src/main/java/com/blog/rest/UserController.java) (User API), [`src/main/java/com/blog/rest/CommentController.java`](https://github.com/tejuingalagi/blog-management-system/blob/main/src/main/java/com/blog/rest/CommentController.java) (Comment API), [`src/main/java/com/blog/rest/LikeController.java`](https://github.com/tejuingalagi/blog-management-system/blob/main/src/main/java/com/blog/rest/LikeController.java) (Like API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["REST API"]
  node_blog_api["Blog API"]
  node_comment_api["Comment API"]
  node_like_api["Like API"]
  node_user_api["User API"]
  node_exception_handler["Error Handler"]
end

subgraph group_services["Domain Services"]
  node_blog_service["Blog Service"]
  node_comment_service["Comment Service"]
  node_like_service["Like Service"]
  node_user_service["User Service"]
  node_cloudinary_service["Image Service"]
end

subgraph group_security["Authentication"]
  node_jwt_filter["JWT Filter"]
  node_jwt_util["JWT Utility<br/>[JwtUtil.java]"]
  node_user_details_service["User Lookup"]
  node_user_details["Security User"]
  node_password_encoder["Password Encoder"]
end

subgraph group_persistence["Persistence"]
  node_blog_repo["Blog Repository"]
  node_comment_repo["Comment Repository"]
  node_like_repo["Like Repository"]
  node_user_repo["User Repository"]
end

subgraph group_integrations["External Integrations"]
  node_mysql[("MySQL Database")]
  node_cloudinary["Cloudinary"]
end

node_client(("API Client"))

node_client -->|"sends requests"| node_jwt_filter
node_jwt_filter -->|"validates tokens"| node_jwt_util
node_jwt_filter -->|"loads identity"| node_user_details_service
node_user_details_service -->|"looks up email"| node_user_repo
node_user_details_service -->|"wraps user"| node_user_details
node_jwt_filter -->|"passes authenticated requests"| node_blog_api
node_jwt_filter -->|"passes authenticated requests"| node_comment_api
node_jwt_filter -->|"passes authenticated requests"| node_like_api
node_jwt_filter -->|"passes authenticated requests"| node_user_api
node_client -->|"requests blog APIs"| node_blog_api
node_client -->|"requests comments"| node_comment_api
node_client -->|"requests likes"| node_like_api
node_client -->|"requests account APIs"| node_user_api
node_blog_api -->|"manages and searches"| node_blog_service
node_blog_api -->|"checks liked state"| node_like_service
node_comment_api -->|"creates and lists"| node_comment_service
node_comment_api -->|"finds target blog"| node_blog_service
node_comment_api -->|"finds commenter"| node_user_service
node_like_api -->|"creates and queries"| node_like_service
node_like_api -->|"finds target blog"| node_blog_service
node_like_api -->|"finds liker"| node_user_service
node_user_api -->|"manages accounts"| node_user_service
node_user_api -->|"issues tokens"| node_jwt_util
node_user_api -->|"encodes passwords"| node_password_encoder
node_user_api -.->|"updates profile images"| node_cloudinary_service
node_blog_service -->|"queries and saves"| node_blog_repo
node_comment_service -->|"queries and saves"| node_comment_repo
node_like_service -->|"queries and saves"| node_like_repo
node_user_service -->|"queries and saves"| node_user_repo
node_blog_repo -->|"persists blog data"| node_mysql
node_comment_repo -->|"persists comment data"| node_mysql
node_like_repo -->|"persists like data"| node_mysql
node_user_repo -->|"persists user data"| node_mysql
node_cloudinary_service -.->|"uploads and deletes"| node_cloudinary
node_blog_api -->|"raises API errors"| node_exception_handler
node_comment_api -->|"raises API errors"| node_exception_handler
node_like_api -->|"raises API errors"| node_exception_handler
node_user_api -->|"raises API errors"| node_exception_handler

click node_blog_api "https://github.com/tejuingalagi/blog-management-system/blob/main/src/main/java/com/blog/rest/BlogController.java"
click node_comment_api "https://github.com/tejuingalagi/blog-management-system/blob/main/src/main/java/com/blog/rest/CommentController.java"
click node_like_api "https://github.com/tejuingalagi/blog-management-system/blob/main/src/main/java/com/blog/rest/LikeController.java"
click node_user_api "https://github.com/tejuingalagi/blog-management-system/blob/main/src/main/java/com/blog/rest/UserController.java"
click node_exception_handler "https://github.com/tejuingalagi/blog-management-system/blob/main/src/main/java/com/blog/exception/GlobalExceptionHandler.java"
click node_blog_service "https://github.com/tejuingalagi/blog-management-system/blob/main/src/main/java/com/blog/service/impl/BlogServiceImpl.java"
click node_comment_service "https://github.com/tejuingalagi/blog-management-system/blob/main/src/main/java/com/blog/service/impl/CommentServiceImpl.java"
click node_like_service "https://github.com/tejuingalagi/blog-management-system/blob/main/src/main/java/com/blog/service/impl/LikeServiceImpl.java"
click node_user_service "https://github.com/tejuingalagi/blog-management-system/blob/main/src/main/java/com/blog/service/impl/UserServiceImpl.java"
click node_cloudinary_service "https://github.com/tejuingalagi/blog-management-system/blob/main/src/main/java/com/blog/service/impl/ClodinaryServiceImpl.java"
click node_jwt_filter "https://github.com/tejuingalagi/blog-management-system/blob/main/src/main/java/com/blog/utils/JwtRequestFilter.java"
click node_jwt_util "https://github.com/tejuingalagi/blog-management-system/blob/main/src/main/java/com/blog/utils/JwtUtil.java"
click node_user_details_service "https://github.com/tejuingalagi/blog-management-system/blob/main/src/main/java/com/blog/service/CustomUserDetailsService.java"
click node_user_details "https://github.com/tejuingalagi/blog-management-system/blob/main/src/main/java/com/blog/service/CustomUserDetails.java"
click node_blog_repo "https://github.com/tejuingalagi/blog-management-system/blob/main/src/main/java/com/blog/repo/BlogRepository.java"
click node_comment_repo "https://github.com/tejuingalagi/blog-management-system/blob/main/src/main/java/com/blog/repo/CommentRepository.java"
click node_like_repo "https://github.com/tejuingalagi/blog-management-system/blob/main/src/main/java/com/blog/repo/LikeRepository.java"
click node_user_repo "https://github.com/tejuingalagi/blog-management-system/blob/main/src/main/java/com/blog/repo/UserRepository.java"

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_blog_api,node_comment_api,node_like_api,node_user_api,node_exception_handler,node_client toneBlue
class node_blog_service,node_comment_service,node_like_service,node_user_service,node_cloudinary_service toneAmber
class node_jwt_filter,node_jwt_util,node_user_details_service,node_user_details,node_password_encoder toneMint
class node_blog_repo,node_comment_repo,node_like_repo,node_user_repo toneRose
class node_mysql,node_cloudinary toneIndigo
```

## Components

### REST API

- [Blog API](https://github.com/tejuingalagi/blog-management-system/blob/main/src/main/java/com/blog/rest/BlogController.java): `src/main/java/com/blog/rest/BlogController.java`
- [Comment API](https://github.com/tejuingalagi/blog-management-system/blob/main/src/main/java/com/blog/rest/CommentController.java): `src/main/java/com/blog/rest/CommentController.java`
- [Like API](https://github.com/tejuingalagi/blog-management-system/blob/main/src/main/java/com/blog/rest/LikeController.java): `src/main/java/com/blog/rest/LikeController.java`
- [User API](https://github.com/tejuingalagi/blog-management-system/blob/main/src/main/java/com/blog/rest/UserController.java): `src/main/java/com/blog/rest/UserController.java`
- [Error Handler](https://github.com/tejuingalagi/blog-management-system/blob/main/src/main/java/com/blog/exception/GlobalExceptionHandler.java): `src/main/java/com/blog/exception/GlobalExceptionHandler.java`

### Domain Services

- [Blog Service](https://github.com/tejuingalagi/blog-management-system/blob/main/src/main/java/com/blog/service/impl/BlogServiceImpl.java): `src/main/java/com/blog/service/impl/BlogServiceImpl.java`
- [Comment Service](https://github.com/tejuingalagi/blog-management-system/blob/main/src/main/java/com/blog/service/impl/CommentServiceImpl.java): `src/main/java/com/blog/service/impl/CommentServiceImpl.java`
- [Like Service](https://github.com/tejuingalagi/blog-management-system/blob/main/src/main/java/com/blog/service/impl/LikeServiceImpl.java): `src/main/java/com/blog/service/impl/LikeServiceImpl.java`
- [User Service](https://github.com/tejuingalagi/blog-management-system/blob/main/src/main/java/com/blog/service/impl/UserServiceImpl.java): `src/main/java/com/blog/service/impl/UserServiceImpl.java`
- [Image Service](https://github.com/tejuingalagi/blog-management-system/blob/main/src/main/java/com/blog/service/impl/ClodinaryServiceImpl.java): `src/main/java/com/blog/service/impl/ClodinaryServiceImpl.java`

### Authentication

- [JWT Filter](https://github.com/tejuingalagi/blog-management-system/blob/main/src/main/java/com/blog/utils/JwtRequestFilter.java): `src/main/java/com/blog/utils/JwtRequestFilter.java`
- [JWT Utility](https://github.com/tejuingalagi/blog-management-system/blob/main/src/main/java/com/blog/utils/JwtUtil.java): `src/main/java/com/blog/utils/JwtUtil.java`
- [User Lookup](https://github.com/tejuingalagi/blog-management-system/blob/main/src/main/java/com/blog/service/CustomUserDetailsService.java): `src/main/java/com/blog/service/CustomUserDetailsService.java`
- [Security User](https://github.com/tejuingalagi/blog-management-system/blob/main/src/main/java/com/blog/service/CustomUserDetails.java): `src/main/java/com/blog/service/CustomUserDetails.java`
- **Password Encoder**

### Persistence

- [Blog Repository](https://github.com/tejuingalagi/blog-management-system/blob/main/src/main/java/com/blog/repo/BlogRepository.java): `src/main/java/com/blog/repo/BlogRepository.java`
- [Comment Repository](https://github.com/tejuingalagi/blog-management-system/blob/main/src/main/java/com/blog/repo/CommentRepository.java): `src/main/java/com/blog/repo/CommentRepository.java`
- [Like Repository](https://github.com/tejuingalagi/blog-management-system/blob/main/src/main/java/com/blog/repo/LikeRepository.java): `src/main/java/com/blog/repo/LikeRepository.java`
- [User Repository](https://github.com/tejuingalagi/blog-management-system/blob/main/src/main/java/com/blog/repo/UserRepository.java): `src/main/java/com/blog/repo/UserRepository.java`

### External Integrations

- **MySQL Database**
- **Cloudinary**

### Other components

- **API Client**

## Connections

- API Client → JWT Filter: sends requests
- JWT Filter → JWT Utility: validates tokens
- JWT Filter → User Lookup: loads identity
- User Lookup → User Repository: looks up email
- User Lookup → Security User: wraps user
- JWT Filter → Blog API: passes authenticated requests
- JWT Filter → Comment API: passes authenticated requests
- JWT Filter → Like API: passes authenticated requests
- JWT Filter → User API: passes authenticated requests
- API Client → Blog API: requests blog APIs
- API Client → Comment API: requests comments
- API Client → Like API: requests likes
- API Client → User API: requests account APIs
- Blog API → Blog Service: manages and searches
- Blog API → Like Service: checks liked state
- Comment API → Comment Service: creates and lists
- Comment API → Blog Service: finds target blog
- Comment API → User Service: finds commenter
- Like API → Like Service: creates and queries
- Like API → Blog Service: finds target blog
- Like API → User Service: finds liker
- User API → User Service: manages accounts
- User API → JWT Utility: issues tokens
- User API → Password Encoder: encodes passwords
- User API → Image Service: updates profile images
- Blog Service → Blog Repository: queries and saves
- Comment Service → Comment Repository: queries and saves
- Like Service → Like Repository: queries and saves
- User Service → User Repository: queries and saves
- Blog Repository → MySQL Database: persists blog data
- Comment Repository → MySQL Database: persists comment data
- Like Repository → MySQL Database: persists like data
- User Repository → MySQL Database: persists user data
- Image Service → Cloudinary: uploads and deletes
- Blog API → Error Handler: raises API errors
- Comment API → Error Handler: raises API errors
- Like API → Error Handler: raises API errors
- User API → Error Handler: raises API errors
