# m-nikolovv/instaconnect architecture

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

- Interactive diagram: https://gitdiagram.com/m-nikolovv/instaconnect
- Repository: https://github.com/m-nikolovv/instaconnect

## Overview

InstaConnect is a four-service social platform. Users enter through the nginx API gateway and reach Identity for accounts and authentication, Posts for content and reactions, Chats for messaging, or Follows for relationships. The README documents asynchronous Kafka communication and SignalR features; sampled query services show application-facing domain logic validating related entities, querying repositories, and assembling responses. The tree and excerpts do not show most service wiring, so several layer and integration links are documented at a high level rather than traced to specific calls.

Main entry points: [`src/Services/Chats/InstaConnect.Chats.Presentation/Program.cs`](https://github.com/m-nikolovv/instaconnect/blob/master/src/Services/Chats/InstaConnect.Chats.Presentation/Program.cs) (Chats API), [`src/Services/Posts/InstaConnect.Posts.Infrastructure/Features`](https://github.com/m-nikolovv/instaconnect/tree/master/src/Services/Posts/InstaConnect.Posts.Infrastructure/Features) (Posts repositories), [`src/Services/Follows/InstaConnect.Follows.Presentation`](https://github.com/m-nikolovv/instaconnect/tree/master/src/Services/Follows/InstaConnect.Follows.Presentation) (Follows API), [`src/Common/InstaConnect.Common.Infrastructure/Features/Events`](https://github.com/m-nikolovv/instaconnect/tree/master/src/Common/InstaConnect.Common.Infrastructure/Features/Events) (Kafka events)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_edge["Gateway and clients"]
  node_user(("Platform user"))
  node_gateway["nginx gateway"]
end

subgraph group_identity["Identity service"]
  node_identity_api["Identity API"]
  node_identity_app["Identity application"]
  node_identity_domain["Identity domain"]
end

subgraph group_content["Posts service"]
  node_posts_api["Posts API"]
  node_posts_app["Posts application"]
  node_post_queries["Post query services"]
  node_comment_queries["Comment queries"]
  node_like_queries["Like queries"]
  node_comment_like_queries["Comment-like queries"]
  node_posts_repos["Posts repositories<br/>[Features]"]
end

subgraph group_social["Chats and follows"]
  node_chats_api["Chats API<br/>[Program.cs]"]
  node_chat_queries["Chat query services"]
  node_message_queries["Message queries"]
  node_follows_api["Follows API"]
  node_follow_queries["Follow queries"]
end

subgraph group_platform["Shared platform"]
  node_kafka["Kafka events<br/>[Events]"]
  node_signalr["SignalR messaging<br/>[Hubs]"]
  node_mongodb[("MongoDB")]
  node_redis[("Redis cache<br/>[Caches]")]
  node_common_app["Shared application pipeline<br/>[Features]"]
end

node_user -->|"sends requests"| node_gateway
node_gateway -->|"routes identity"| node_identity_api
node_gateway -->|"routes posts"| node_posts_api
node_gateway -->|"routes chats"| node_chats_api
node_gateway -->|"routes follows"| node_follows_api
node_identity_api -.->|"dispatches requests"| node_identity_app
node_identity_app -.->|"uses domain"| node_identity_domain
node_posts_api -.->|"dispatches requests"| node_posts_app
node_posts_app -.->|"invokes queries"| node_post_queries
node_post_queries -.->|"queries posts"| node_posts_repos
node_comment_queries -.->|"queries comments"| node_posts_repos
node_like_queries -.->|"queries likes"| node_posts_repos
node_comment_like_queries -.->|"queries reactions"| node_posts_repos
node_chats_api -.->|"dispatches queries"| node_chat_queries
node_chats_api -.->|"dispatches queries"| node_message_queries
node_follows_api -.->|"dispatches queries"| node_follow_queries
node_identity_api -.->|"exchanges events"| node_kafka
node_posts_api -.->|"exchanges events"| node_kafka
node_chats_api -.->|"exchanges events"| node_kafka
node_follows_api -.->|"exchanges events"| node_kafka
node_chats_api -.->|"supports messaging"| node_signalr
node_follows_api -.->|"supports notifications"| node_signalr
node_common_app -.->|"caches queries"| node_redis
node_posts_repos -.->|"reads data"| node_mongodb

click node_identity_api "https://github.com/m-nikolovv/instaconnect/tree/master/src/Services/Identity/InstaConnect.Identity.Presentation"
click node_identity_app "https://github.com/m-nikolovv/instaconnect/tree/master/src/Services/Identity/InstaConnect.Identity.Application"
click node_identity_domain "https://github.com/m-nikolovv/instaconnect/tree/master/src/Services/Identity/InstaConnect.Identity.Domain"
click node_posts_api "https://github.com/m-nikolovv/instaconnect/tree/master/src/Services/Posts/InstaConnect.Posts.Presentation"
click node_posts_app "https://github.com/m-nikolovv/instaconnect/tree/master/src/Services/Posts/InstaConnect.Posts.Application"
click node_post_queries "https://github.com/m-nikolovv/instaconnect/blob/master/src/Services/Posts/InstaConnect.Posts.Domain/Features/Posts/Helpers/PostQueryService.cs"
click node_comment_queries "https://github.com/m-nikolovv/instaconnect/blob/master/src/Services/Posts/InstaConnect.Posts.Domain/Features/PostComments/Helpers/PostCommentQueryService.cs"
click node_like_queries "https://github.com/m-nikolovv/instaconnect/blob/master/src/Services/Posts/InstaConnect.Posts.Domain/Features/PostLikes/Helpers/PostLikeQueryService.cs"
click node_comment_like_queries "https://github.com/m-nikolovv/instaconnect/blob/master/src/Services/Posts/InstaConnect.Posts.Domain/Features/PostCommentLikes/Helpers/PostCommentLikeQueryService.cs"
click node_posts_repos "https://github.com/m-nikolovv/instaconnect/tree/master/src/Services/Posts/InstaConnect.Posts.Infrastructure/Features"
click node_chats_api "https://github.com/m-nikolovv/instaconnect/blob/master/src/Services/Chats/InstaConnect.Chats.Presentation/Program.cs"
click node_chat_queries "https://github.com/m-nikolovv/instaconnect/blob/master/src/Services/Chats/InstaConnect.Chats.Domain/Features/Chats/Helpers/ChatQueryService.cs"
click node_message_queries "https://github.com/m-nikolovv/instaconnect/blob/master/src/Services/Chats/InstaConnect.Chats.Domain/Features/ChatMessages/Helpers/ChatMessageQueryService.cs"
click node_follows_api "https://github.com/m-nikolovv/instaconnect/tree/master/src/Services/Follows/InstaConnect.Follows.Presentation"
click node_follow_queries "https://github.com/m-nikolovv/instaconnect/blob/master/src/Services/Follows/InstaConnect.Follows.Domain/Features/Follows/Helpers/FollowQueryService.cs"
click node_kafka "https://github.com/m-nikolovv/instaconnect/tree/master/src/Common/InstaConnect.Common.Infrastructure/Features/Events"
click node_signalr "https://github.com/m-nikolovv/instaconnect/tree/master/src/Common/InstaConnect.Common.Infrastructure/Features/Hubs"
click node_redis "https://github.com/m-nikolovv/instaconnect/tree/master/src/Common/InstaConnect.Common.Infrastructure/Features/Caches"
click node_common_app "https://github.com/m-nikolovv/instaconnect/tree/master/src/Common/InstaConnect.Common.Application/Features"

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_user,node_gateway toneBlue
class node_identity_api,node_identity_app,node_identity_domain toneAmber
class node_posts_api,node_posts_app,node_post_queries,node_comment_queries,node_like_queries,node_comment_like_queries,node_posts_repos toneMint
class node_chats_api,node_chat_queries,node_message_queries,node_follows_api,node_follow_queries toneRose
class node_kafka,node_signalr,node_mongodb,node_redis,node_common_app toneIndigo
```

## Components

### Gateway and clients

- **Platform user**
- **nginx gateway**

### Identity service

- [Identity API](https://github.com/m-nikolovv/instaconnect/tree/master/src/Services/Identity/InstaConnect.Identity.Presentation): `src/Services/Identity/InstaConnect.Identity.Presentation`
- [Identity application](https://github.com/m-nikolovv/instaconnect/tree/master/src/Services/Identity/InstaConnect.Identity.Application): `src/Services/Identity/InstaConnect.Identity.Application`
- [Identity domain](https://github.com/m-nikolovv/instaconnect/tree/master/src/Services/Identity/InstaConnect.Identity.Domain): `src/Services/Identity/InstaConnect.Identity.Domain`

### Posts service

- [Posts API](https://github.com/m-nikolovv/instaconnect/tree/master/src/Services/Posts/InstaConnect.Posts.Presentation): `src/Services/Posts/InstaConnect.Posts.Presentation`
- [Posts application](https://github.com/m-nikolovv/instaconnect/tree/master/src/Services/Posts/InstaConnect.Posts.Application): `src/Services/Posts/InstaConnect.Posts.Application`
- [Post query services](https://github.com/m-nikolovv/instaconnect/blob/master/src/Services/Posts/InstaConnect.Posts.Domain/Features/Posts/Helpers/PostQueryService.cs): `src/Services/Posts/InstaConnect.Posts.Domain/Features/Posts/Helpers/PostQueryService.cs`
- [Comment queries](https://github.com/m-nikolovv/instaconnect/blob/master/src/Services/Posts/InstaConnect.Posts.Domain/Features/PostComments/Helpers/PostCommentQueryService.cs): `src/Services/Posts/InstaConnect.Posts.Domain/Features/PostComments/Helpers/PostCommentQueryService.cs`
- [Like queries](https://github.com/m-nikolovv/instaconnect/blob/master/src/Services/Posts/InstaConnect.Posts.Domain/Features/PostLikes/Helpers/PostLikeQueryService.cs): `src/Services/Posts/InstaConnect.Posts.Domain/Features/PostLikes/Helpers/PostLikeQueryService.cs`
- [Comment-like queries](https://github.com/m-nikolovv/instaconnect/blob/master/src/Services/Posts/InstaConnect.Posts.Domain/Features/PostCommentLikes/Helpers/PostCommentLikeQueryService.cs): `src/Services/Posts/InstaConnect.Posts.Domain/Features/PostCommentLikes/Helpers/PostCommentLikeQueryService.cs`
- [Posts repositories](https://github.com/m-nikolovv/instaconnect/tree/master/src/Services/Posts/InstaConnect.Posts.Infrastructure/Features): `src/Services/Posts/InstaConnect.Posts.Infrastructure/Features`

### Chats and follows

- [Chats API](https://github.com/m-nikolovv/instaconnect/blob/master/src/Services/Chats/InstaConnect.Chats.Presentation/Program.cs): `src/Services/Chats/InstaConnect.Chats.Presentation/Program.cs`
- [Chat query services](https://github.com/m-nikolovv/instaconnect/blob/master/src/Services/Chats/InstaConnect.Chats.Domain/Features/Chats/Helpers/ChatQueryService.cs): `src/Services/Chats/InstaConnect.Chats.Domain/Features/Chats/Helpers/ChatQueryService.cs`
- [Message queries](https://github.com/m-nikolovv/instaconnect/blob/master/src/Services/Chats/InstaConnect.Chats.Domain/Features/ChatMessages/Helpers/ChatMessageQueryService.cs): `src/Services/Chats/InstaConnect.Chats.Domain/Features/ChatMessages/Helpers/ChatMessageQueryService.cs`
- [Follows API](https://github.com/m-nikolovv/instaconnect/tree/master/src/Services/Follows/InstaConnect.Follows.Presentation): `src/Services/Follows/InstaConnect.Follows.Presentation`
- [Follow queries](https://github.com/m-nikolovv/instaconnect/blob/master/src/Services/Follows/InstaConnect.Follows.Domain/Features/Follows/Helpers/FollowQueryService.cs): `src/Services/Follows/InstaConnect.Follows.Domain/Features/Follows/Helpers/FollowQueryService.cs`

### Shared platform

- [Kafka events](https://github.com/m-nikolovv/instaconnect/tree/master/src/Common/InstaConnect.Common.Infrastructure/Features/Events): `src/Common/InstaConnect.Common.Infrastructure/Features/Events`
- [SignalR messaging](https://github.com/m-nikolovv/instaconnect/tree/master/src/Common/InstaConnect.Common.Infrastructure/Features/Hubs): `src/Common/InstaConnect.Common.Infrastructure/Features/Hubs`
- **MongoDB**
- [Redis cache](https://github.com/m-nikolovv/instaconnect/tree/master/src/Common/InstaConnect.Common.Infrastructure/Features/Caches): `src/Common/InstaConnect.Common.Infrastructure/Features/Caches`
- [Shared application pipeline](https://github.com/m-nikolovv/instaconnect/tree/master/src/Common/InstaConnect.Common.Application/Features): `src/Common/InstaConnect.Common.Application/Features`

## Connections

- Platform user → nginx gateway: sends requests (evidence: `README.md`)
- nginx gateway → Identity API: routes identity (evidence: `README.md`)
- nginx gateway → Posts API: routes posts (evidence: `README.md`)
- nginx gateway → Chats API: routes chats (evidence: `README.md`)
- nginx gateway → Follows API: routes follows (evidence: `README.md`)
- Identity API → Identity application: dispatches requests
- Identity application → Identity domain: uses domain
- Posts API → Posts application: dispatches requests
- Posts application → Post query services: invokes queries
- Post query services → Posts repositories: queries posts
- Comment queries → Posts repositories: queries comments
- Like queries → Posts repositories: queries likes
- Comment-like queries → Posts repositories: queries reactions
- Chats API → Chat query services: dispatches queries
- Chats API → Message queries: dispatches queries
- Follows API → Follow queries: dispatches queries
- Identity API → Kafka events: exchanges events
- Posts API → Kafka events: exchanges events
- Chats API → Kafka events: exchanges events
- Follows API → Kafka events: exchanges events
- Chats API → SignalR messaging: supports messaging (evidence: `README.md`)
- Follows API → SignalR messaging: supports notifications (evidence: `README.md`)
- Shared application pipeline → Redis cache: caches queries
- Posts repositories → MongoDB: reads data
