# amanraj4482/radiant-future-ai architecture

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

- Interactive diagram: https://gitdiagram.com/amanraj4482/radiant-future-ai
- Repository: https://github.com/amanraj4482/radiant-future-ai

## Overview

##### Main System Components

a) Client Layer:
- Frontend web application (HTML/CSS/JS)
- User interface components (dashboard, calculator, reports)

b) API Gateway Layer:
- External APIs integration points (OpenWeather, Geocode, NASA)
- Authentication layer (Firebase)

c) Backend Services:
- Node.js server components
- Controller modules (auth, CO2 footprint, energy consumption, ROI)
- Route handlers

d) ML Component:
- Random Forest Regression model
- Data preprocessing pipeline
- Model evaluation system

e) Data Layer:
- MongoDB database
- Data models (User, EnergyUsage, Reports, SolarRecommendation)
- Static data files (power consumption, emission factors)

##### Component Relationships

- User interactions → Frontend
- Frontend → API Gateway
- API Gateway → Backend Services
- Backend Services → ML Component
- Backend Services ↔ Database
- External APIs → Backend Services

##### Specific Implementation Details

Technical elements:
- Frontend static assets structure (CSS, JS, images)
- Backend MVC pattern (models, controllers, routes)
- ML model pipeline (data preprocessing → training → evaluation)
- Authentication flow with Firebase
- Database schema relationships

##### Deployment Components

Include:
- Docker containers (reference Dockerfile and docker-compose.yml)
- Server configuration
- Database connections
- API endpoints

##### External Services Layer

Remember to maintain a balance between high-level architecture and important implementation details, focusing on the unique aspects of this solar panel recommendation system, particularly the ML component and its integration with the rest of the application.

## 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 ml fill:#9b59b6,stroke:#8e44ad,color:white
    classDef external fill:#f1c40f,stroke:#f39c12,color:black
    classDef database fill:#e67e22,stroke:#d35400,color:white
    classDef auth fill:#e74c3c,stroke:#c0392b,color:white

    %% Frontend Layer
    subgraph Frontend
        UI[User Interface]
        Dashboard[Dashboard]:::frontend
        Calculator[Solar Calculator]:::frontend
        Reports[Reports]:::frontend
        Assets[Static Assets]:::frontend
    end

    %% API Gateway Layer
    subgraph APIGateway
        Auth[Authentication]:::auth
        ExternalAPIs[External APIs]:::external
        Gateway[API Gateway]:::backend
    end

    %% Backend Services Layer
    subgraph BackendServices
        Server[Node.js Server]:::backend
        Controllers[Controllers]:::backend
        Routes[Route Handlers]:::backend
    end

    %% ML Component Layer
    subgraph MLComponent
        Model[Random Forest Model]:::ml
        Preprocessing[Data Preprocessing]:::ml
        Evaluation[Model Evaluation]:::ml
    end

    %% Data Layer
    subgraph DataLayer
        MongoDB[(MongoDB)]:::database
        StaticData[Static Data Files]:::database
        DataModels[Data Models]:::database
    end

    %% External Services
    OpenWeather[OpenWeather API]:::external
    Geocode[Geocode API]:::external
    NASA[NASA API]:::external

    %% Relationships
    UI --> Dashboard
    UI --> Calculator
    UI --> Reports
    Frontend --> Gateway
    Gateway --> Auth
    Gateway --> ExternalAPIs
    ExternalAPIs --> OpenWeather
    ExternalAPIs --> Geocode
    ExternalAPIs --> NASA
    Gateway --> Server
    Server --> Controllers
    Server --> Routes
    Controllers --> Model
    Model --> Preprocessing
    Model --> Evaluation
    Controllers --> MongoDB
    MongoDB --> DataModels
    StaticData --> Controllers

    %% Click Events
    click UI "https://github.com/Amanraj4482/Radiant-Future-AI/tree/main//frontend/"
    click Dashboard "https://github.com/Amanraj4482/Radiant-Future-AI/blob/main//frontend/userDashboard.html"
    click Calculator "https://github.com/Amanraj4482/Radiant-Future-AI/blob/main//frontend/userSolarPotentialCalculator.html"
    click Assets "https://github.com/Amanraj4482/Radiant-Future-AI/blob/main//frontend/css/style.css"
    click Model "https://github.com/Amanraj4482/Radiant-Future-AI/blob/main//ML/Solar_Potential_Prediction.ipynb"
    click Server "https://github.com/Amanraj4482/Radiant-Future-AI/blob/main//backend/server.js"
    click Routes "https://github.com/Amanraj4482/Radiant-Future-AI/tree/main//backend/routes/"
    click Controllers "https://github.com/Amanraj4482/Radiant-Future-AI/tree/main//backend/controllers/"
    click DataModels "https://github.com/Amanraj4482/Radiant-Future-AI/tree/main//backend/models/"
    click StaticData "https://github.com/Amanraj4482/Radiant-Future-AI/tree/main//backend/data/"
    click Auth "https://github.com/Amanraj4482/Radiant-Future-AI/blob/main//backend/config/auth.js"
    click MongoDB "https://github.com/Amanraj4482/Radiant-Future-AI/blob/main//backend/config/db.js"

    %% Legend
    subgraph Legend
        Frontend_L[Frontend]:::frontend
        Backend_L[Backend]:::backend
        ML_L[Machine Learning]:::ml
        External_L[External Services]:::external
        Database_L[Database]:::database
        Auth_L[Authentication]:::auth
    end
```
