# welikewatermelon/therapist_community_be architecture

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

- Interactive diagram: https://gitdiagram.com/welikewatermelon/therapist_community_be
- Repository: https://github.com/welikewatermelon/therapist_community_be

## Overview

MelonMe is a Spring Boot backend for a therapist-verified community. The main workflow is a user authenticating, creating or discovering posts, and interacting through comments, reactions, follows, and messages; post creation also triggers asynchronous embedding, AI-comment, and analytics work. Separate workflows cover therapist verification, knowledge ingestion, and real-time notifications. The README documents these connections and capabilities; sampled source confirms selected service-level interactions, but many subsystem internals were not excerpted, so those links rely on README evidence.

Main entry points: [`src/main/java/com/therapyCommunity_Vol1/backend/post/service/PostService.java`](https://github.com/welikewatermelon/therapist_community_be/blob/main/src/main/java/com/therapyCommunity_Vol1/backend/post/service/PostService.java) (Posts and feeds), [`src/main/java/com/therapyCommunity_Vol1/backend/autocomment/service`](https://github.com/welikewatermelon/therapist_community_be/tree/main/src/main/java/com/therapyCommunity_Vol1/backend/autocomment/service) (AI comment review), [`src/main/java/com/therapyCommunity_Vol1/backend/auth`](https://github.com/welikewatermelon/therapist_community_be/tree/main/src/main/java/com/therapyCommunity_Vol1/backend/auth) (Authentication), [`src/main/java/com/therapyCommunity_Vol1/backend/knowledge/service/KnowledgeIngestionService.java`](https://github.com/welikewatermelon/therapist_community_be/blob/main/src/main/java/com/therapyCommunity_Vol1/backend/knowledge/service/KnowledgeIngestionService.java) (Knowledge ingestion)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_identity["Identity and access"]
  node_auth["Authentication"]
  node_users["Profiles and roles<br/>[UserService.java]"]
  node_verification["Therapist verification"]
end

subgraph group_community["Community interactions"]
  node_comments["Comments"]
  node_reactions["Post and comment reactions"]
  node_social["Follows and scraps<br/>[FollowService.java]"]
  node_messages["Direct messages"]
  node_jobs["Job listings"]
end

subgraph group_content["Content and discovery"]
  node_posts["Posts and feeds<br/>[PostService.java]"]
  node_visibility["Visibility policy"]
  node_search["Post search"]
  node_uploads["Media uploads"]
  node_storage["File storage"]
end

subgraph group_ai["AI and knowledge"]
  node_knowledge["Knowledge ingestion"]
  node_autocomment["AI comment review"]
  node_embedding["Post embeddings"]
  node_gemini{{"Gemini services"}}
end

subgraph group_operations["Notifications and analytics"]
  node_notifications["SSE notifications"]
  node_analytics["Event analytics"]
  node_database[("PostgreSQL and pgvector")]
  node_redis[("Redis cache")]
  node_s3[("S3 or local files")]
end

node_members(("Members"))

node_members -->|"sign in"| node_auth
node_auth -->|"identifies"| node_users
node_auth -->|"checks login limits"| node_redis
node_members -->|"publish or browse"| node_posts
node_posts -->|"checks access"| node_visibility
node_visibility -->|"checks follower access"| node_social
node_posts -->|"persists posts"| node_database
node_members -->|"search posts"| node_search
node_search -->|"queries GIN or vectors"| node_database
node_posts -->|"emits embedding work"| node_embedding
node_embedding -->|"writes vectors"| node_database
node_members -->|"upload media"| node_uploads
node_uploads -->|"stores media"| node_storage
node_storage -.->|"stores objects"| node_s3
node_members -->|"comment"| node_comments
node_members -->|"react"| node_reactions
node_members -->|"follow or save"| node_social
node_members -->|"send messages"| node_messages
node_members -->|"browse listings"| node_jobs
node_members -->|"apply for verification"| node_verification
node_verification -->|"updates role"| node_users
node_posts -->|"requests AI comment"| node_autocomment
node_autocomment -->|"retrieves context"| node_knowledge
node_knowledge -->|"embeds chunks"| node_gemini
node_knowledge -->|"stores chunks"| node_database
node_autocomment -->|"generates draft"| node_gemini
node_autocomment -->|"registers approved reply"| node_comments
node_members -->|"subscribe to SSE"| node_notifications
node_comments -.->|"publishes alert event"| node_notifications
node_social -->|"publishes follow event"| node_notifications
node_posts -->|"publishes activity"| node_analytics
node_analytics -->|"stores and aggregates events"| node_database

click node_auth "https://github.com/welikewatermelon/therapist_community_be/tree/main/src/main/java/com/therapyCommunity_Vol1/backend/auth"
click node_users "https://github.com/welikewatermelon/therapist_community_be/blob/main/src/main/java/com/therapyCommunity_Vol1/backend/user/service/UserService.java"
click node_verification "https://github.com/welikewatermelon/therapist_community_be/tree/main/src/main/java/com/therapyCommunity_Vol1/backend/therapist"
click node_posts "https://github.com/welikewatermelon/therapist_community_be/blob/main/src/main/java/com/therapyCommunity_Vol1/backend/post/service/PostService.java"
click node_visibility "https://github.com/welikewatermelon/therapist_community_be/blob/main/src/main/java/com/therapyCommunity_Vol1/backend/post/service/PostVisibilityAccessPolicy.java"
click node_search "https://github.com/welikewatermelon/therapist_community_be/tree/main/src/main/java/com/therapyCommunity_Vol1/backend/post/service/search"
click node_uploads "https://github.com/welikewatermelon/therapist_community_be/tree/main/src/main/java/com/therapyCommunity_Vol1/backend/post/service/upload"
click node_storage "https://github.com/welikewatermelon/therapist_community_be/blob/main/src/main/java/com/therapyCommunity_Vol1/backend/file/service/FileStorageService.java"
click node_comments "https://github.com/welikewatermelon/therapist_community_be/blob/main/src/main/java/com/therapyCommunity_Vol1/backend/comment/service/CommentService.java"
click node_reactions "https://github.com/welikewatermelon/therapist_community_be/tree/main/src/main/java/com/therapyCommunity_Vol1/backend/reaction/service"
click node_social "https://github.com/welikewatermelon/therapist_community_be/blob/main/src/main/java/com/therapyCommunity_Vol1/backend/follow/service/FollowService.java"
click node_messages "https://github.com/welikewatermelon/therapist_community_be/blob/main/src/main/java/com/therapyCommunity_Vol1/backend/message/service/MessageService.java"
click node_jobs "https://github.com/welikewatermelon/therapist_community_be/tree/main/src/main/java/com/therapyCommunity_Vol1/backend/jobpost/service"
click node_knowledge "https://github.com/welikewatermelon/therapist_community_be/blob/main/src/main/java/com/therapyCommunity_Vol1/backend/knowledge/service/KnowledgeIngestionService.java"
click node_autocomment "https://github.com/welikewatermelon/therapist_community_be/tree/main/src/main/java/com/therapyCommunity_Vol1/backend/autocomment/service"
click node_embedding "https://github.com/welikewatermelon/therapist_community_be/blob/main/src/main/java/com/therapyCommunity_Vol1/backend/post/service/search/EmbeddingService.java"
click node_notifications "https://github.com/welikewatermelon/therapist_community_be/tree/main/src/main/java/com/therapyCommunity_Vol1/backend/notification"
click node_analytics "https://github.com/welikewatermelon/therapist_community_be/blob/main/src/main/java/com/therapyCommunity_Vol1/backend/analytics/event/UserEventPublisher.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_auth,node_users,node_verification toneBlue
class node_comments,node_reactions,node_social,node_messages,node_jobs toneAmber
class node_posts,node_visibility,node_search,node_uploads,node_storage toneMint
class node_knowledge,node_autocomment,node_embedding,node_gemini toneRose
class node_notifications,node_analytics,node_database,node_redis,node_s3,node_members toneIndigo
```

## Components

### Identity and access

- [Authentication](https://github.com/welikewatermelon/therapist_community_be/tree/main/src/main/java/com/therapyCommunity_Vol1/backend/auth): `src/main/java/com/therapyCommunity_Vol1/backend/auth`
- [Profiles and roles](https://github.com/welikewatermelon/therapist_community_be/blob/main/src/main/java/com/therapyCommunity_Vol1/backend/user/service/UserService.java): `src/main/java/com/therapyCommunity_Vol1/backend/user/service/UserService.java`
- [Therapist verification](https://github.com/welikewatermelon/therapist_community_be/tree/main/src/main/java/com/therapyCommunity_Vol1/backend/therapist): `src/main/java/com/therapyCommunity_Vol1/backend/therapist`

### Community interactions

- [Comments](https://github.com/welikewatermelon/therapist_community_be/blob/main/src/main/java/com/therapyCommunity_Vol1/backend/comment/service/CommentService.java): `src/main/java/com/therapyCommunity_Vol1/backend/comment/service/CommentService.java`
- [Post and comment reactions](https://github.com/welikewatermelon/therapist_community_be/tree/main/src/main/java/com/therapyCommunity_Vol1/backend/reaction/service): `src/main/java/com/therapyCommunity_Vol1/backend/reaction/service`
- [Follows and scraps](https://github.com/welikewatermelon/therapist_community_be/blob/main/src/main/java/com/therapyCommunity_Vol1/backend/follow/service/FollowService.java): `src/main/java/com/therapyCommunity_Vol1/backend/follow/service/FollowService.java`
- [Direct messages](https://github.com/welikewatermelon/therapist_community_be/blob/main/src/main/java/com/therapyCommunity_Vol1/backend/message/service/MessageService.java): `src/main/java/com/therapyCommunity_Vol1/backend/message/service/MessageService.java`
- [Job listings](https://github.com/welikewatermelon/therapist_community_be/tree/main/src/main/java/com/therapyCommunity_Vol1/backend/jobpost/service): `src/main/java/com/therapyCommunity_Vol1/backend/jobpost/service`

### Content and discovery

- [Posts and feeds](https://github.com/welikewatermelon/therapist_community_be/blob/main/src/main/java/com/therapyCommunity_Vol1/backend/post/service/PostService.java): `src/main/java/com/therapyCommunity_Vol1/backend/post/service/PostService.java`
- [Visibility policy](https://github.com/welikewatermelon/therapist_community_be/blob/main/src/main/java/com/therapyCommunity_Vol1/backend/post/service/PostVisibilityAccessPolicy.java): `src/main/java/com/therapyCommunity_Vol1/backend/post/service/PostVisibilityAccessPolicy.java`
- [Post search](https://github.com/welikewatermelon/therapist_community_be/tree/main/src/main/java/com/therapyCommunity_Vol1/backend/post/service/search): `src/main/java/com/therapyCommunity_Vol1/backend/post/service/search`
- [Media uploads](https://github.com/welikewatermelon/therapist_community_be/tree/main/src/main/java/com/therapyCommunity_Vol1/backend/post/service/upload): `src/main/java/com/therapyCommunity_Vol1/backend/post/service/upload`
- [File storage](https://github.com/welikewatermelon/therapist_community_be/blob/main/src/main/java/com/therapyCommunity_Vol1/backend/file/service/FileStorageService.java): `src/main/java/com/therapyCommunity_Vol1/backend/file/service/FileStorageService.java`

### AI and knowledge

- [Knowledge ingestion](https://github.com/welikewatermelon/therapist_community_be/blob/main/src/main/java/com/therapyCommunity_Vol1/backend/knowledge/service/KnowledgeIngestionService.java): `src/main/java/com/therapyCommunity_Vol1/backend/knowledge/service/KnowledgeIngestionService.java`
- [AI comment review](https://github.com/welikewatermelon/therapist_community_be/tree/main/src/main/java/com/therapyCommunity_Vol1/backend/autocomment/service): `src/main/java/com/therapyCommunity_Vol1/backend/autocomment/service`
- [Post embeddings](https://github.com/welikewatermelon/therapist_community_be/blob/main/src/main/java/com/therapyCommunity_Vol1/backend/post/service/search/EmbeddingService.java): `src/main/java/com/therapyCommunity_Vol1/backend/post/service/search/EmbeddingService.java`
- **Gemini services**

### Notifications and analytics

- [SSE notifications](https://github.com/welikewatermelon/therapist_community_be/tree/main/src/main/java/com/therapyCommunity_Vol1/backend/notification): `src/main/java/com/therapyCommunity_Vol1/backend/notification`
- [Event analytics](https://github.com/welikewatermelon/therapist_community_be/blob/main/src/main/java/com/therapyCommunity_Vol1/backend/analytics/event/UserEventPublisher.java): `src/main/java/com/therapyCommunity_Vol1/backend/analytics/event/UserEventPublisher.java`
- **PostgreSQL and pgvector**
- **Redis cache**
- **S3 or local files**

### Other components

- **Members**

## Connections

- Members → Authentication: sign in
- Authentication → Profiles and roles: identifies (evidence: `src/main/java/com/therapyCommunity_Vol1/backend/user/service/UserService.java`)
- Authentication → Redis cache: checks login limits
- Members → Posts and feeds: publish or browse
- Posts and feeds → Visibility policy: checks access (evidence: `src/main/java/com/therapyCommunity_Vol1/backend/post/service/PostService.java`)
- Visibility policy → Follows and scraps: checks follower access (evidence: `src/main/java/com/therapyCommunity_Vol1/backend/post/service/PostVisibilityAccessPolicy.java`)
- Posts and feeds → PostgreSQL and pgvector: persists posts
- Members → Post search: search posts
- Post search → PostgreSQL and pgvector: queries GIN or vectors
- Posts and feeds → Post embeddings: emits embedding work
- Post embeddings → PostgreSQL and pgvector: writes vectors
- Members → Media uploads: upload media
- Media uploads → File storage: stores media (evidence: `src/main/java/com/therapyCommunity_Vol1/backend/post/service/upload/UploadConfirmService.java`)
- File storage → S3 or local files: stores objects
- Members → Comments: comment
- Members → Post and comment reactions: react
- Members → Follows and scraps: follow or save
- Members → Direct messages: send messages
- Members → Job listings: browse listings
- Members → Therapist verification: apply for verification
- Therapist verification → Profiles and roles: updates role (evidence: `src/main/java/com/therapyCommunity_Vol1/backend/therapist/service/TherapistVerificationService.java`)
- Posts and feeds → AI comment review: requests AI comment (evidence: `src/main/java/com/therapyCommunity_Vol1/backend/post/service/PostService.java`)
- AI comment review → Knowledge ingestion: retrieves context
- Knowledge ingestion → Gemini services: embeds chunks
- Knowledge ingestion → PostgreSQL and pgvector: stores chunks
- AI comment review → Gemini services: generates draft
- AI comment review → Comments: registers approved reply (evidence: `src/main/java/com/therapyCommunity_Vol1/backend/autocomment/service/AiCommentReviewService.java`)
- Members → SSE notifications: subscribe to SSE
- Comments → SSE notifications: publishes alert event (evidence: `src/main/java/com/therapyCommunity_Vol1/backend/comment/service/CommentService.java`)
- Follows and scraps → SSE notifications: publishes follow event (evidence: `src/main/java/com/therapyCommunity_Vol1/backend/follow/service/FollowService.java`)
- Posts and feeds → Event analytics: publishes activity (evidence: `src/main/java/com/therapyCommunity_Vol1/backend/post/service/PostService.java`)
- Event analytics → PostgreSQL and pgvector: stores and aggregates events
