# guplem/dashboard-reactnodesql architecture

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

- Interactive diagram: https://gitdiagram.com/guplem/dashboard-reactnodesql
- Repository: https://github.com/guplem/dashboard-reactnodesql

## Overview

##### Main Components

A. Frontend Layer (Dashboard Container):
- React Application with TypeScript
- Key modules: Dashboard, Projects, Evaluations, Posts
- React Admin integration
- Recharts visualization components

B. Backend Layer (API Container):
- Node.js/Express application
- Three-layer architecture:
- HTTP/Routes layer (infrastructure/http)
- Service layer (application/services)
- Repository layer (infrastructure/repositories)
- Prisma ORM integration

C. Database Layer:
- MySQL database
- Prisma schema and migrations
- Core tables: Projects, Evaluations, Posts

- Rectangles: Main containers/services
- Hexagons: External services/interfaces

- Blue: Frontend components
- Green: Backend components
- Yellow: Database components
- Gray: External services/infrastructure

##### Component Relationships

**User Interface ─→ Frontend Container**
- → Dashboard Module
- → Projects Module
- → Evaluations Module
- → Posts Module

**Frontend Container ─→ Backend Container (REST API)**
- → HTTP Routes Layer
- → Project Router
- → Evaluation Router
- → Post Router

- → Service Layer
- → Project Service
- → Evaluation Service
- → Post Service

- → Repository Layer
- → Prisma Project Repository
- → Prisma Evaluation Repository
- → Prisma Post Repository

**Backend Container ─→ Database Container**
- → MySQL Database (via Prisma ORM)

##### Additional Elements

A. Infrastructure Components:
- Docker containers (show containerization boundary)
- Docker Compose networking
- Cloud deployment options (GCP Cloud Run & Cloud SQL)

B. Cross-Cutting Concerns:
- Authentication flow
- Error handling
- Logging

##### Specific Implementation Details

Following key architectural patterns:
- Repository Pattern implementation
- Service Layer abstraction
- Domain Models structure
- React Admin integration points

##### Deployment View

A separate section showing:
- Development environment (localhost setup)
- Production environment (GCP deployment)
- Container orchestration

##### Notes

- Clean architecture approach in the backend
- Separation of concerns between layers
- Data flow for key operations (e.g., evaluation creation)
- Version information for major components
- Points of scalability and potential bottlenecks

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "User Interface"
        UI[User Interface]
    end

    subgraph "Frontend Container"
        Dashboard["Dashboard Module"]:::frontend
        Projects["Projects Module"]:::frontend
        Evaluations["Evaluations Module"]:::frontend
        Posts["Posts Module"]:::frontend
    end

    subgraph "Backend Container"
        subgraph "HTTP Routes Layer"
            ProjectRouter["Project Router"]:::backend
            EvalRouter["Evaluation Router"]:::backend
            PostRouter["Post Router"]:::backend
        end

        subgraph "Service Layer"
            ProjectService["Project Service"]:::backend
            EvalService["Evaluation Service"]:::backend
            PostService["Post Service"]:::backend
        end

        subgraph "Repository Layer"
            ProjectRepo["Project Repository"]:::backend
            EvalRepo["Evaluation Repository"]:::backend
            PostRepo["Post Repository"]:::backend
        end

        subgraph "Domain Models"
            ProjectModel["Project Model"]:::backend
            EvalModel["Evaluation Model"]:::backend
            PostModel["Post Model"]:::backend
        end
    end

    subgraph "Database Layer"
        DB[(MySQL Database)]:::database
        PrismaSchema["Prisma Schema"]:::database
        DBMigrations["Database Migrations"]:::database
    end

    %% Relationships
    UI --> Dashboard & Projects & Evaluations & Posts

    Dashboard & Projects & Evaluations & Posts --> ProjectRouter & EvalRouter & PostRouter

    ProjectRouter --> ProjectService
    EvalRouter --> EvalService
    PostRouter --> PostService

    ProjectService --> ProjectRepo
    EvalService --> EvalRepo
    PostService --> PostRepo

    ProjectRepo & EvalRepo & PostRepo --> DB
    PrismaSchema --> DB
    DBMigrations --> DB

    ProjectService --> ProjectModel
    EvalService --> EvalModel
    PostService --> PostModel

    %% Click Events
    click Dashboard "https://github.com/guplem/Dashboard-ReactNodeSQL/tree/main/dashboard/src/modules/dashboard/"
    click Projects "https://github.com/guplem/Dashboard-ReactNodeSQL/tree/main/dashboard/src/modules/projects/"
    click Evaluations "https://github.com/guplem/Dashboard-ReactNodeSQL/tree/main/dashboard/src/modules/evaluations/"
    click Posts "https://github.com/guplem/Dashboard-ReactNodeSQL/tree/main/dashboard/src/modules/posts/"
    
    click ProjectRouter "https://github.com/guplem/Dashboard-ReactNodeSQL/blob/main/api/src/infrastructure/http/routes/projectRouter.ts"
    click EvalRouter "https://github.com/guplem/Dashboard-ReactNodeSQL/blob/main/api/src/infrastructure/http/routes/evaluationRouter.ts"
    click PostRouter "https://github.com/guplem/Dashboard-ReactNodeSQL/blob/main/api/src/infrastructure/http/routes/postRouter.ts"
    
    click ProjectService "https://github.com/guplem/Dashboard-ReactNodeSQL/blob/main/api/src/application/services/projectService.ts"
    click EvalService "https://github.com/guplem/Dashboard-ReactNodeSQL/blob/main/api/src/application/services/evaluationService.ts"
    click PostService "https://github.com/guplem/Dashboard-ReactNodeSQL/blob/main/api/src/application/services/postService.ts"
    
    click ProjectRepo "https://github.com/guplem/Dashboard-ReactNodeSQL/blob/main/api/src/infrastructure/repositories/prismaProjectRepository.ts"
    click EvalRepo "https://github.com/guplem/Dashboard-ReactNodeSQL/blob/main/api/src/infrastructure/repositories/prismaEvaluationRepository.ts"
    click PostRepo "https://github.com/guplem/Dashboard-ReactNodeSQL/blob/main/api/src/infrastructure/repositories/prismaPostRepository.ts"
    
    click PrismaSchema "https://github.com/guplem/Dashboard-ReactNodeSQL/blob/main/api/prisma/schema.prisma"
    click DBMigrations "https://github.com/guplem/Dashboard-ReactNodeSQL/tree/main/api/prisma/migrations/"
    
    click ProjectModel "https://github.com/guplem/Dashboard-ReactNodeSQL/blob/main/api/src/domain/models/project.ts"
    click EvalModel "https://github.com/guplem/Dashboard-ReactNodeSQL/blob/main/api/src/domain/models/evaluation.ts"
    click PostModel "https://github.com/guplem/Dashboard-ReactNodeSQL/blob/main/api/src/domain/models/post.ts"

    %% Styles
    classDef frontend fill:#2196F3,stroke:#1565C0,color:white
    classDef backend fill:#4CAF50,stroke:#2E7D32,color:white
    classDef database fill:#FFC107,stroke:#FFA000,color:black

    %% Legend
    subgraph Legend
        Frontend["Frontend Component"]:::frontend
        Backend["Backend Component"]:::backend
        Database["Database Component"]:::database
    end
```
