# urodstvo/mvp-chehoch architecture

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

- Interactive diagram: https://gitdiagram.com/urodstvo/mvp-chehoch
- Repository: https://github.com/urodstvo/mvp-chehoch

## Overview

##### Main Components Identification

The project consists of three main microservices and a frontend application:
- Auth Service (Go)
- Survey Service (Python)
- API Gateway (Python)
- Frontend (React/TypeScript)

##### Detailed Component Breakdown

Frontend Layer:
- Main features: Survey Editor, Viewer, Feed, Organizations
- Authentication flows
- User profile management

API Gateway Layer:
- Main route groups:
- /auth
- /survey
- /question
- /answer
- /organisation
- /tag

Auth Service Layer:
- Authentication operations
- User management
- Organization management
- Session handling
- Tag management

Survey Service Layer:
- Survey operations
- Question management
- Answer handling
- File management
- Tags for surveys

##### Additional Elements

Supporting components:
- Load balancer (if applicable)
- File storage system (for question images)
- gRPC communication paths
- HTTP/REST endpoints
- Database schemas (simplified)

##### Technical Details

For each service, show:
- Technology stack (Go, Python, React)
- Main dependencies
- Communication protocols (gRPC, HTTP)
- Database interactions
- Authentication flow

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Frontend
        FE_Pages["Pages"]:::frontend
        FE_Components["Components"]:::frontend
        FE_API["API Integration"]:::frontend
        FE_Auth["Authentication"]:::frontend
    end

    subgraph "API Gateway"
        API["API Gateway Service"]:::gateway
        Auth_Routes["Auth Routes"]:::gateway
        Survey_Routes["Survey Routes"]:::gateway
        Question_Routes["Question Routes"]:::gateway
        Answer_Routes["Answer Routes"]:::gateway
        Org_Routes["Organisation Routes"]:::gateway
        Tag_Routes["Tag Routes"]:::gateway
    end

    subgraph "Auth Service"
        Auth["Auth Service Core"]:::auth
        Session["Session Management"]:::auth
        User["User Management"]:::auth
        Organisation["Organization Management"]:::auth
        AuthTags["Tag Management"]:::auth
    end

    subgraph "Survey Service"
        Survey["Survey Operations"]:::survey
        Question["Question Management"]:::survey
        Answer["Answer Management"]:::survey
        Files["File Management"]:::survey
        SurveyTags["Tag Management"]:::survey
    end

    subgraph "Storage Layer"
        PostgreSQL[(PostgreSQL)]:::database
        Redis[(Redis Cache)]:::cache
        FileStorage[("File Storage")]:::storage
    end

    %% Frontend Connections
    FE_Pages --> API
    FE_Components --> API
    FE_API --> API
    FE_Auth --> API

    %% API Gateway Connections
    API --> Auth_Routes
    API --> Survey_Routes
    API --> Question_Routes
    API --> Answer_Routes
    API --> Org_Routes
    API --> Tag_Routes

    %% Service Connections
    Auth_Routes --> Auth
    Survey_Routes --> Survey
    Question_Routes --> Question
    Answer_Routes --> Answer
    Org_Routes --> Organisation
    Tag_Routes --> AuthTags
    Tag_Routes --> SurveyTags

    %% Database Connections
    Auth --> PostgreSQL
    Survey --> PostgreSQL
    Auth --> Redis
    Files --> FileStorage

    %% Click Events
    click FE_Pages "https://github.com/urodstvo/mvp-chehoch/tree/master/frontend/src/pages"
    click FE_Components "https://github.com/urodstvo/mvp-chehoch/tree/master/frontend/src/components"
    click FE_API "https://github.com/urodstvo/mvp-chehoch/tree/master/frontend/src/api"
    click FE_Auth "https://github.com/urodstvo/mvp-chehoch/blob/master/frontend/src/components/layout/with-auth.tsx"
    click Auth_Routes "https://github.com/urodstvo/mvp-chehoch/tree/master/apps/api/src/http/routes/auth"
    click Survey_Routes "https://github.com/urodstvo/mvp-chehoch/tree/master/apps/api/src/http/routes/survey"
    click Question_Routes "https://github.com/urodstvo/mvp-chehoch/tree/master/apps/api/src/http/routes/question"
    click Answer_Routes "https://github.com/urodstvo/mvp-chehoch/tree/master/apps/api/src/http/routes/answer"
    click Org_Routes "https://github.com/urodstvo/mvp-chehoch/tree/master/apps/api/src/http/routes/organisation"
    click Tag_Routes "https://github.com/urodstvo/mvp-chehoch/tree/master/apps/api/src/http/routes/tag"
    click Auth "https://github.com/urodstvo/mvp-chehoch/tree/master/apps/auth/internal/impl/auth"
    click Session "https://github.com/urodstvo/mvp-chehoch/tree/master/apps/auth/internal/impl/session"
    click User "https://github.com/urodstvo/mvp-chehoch/tree/master/apps/auth/internal/impl/user"
    click Organisation "https://github.com/urodstvo/mvp-chehoch/tree/master/apps/auth/internal/impl/organisation"
    click Survey "https://github.com/urodstvo/mvp-chehoch/tree/master/apps/survey/src/grpc_impl/surveys"
    click Question "https://github.com/urodstvo/mvp-chehoch/tree/master/apps/survey/src/grpc_impl/questions"
    click Answer "https://github.com/urodstvo/mvp-chehoch/tree/master/apps/survey/src/grpc_impl/answers"
    click Files "https://github.com/urodstvo/mvp-chehoch/tree/master/apps/survey/src/grpc_impl/files"
    click AuthTags "https://github.com/urodstvo/mvp-chehoch/tree/master/apps/auth/internal/impl/tags"
    click SurveyTags "https://github.com/urodstvo/mvp-chehoch/tree/master/apps/survey/src/grpc_impl/tags"

    %% Styling
    classDef frontend fill:#2196F3,stroke:#1565C0,color:white
    classDef gateway fill:#4CAF50,stroke:#2E7D32,color:white
    classDef auth fill:#FF9800,stroke:#EF6C00,color:white
    classDef survey fill:#FF9800,stroke:#EF6C00,color:white
    classDef database fill:#9C27B0,stroke:#6A1B9A,color:white
    classDef cache fill:#F44336,stroke:#C62828,color:white
    classDef storage fill:#795548,stroke:#4E342E,color:white
```
