Skip to content

Vitality Architecture Overview

Héla Ben Khalfallah edited this page Jan 7, 2025 · 7 revisions

Vitality leverages a modular architecture, where each component works in harmony to deliver efficient and comprehensive code analysis. The system is designed to ensure scalability, maintainability, and seamless integration with repositories.

┌──────────────────┐       ┌───────────────────────┐
│                  │       │                       │
│  BFB Main        │       │  BFB *Auditors        │
│  Analyzer        │──────▶│                       │
│                  │       │                       │
└──────────────────┘       └───────────────────────┘
       │                          │
       │                          │
       ▼                          ▼
┌────────────────────────────────────────┐
│                                        │
│              Persistence               │
│                                        │
└────────────────────────────────────────┘
       ▲                          ▲
       │                          │
       │                          │
┌──────┴──────────────────────────┴──────┐
│                                        │
│             BFF (R/W)                  │
│             (GraphQL, Node.js)         │
│                                        │
└────────────────────────────────────────┘
         ▲                  ▲
         │                  │
         │                  │
         ▼                  ▼
    ┌───────────────────┐  ┌──────────────────────────┐
    │                   │  │                          │
    │ Frontend (IHM)    │  │ Frontend (BO)            │
    │ (React, GraphQL)  │  │ (React, GraphQL, Refine) │
    │                   │  │                          │
    └───────────────────┘  └──────────────────────────┘

Component Descriptions

  • Frontend (IHM): The main user interface where you interact with Vitality, view reports, and manage your projects.
    • Built with React, Next.js, and GraphQL.
  • Frontend (BO): A back-office interface for managing static data and application settings.
    • Built with React, Next.js, Refine, and GraphQL.
  • BFF (GraphQL, Node.js): The Backend for Frontend acts as an intermediary between the frontends and the backend (BFB), optimizing data access and communication using GraphQL.
  • Persistence (PSQL): The database used to store audit results and application data.
  • BFB Main Analyzer: The central component that orchestrates the auditing process. It triggers the BFB *Auditors based on code changes and configuration.
  • BFB Auditors: These modules focus on analyzing code (statically and dynamically) using a variety of tools:
    • ESLint: Checks for code style and quality issues.
    • SonarQube: Performs static code analysis to identify potential bugs and vulnerabilities.
    • Lighthouse: Audits website performance, accessibility, best practices, and SEO.
    • Other Tools: May include additional tools for security analysis, code duplication checks, and more.

Existing Auditors

Available BFB Auditors:

  1. v6y-bfb-static-code-auditor: Focuses on:
    • Code complexity
    • Coupling and modularity
    • Duplication detection
    • Security vulnerabilities
    • Dependency analysis
  2. v6y-bfb-devops-auditor: Evaluates:
    • DevOps metrics, including DORA metrics
  3. v6y-bfb-url-dynamic-auditor: Conducts analyses based on URL inputs, such as:
    • Lighthouse performance and accessibility audits

Interaction with Repositories

Vitality integrates seamlessly with Git-based repositories like GitHub and GitLab to monitor code changes, trigger analyses, and provide actionable feedback.

┌──────────────────┐       ┌──────────────────────────┐
│                  │       │                          │
│  GitHub          │       │  GitLab                  │
│  Repository      │       │  Repository              │
│                  │       │                          │
└──────────────────┘       └──────────────────────────┘
       ▲                          ▲
       │                          │
       │                          │
       └──────────────┬───────────┘
                      │
                      ▼
          ┌───────────────────────────┐
          │                           │
          │  BFB Main Analyzer        │
          │  (Triggers BFB            │
          │  auditors after interacting│
          │  with repositories)       │
          │                           │
          └───────────────────────────┘
                      │
                      ▼
          ┌───────────────────────────┐
          │                           │
          │  Launches BFB             │
          │  auditors for further     │
          │  analysis                 │
          │                           │
          └───────────────────────────┘

Auditing Workflow

The auditing workflow begins with the BFB Main Analyzer, which delegates specific tasks to the BFB Auditors. These auditors run various tools to evaluate code quality, performance, and compliance.

┌────────────────────────────┐
│                            │
│   BFB *Auditors            │
│   (Launched by Main        │
│   Analyzer)                │
│                            │
└───────────────┬────────────┘
                │
    ┌───────────┴─────────────┐
    ▼                         ▼
┌──────────────────┐    ┌────────────────────┐
│                  │    │                    │
│  ESLint          │    │  SonarQube         │
│  (Linting)       │    │  (Code Quality)    │
│                  │    │                    │
└──────────────────┘    └────────────────────┘
         │                         │
         ▼                         ▼
    ┌─────────────────────┐    ┌──────────────────┐
    │                     │    │                  │
    │  Lighthouse         │    │ Other Tools      │
    │  (Performance Audit)│    │ (Security, etc.) │
    │                     │    │                  │
    └─────────────────────┘    └──────────────────┘
                │
                ▼
        ┌─────────────────────────┐
        │                         │
        │  Generates Reports for  │
        │  Developers/Administrators │
        │                         │
        └─────────────────────────┘

Reporting and Persistence

  • Reports Generation: After completing the audits, the BFB Auditors generate detailed reports that summarize findings, highlight critical issues, and suggest improvements.
  • Persistence: Reports are stored in the database for easy access and retrieval.
  • Frontend Display: Developers and administrators can view these reports through the frontend interfaces.