# peter-gy/pluto architecture

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

- Interactive diagram: https://gitdiagram.com/peter-gy/pluto
- Repository: https://github.com/peter-gy/pluto

## Overview

##### Main Components

a. Frontend Applications:
- Survey Public (Vue.js application)
- Survey Admin (Next.js application)
- Survey Analysis (Streamlit application)

b. Backend Services:
- CMS (Strapi-based Content Management System)
- Database Service
- Database Admin Service

c. Shared Libraries:
- survey-model
- utils
- cli

##### Component Relationships and Architecture

Top Layer (Client Applications):
- Survey Public (Vue.js)
- Survey Admin (Next.js)
- Survey Analysis (Streamlit)

Middle Layer (API and Services):
- CMS Service (Strapi)
- API routes connecting to frontend applications
- Authentication flows

Bottom Layer (Data Layer):
- Database Service
- Database Admin Service
- Data flow connections

Shared Components (Side Layer):
- Libraries (survey-model, utils, cli)
- How they connect to other components

##### Specific Implementation Details

Use the following visual elements:
- Double lines for data flow
- Blue: Frontend applications
- Green: API services
- Yellow: Database services
- Gray: Shared libraries

##### Key Architectural Patterns to Highlight

- Microservices architecture (multiple independent applications)
- API-first approach (CMS with multiple consumers)
- Shared library pattern for common functionality
- Container-based deployment (note Docker configuration)

##### Additional Elements

- Authentication flow
- Content management flow
- Survey data flow
- Analysis pipeline

##### Technical Stack Indicators

Technology badges for:
- Vue.js (Survey Public)
- Next.js (Survey Admin)
- Streamlit (Analysis)
- Strapi (CMS)
- PostgreSQL (Database)
- Docker (Deployment)

##### Infrastructure Layer

Deployment configuration:
- Docker containers
- Development environment
- Production environment

##### Administrative flow

Remember to include version control and CI/CD aspects as they're evident from the .github workflow configurations in the repository.

This system design should clearly show how PLUTO functions as a comprehensive tool for assessing public value of data use, with its various interfaces and processing components working together cohesively.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Style Definitions
    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef api fill:#2ecc71,stroke:#27ae60,color:white
    classDef database fill:#f1c40f,stroke:#f39c12,color:black
    classDef library fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef container fill:#e74c3c,stroke:#c0392b,color:white

    %% Frontend Layer
    subgraph Frontend
        SP["Survey Public (Vue.js)"]
        SA["Survey Admin (Next.js)"]
        SAN["Survey Analysis (Streamlit)"]
    end
    class SP,SA,SAN frontend

    %% API Layer
    subgraph API
        CMS["CMS (Strapi)"]
        Auth["Authentication Service"]
        SurveyAPI["Survey API"]
        ResultsAPI["Results API"]
        QuestionsAPI["Questions API"]
    end
    class CMS,Auth,SurveyAPI,ResultsAPI,QuestionsAPI api

    %% Database Layer
    subgraph Data
        DB["Database Service"]
        DBA["Database Admin Service"]
    end
    class DB,DBA database

    %% Shared Libraries
    subgraph Libraries
        SM["Survey Model"]
        Utils["Utils Library"]
        CLI["CLI Tools"]
    end
    class SM,Utils,CLI library

    %% Relationships
    SP --> SurveyAPI
    SP --> ResultsAPI
    SP --> QuestionsAPI
    SA --> Auth
    SA --> CMS
    SAN --> ResultsAPI
    
    SurveyAPI --> DB
    ResultsAPI --> DB
    QuestionsAPI --> DB
    Auth --> DB
    CMS --> DB
    DBA --> DB

    SM --> SP
    SM --> SA
    SM --> SAN
    Utils --> SP
    Utils --> SA
    Utils --> SAN
    CLI --> DBA

    %% Click Events
    click SP "https://github.com/peter-gy/PLUTO/tree/main/apps/survey-public"
    click SA "https://github.com/peter-gy/PLUTO/tree/main/apps/survey-admin"
    click SAN "https://github.com/peter-gy/PLUTO/tree/main/apps/survey-analysis"
    click CMS "https://github.com/peter-gy/PLUTO/tree/main/apps/cms"
    click DB "https://github.com/peter-gy/PLUTO/tree/main/services/db"
    click DBA "https://github.com/peter-gy/PLUTO/tree/main/services/db-admin"
    click SM "https://github.com/peter-gy/PLUTO/tree/main/libs/survey-model"
    click Utils "https://github.com/peter-gy/PLUTO/tree/main/libs/utils"
    click CLI "https://github.com/peter-gy/PLUTO/tree/main/libs/cli"
    click SurveyAPI "https://github.com/peter-gy/PLUTO/tree/main/apps/cms/src/api/survey"
    click ResultsAPI "https://github.com/peter-gy/PLUTO/tree/main/apps/cms/src/api/result"
    click QuestionsAPI "https://github.com/peter-gy/PLUTO/tree/main/apps/cms/src/api/question"
    click Auth "https://github.com/peter-gy/PLUTO/tree/main/apps/survey-admin/src/app/api/auth"

    %% Legend
    subgraph Legend
        F["Frontend Application"]:::frontend
        A["API Service"]:::api
        D["Database Service"]:::database
        L["Library"]:::library
    end
```
