# respondnow/respondnow architecture

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

- Interactive diagram: https://gitdiagram.com/respondnow/respondnow
- Repository: https://github.com/respondnow/respondnow

## Overview

##### Main Components

a. Frontend Layer:
- Portal (React-based web application)
- User Interface Components
- Authentication/Authorization flows
- Incident management views

b. Backend Layer:
- Spring Boot Server
- REST API endpoints
- Service Layer
- Repository Layer
- Database interactions

c. External Integrations:
- Slack Integration
- Kubernetes Infrastructure
- Authentication System

**[Client Layer]**

- Web Portal (React)
- Authentication Components
- Incident Management UI
- Timeline Views

**[API Layer]**

- Spring Boot Server
- Controllers
- Auth Controller
- Incident Controller
- User Controller

- Services
- Auth Service
- Incident Service
- Slack Service
- User Service

- Repositories

**[External Services]**

- Slack Integration
- Async Service
- Block Factory

**[Infrastructure]**

- Kubernetes
- Deployments
- Services
- Ingress

##### Key Design Elements

- Blue: Frontend components
- Green: Backend services
- Purple: External integrations
- Gray: Infrastructure components

- User interactions → Frontend
- Frontend → Backend API
- Backend → Database
- Backend → Slack Integration

##### Important Architectural Patterns to Highlight

- MVC Pattern in the frontend
- Service-Repository pattern in the backend
- Async communication with Slack
- JWT-based authentication
- RESTful API design

##### Technical Stack Indicators

- Frontend: React, TypeScript, SCSS
- Backend: Spring Boot, Java
- Infrastructure: Kubernetes, Helm
- Integration: Slack API
- Authentication: JWT

##### Deployment Flow

How the application is deployed using Helm charts and Kubernetes resources:
**[Helm Charts] → [Kubernetes Cluster]**

- Deployment Manifests
- Service Definitions
- Ingress Rules

Remember to:
- Use consistent styling
- Brief descriptions for complex interactions
- Both synchronous and asynchronous communication paths
- Security boundaries
- Public vs. private interfaces

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles and classes
    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef backend fill:#2ecc71,stroke:#27ae60,color:white
    classDef external fill:#9b59b6,stroke:#8e44ad,color:white
    classDef infra fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef database fill:#e67e22,stroke:#d35400,color:white
    classDef security fill:#e74c3c,stroke:#c0392b,color:white

    %% Frontend Layer
    subgraph Frontend
        Portal["React Portal"]:::frontend
        AuthUI["Authentication UI"]:::frontend
        IncidentUI["Incident Management UI"]:::frontend
        Timeline["Timeline Views"]:::frontend
    end

    %% Backend Layer
    subgraph Backend
        SpringBoot["Spring Boot Server"]:::backend
        
        subgraph Controllers
            AuthController["Auth Controller"]:::backend
            IncidentController["Incident Controller"]:::backend
            UserController["User Controller"]:::backend
        end
        
        subgraph Services
            AuthService["Auth Service"]:::backend
            IncidentService["Incident Service"]:::backend
            UserService["User Service"]:::backend
            SlackService["Slack Service"]:::backend
        end
        
        subgraph Repositories
            AuthRepo["Auth Repository"]:::backend
            IncidentRepo["Incident Repository"]:::backend
            UserRepo["User Repository"]:::backend
        end
    end

    %% External Services
    subgraph External
        SlackIntegration["Slack Integration"]:::external
        SlackAsync["Slack Async Service"]:::external
        SlackBlock["Slack Block Factory"]:::external
    end

    %% Infrastructure
    subgraph Infrastructure
        K8s["Kubernetes Cluster"]:::infra
        Helm["Helm Charts"]:::infra
        Ingress["Ingress"]:::infra
    end

    %% Security
    JWT["JWT Authentication"]:::security
    
    %% Database
    DB[(Database)]:::database

    %% Relationships
    Portal --> AuthUI
    Portal --> IncidentUI
    IncidentUI --> Timeline
    
    AuthUI --> AuthController
    IncidentUI --> IncidentController
    
    AuthController --> AuthService
    IncidentController --> IncidentService
    UserController --> UserService
    
    AuthService --> AuthRepo
    IncidentService --> IncidentRepo
    UserService --> UserRepo
    
    AuthService --> JWT
    
    SlackService --> SlackIntegration
    SlackIntegration --> SlackAsync
    SlackIntegration --> SlackBlock
    
    AuthRepo --> DB
    IncidentRepo --> DB
    UserRepo --> DB
    
    Helm --> K8s
    K8s --> Ingress

    %% Click events
    click Portal "https://github.com/respondnow/respondnow/blob/main/portal/src/app/App.tsx"
    click AuthUI "https://github.com/respondnow/respondnow/tree/main/portal/src/controllers/Login"
    click IncidentUI "https://github.com/respondnow/respondnow/tree/main/portal/src/controllers/Incidents"
    click Timeline "https://github.com/respondnow/respondnow/tree/main/portal/src/components/IncidentTimeline"
    click AuthController "https://github.com/respondnow/respondnow/blob/main/server/src/main/java/io/respondnow/controller/AuthController.java"
    click IncidentController "https://github.com/respondnow/respondnow/blob/main/server/src/main/java/io/respondnow/controller/IncidentController.java"
    click UserController "https://github.com/respondnow/respondnow/blob/main/server/src/main/java/io/respondnow/controller/UserController.java"
    click AuthService "https://github.com/respondnow/respondnow/tree/main/server/src/main/java/io/respondnow/service/auth"
    click IncidentService "https://github.com/respondnow/respondnow/tree/main/server/src/main/java/io/respondnow/service/incident"
    click UserService "https://github.com/respondnow/respondnow/tree/main/server/src/main/java/io/respondnow/service/user"
    click SlackService "https://github.com/respondnow/respondnow/blob/main/server/src/main/java/io/respondnow/service/slack/SlackService.java"
    click SlackAsync "https://github.com/respondnow/respondnow/blob/main/server/src/main/java/io/respondnow/service/slack/SlackAsyncService.java"
    click SlackBlock "https://github.com/respondnow/respondnow/blob/main/server/src/main/java/io/respondnow/service/slack/SlackBlockFactory.java"
    click JWT "https://github.com/respondnow/respondnow/blob/main/server/src/main/java/io/respondnow/security/JWTAuthenticationFilter.java"
    click K8s "https://github.com/respondnow/respondnow/blob/main/server/helm/charts/respondnow/templates/deployment.yaml"
    click Ingress "https://github.com/respondnow/respondnow/blob/main/server/helm/charts/respondnow/templates/ingress.yaml"
```
