# sunnyyssh/justwish architecture

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

- Interactive diagram: https://gitdiagram.com/sunnyyssh/justwish
- Repository: https://github.com/sunnyyssh/justwish

## Overview

##### High-Level Components

a. Frontend Service:
- Single-page application (React/TypeScript based on the frontend structure)
- Located in the `/frontend` directory

b. Backend Microservices:
- Users Service (Justwish.Users)
- Notifications Service (Justwish.Notifications)

c. Infrastructure Components:
- Nginx reverse proxy (evident from nginx configuration files)
- Docker containers (indicated by Dockerfiles and docker-compose files)

##### Detailed Service Architecture

For each microservice, show the following layers (using Clean Architecture pattern evident in the structure):

a. Users Service (Justwish.Users):
- WebApi Layer (Controllers/Endpoints)
- Application Layer (Commands/Queries - CQRS pattern)
- Domain Layer (Core business logic)
- Infrastructure Layer (Database, External services)
- Features:
- User management
- Authentication (JWT)
- Email verification
- Profile photo management

b. Notifications Service (Justwish.Notifications):
- Message consumption patterns
- Email notification handling
- SMTP integration

##### Data Flow and Integration Points

Following interactions:
- Frontend → Nginx → Backend Services
- Inter-service communication (Users → Notifications)
- Authentication flow
- Email verification flow
- Database interactions
- File storage for profile photos

##### Technical Details

Annotations for:
- .NET Core backend services
- React/TypeScript frontend
- Docker containerization
- Database technology
- Message queue system
- JWT authentication
- SMTP email service

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles and Classes
    classDef frontend fill:#42A5F5,color:white
    classDef api fill:#FF7043,color:white
    classDef service fill:#66BB6A,color:white
    classDef domain fill:#AB47BC,color:white
    classDef infra fill:#78909C,color:white
    classDef database fill:#FFA726,color:white
    classDef queue fill:#26A69A,color:white

    %% Client Layer
    subgraph Client
        FE["Frontend (React/TS)"]
        FE_APP["App Component"]
        FE_MAIN["Main Entry"]
    end
    click FE "https://github.com/sunnyyssh/justwish/tree/main//frontend"
    click FE_APP "https://github.com/sunnyyssh/justwish/blob/main//frontend/src/App.tsx"
    click FE_MAIN "https://github.com/sunnyyssh/justwish/blob/main//frontend/src/main.tsx"
    class FE,FE_APP,FE_MAIN frontend

    %% API Gateway
    NGINX["Nginx Reverse Proxy"]
    click NGINX "https://github.com/sunnyyssh/justwish/tree/main//nginx"
    class NGINX api

    %% Users Service
    subgraph UsersService
        US_API["Users WebApi"]
        US_APP["Users Application"]
        US_DOM["Users Domain"]
        US_INF["Users Infrastructure"]
        
        subgraph UserFeatures
            JWT["JWT Auth"]
            EMAIL_VER["Email Verification"]
            USER_MGT["User Management"]
            PHOTO_MGT["Profile Photo Management"]
        end
    end
    click US_API "https://github.com/sunnyyssh/justwish/blob/main//backend/Justwish.Users/Justwish.Users.WebApi"
    click US_APP "https://github.com/sunnyyssh/justwish/blob/main//backend/Justwish.Users/Justwish.Users.Application"
    click US_DOM "https://github.com/sunnyyssh/justwish/blob/main//backend/Justwish.Users/Justwish.Users.Domain"
    click US_INF "https://github.com/sunnyyssh/justwish/blob/main//backend/Justwish.Users/Justwish.Users.Infrastructure"
    click JWT "https://github.com/sunnyyssh/justwish/tree/main//backend/Justwish.Users/Justwish.Users.Application/User/Jwt"
    click EMAIL_VER "https://github.com/sunnyyssh/justwish/tree/main//backend/Justwish.Users/Justwish.Users.Application/User/EmailVerification"
    click USER_MGT "https://github.com/sunnyyssh/justwish/tree/main//backend/Justwish.Users/Justwish.Users.Application/User/Commands"
    click PHOTO_MGT "https://github.com/sunnyyssh/justwish/blob/main//backend/Justwish.Users/Justwish.Users.Domain/Entities/UserProfilePhoto.cs"
    class US_API,US_APP service
    class US_DOM domain
    class US_INF infra
    class JWT,EMAIL_VER,USER_MGT,PHOTO_MGT service

    %% Notifications Service
    subgraph NotificationsService
        NOT_API["Notifications WebApi"]
        NOT_APP["Notifications Application"]
        EMAIL_HANDLE["Email Handler"]
        MSG_CONS["Message Consumers"]
    end
    click NOT_API "https://github.com/sunnyyssh/justwish/blob/main//backend/Justwish.Notifications/Justwish.Notifications.WebApi"
    click NOT_APP "https://github.com/sunnyyssh/justwish/blob/main//backend/Justwish.Notifications/Justwish.Notifications.Application"
    click EMAIL_HANDLE "https://github.com/sunnyyssh/justwish/tree/main//backend/Justwish.Notifications/Justwish.Notifications.Application/Email"
    click MSG_CONS "https://github.com/sunnyyssh/justwish/tree/main//backend/Justwish.Notifications/Justwish.Notifications.Application/Consumers"
    class NOT_API,NOT_APP,EMAIL_HANDLE,MSG_CONS service

    %% Infrastructure
    subgraph Infrastructure
        DB[(Users Database)]
        MQ[("Message Queue")]
        SMTP["SMTP Server"]
    end
    click DB "https://github.com/sunnyyssh/justwish/tree/main//backend/Justwish.Users/Justwish.Users.Infrastructure/Database"
    class DB database
    class MQ queue
    class SMTP infra

    %% Relationships
    FE --> NGINX
    FE_APP --> FE
    FE_MAIN --> FE
    NGINX --> US_API
    NGINX --> NOT_API
    US_API --> US_APP
    US_APP --> US_DOM
    US_DOM --> US_INF
    US_INF --> DB
    US_APP --> MQ
    MQ --> MSG_CONS
    MSG_CONS --> EMAIL_HANDLE
    EMAIL_HANDLE --> SMTP
    JWT --> US_APP
    EMAIL_VER --> US_APP
    USER_MGT --> US_APP
    PHOTO_MGT --> US_DOM

    %% Legend
    subgraph Legend
        L_FE["Frontend"]:::frontend
        L_API["API Gateway"]:::api
        L_SVC["Services"]:::service
        L_DOM["Domain"]:::domain
        L_INF["Infrastructure"]:::infra
        L_DB["Database"]:::database
        L_MQ["Message Queue"]:::queue
    end
```
