# burakkontas/discordclone architecture

> Architecture diagram of the GitHub repository burakkontas/discordclone, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-07). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/burakkontas/discordclone
- Repository: https://github.com/burakkontas/discordclone

## Overview

##### Project type and purpose
- This is a microservices‐based backend for a Discord‐style chat application.
- It employs a star topology: a single CentralService mediates all external REST calls and routes internal RPCs to specialized services (Auth, Message, Email).
- Each microservice follows a layered architecture (Application, Service, Domain, DataAccess, Infrastructure) and communicates via gRPC internally.

##### File structure
- Top-level directories per microservice (e.g., AuthService.Application, AuthService.Service, AuthService.DataAccess, AuthService.Domain, AuthService.Infrastructure) reveal a clear layering:
- Application: Controllers, Handlers, Queries (MediatR patterns)
- Service: business logic implementations and adapters
- Domain: core models and protobuf definitions
- DataAccess: repository interfaces and implementations
- Infrastructure: database contexts and SQL scripts
- Discord.AppHost is the host project that wires all services together (builds and runs them).
- Configuration files (appsettings.json, launchSettings.json) are present in each Application project.
- Protobuf files in Domain/Protos define gRPC contracts.

##### README for additional insights
- Confirms star topology, gRPC for inter‐service comms, REST on CentralService.
- Lists REST endpoints exposed by CentralService for messages, auth, email.
- Mentions Elasticsearch for MessageService storage and general .NET Core 8 technology stack.

##### Detail
- Service’s datastore connection.
- Protocols (HTTP/1.1, gRPC).
- MediatR/handler pattern inside Application layer if deep layering is required.

## Diagram (Mermaid)

```mermaid
flowchart TB
    ExternalClient["External Client (Web/Mobile)"]:::external
    AppHost["Discord.AppHost"]:::orchestrator
    CentralServiceHub["CentralService (API Gateway / Hub)"]:::gateway
    AuthService["AuthService"]:::micro
    MessageService["MessageService"]:::micro
    EmailService["EmailService"]:::micro
    AuthDB["Auth SQL Database"]:::db
    ES["Elasticsearch Cluster"]:::db
    SMTP["SMTP/External Email Provider"]:::external

    ExternalClient -->|HTTP/1.1 REST| CentralServiceHub
    AppHost -->|Orchestrates startup| CentralServiceHub

    CentralServiceHub -->|gRPC| AuthService
    CentralServiceHub -->|gRPC| MessageService
    CentralServiceHub -->|gRPC| EmailService

    AuthService -->|SQL| AuthDB
    MessageService -->|Elasticsearch| ES
    EmailService -->|SMTP| SMTP

    click AppHost "https://github.com/burakkontas/discordclone/blob/master/Discord.AppHost/Program.cs"
    click AppHost "https://github.com/burakkontas/discordclone/blob/master/Discord.AppHost/Discord.AppHost.csproj"

    click CentralServiceHub "https://github.com/burakkontas/discordclone/blob/master/CenteralService.Application/Program.cs"
    click CentralServiceHub "https://github.com/burakkontas/discordclone/blob/master/CenteralService.Application/CenteralService.Application.csproj"
    click CentralServiceHub "https://github.com/burakkontas/discordclone/tree/master/CenteralService.Application/Controllers"
    click CentralServiceHub "https://github.com/burakkontas/discordclone/blob/master/CenteralService.Service/Services/MessageService.cs"
    click CentralServiceHub "https://github.com/burakkontas/discordclone/blob/master/CenteralService.Service/Services/EmailService.cs"
    click CentralServiceHub "https://github.com/burakkontas/discordclone/blob/master/CenteralService.Service/Services/AuthenticationService.cs"
    click CentralServiceHub "https://github.com/burakkontas/discordclone/tree/master/CenteralService.Domain/Protos"
    click CentralServiceHub "https://github.com/burakkontas/discordclone/blob/master/CenteralService.Infrastructure/MessageContext.cs"
    click CentralServiceHub "https://github.com/burakkontas/discordclone/blob/master/CenteralService.Infrastructure/EmailContext.cs"
    click CentralServiceHub "https://github.com/burakkontas/discordclone/blob/master/CenteralService.Infrastructure/AuthContext.cs"

    click AuthService "https://github.com/burakkontas/discordclone/blob/master/AuthService.Application/Program.cs"
    click AuthService "https://github.com/burakkontas/discordclone/blob/master/AuthService.Application/Controllers/AuthenticationController.cs"
    click AuthService "https://github.com/burakkontas/discordclone/blob/master/AuthService.Service/Services/AuthenticationService.cs"
    click AuthService "https://github.com/burakkontas/discordclone/blob/master/AuthService.Service/Services/TokenService.cs"
    click AuthService "https://github.com/burakkontas/discordclone/blob/master/AuthService.Domain/Protos/auth.proto"
    click AuthService "https://github.com/burakkontas/discordclone/blob/master/AuthService.Infrastructure/AuthContext.cs"

    click MessageService "https://github.com/burakkontas/discordclone/blob/master/MessageService.Application/Program.cs"
    click MessageService "https://github.com/burakkontas/discordclone/blob/master/MessageService.Application/Controllers/MessageController.cs"
    click MessageService "https://github.com/burakkontas/discordclone/blob/master/MessageService.Service/Services/MessageService.cs"
    click MessageService "https://github.com/burakkontas/discordclone/blob/master/MessageService.Domain/Protos/message.proto"
    click MessageService "https://github.com/burakkontas/discordclone/blob/master/MessageService.Infrastructure/MessageService.Infrastructure.csproj"

    click EmailService "https://github.com/burakkontas/discordclone/blob/master/EmailService.Application/Program.cs"
    click EmailService "https://github.com/burakkontas/discordclone/blob/master/EmailService.Application/Controllers/EmailController.cs"
    click EmailService "https://github.com/burakkontas/discordclone/blob/master/EmailService.Service/Services/EmailService.cs"
    click EmailService "https://github.com/burakkontas/discordclone/blob/master/EmailService.Domain/Protos/email.proto"
    click EmailService "https://github.com/burakkontas/discordclone/blob/master/EmailService.Infrastructure/EmailContext.cs"

    classDef external fill:#f9f,stroke:#333,stroke-width:2px
    classDef orchestrator fill:#bbf,stroke:#333,stroke-width:2px
    classDef gateway fill:#bfb,stroke:#333,stroke-width:2px
    classDef micro fill:#ffb,stroke:#333,stroke-width:2px
    classDef db fill:#fbb,stroke:#333,stroke-width:2px
```
