# pranav-8660/aws-ec2-instances-manager architecture

> Architecture diagram of the GitHub repository pranav-8660/aws-ec2-instances-manager, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/pranav-8660/aws-ec2-instances-manager
- Repository: https://github.com/pranav-8660/aws-ec2-instances-manager

## Overview

##### Main Components
- Frontend:
- Located in the “frontend” directory.
- Contains files like App.js and EC2Manager.jsx, which indicate the React-based User Interface.
- Backend:
- Located in the “backend” directory.
- “main.py” serves as the main module which, based on the README instructions, operates using FastAPI and Uvicorn.
- Infrastructure (Terraform):
- Inside the “backend/infrastructure” directory.
- “main.tf” configures AWS EC2 resources.
- External Services:
- AWS is a key external dependency, used both for EC2 instance management (via Terraform in the backend) and likely for the overall operations.

##### Relationships and Data Flows
- User Interface (Frontend) interacts with the Backend via API calls.
- Backend handles business logic to manage EC2 instances.
- Terraform scripts (main.tf) provision and manage the AWS EC2 instances, likely triggered or configured via the backend.
- That proper AWS credentials must be configured for backend operations.

##### Architectural Patterns and Principles
- Separation of Concerns: Clear separation into frontend (React-based UI) and backend (FastAPI-based API & business logic).
- Infrastructure as Code: Terraform scripts for AWS resource management.

##### Technologies and Frameworks
- Frontend: React (React’s components like App.js and EC2Manager.jsx); Node.js/npm for dependency management and development.
- Backend: Python with FastAPI, powered by Uvicorn.
- Infrastructure: Terraform for provisioning AWS EC2 instances.
- External: AWS (EC2 instances) and AWS CLI for credentials management.

##### Final Touches
- Every component is clearly annotated with names and functions.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Nodes
    User["User"]:::user
    subgraph "Frontend (React UI)"
        AppJS["App.js"]:::frontend
        EC2Manager["EC2Manager.jsx"]:::frontend
    end
    subgraph "Backend (FastAPI API & Business Logic)"
        BE_main["main.py"]:::backend
    end
    subgraph "Infrastructure (Terraform AWS Resource Configuration)"
        INF_main["main.tf"]:::infra
    end
    AWS["AWS EC2 Instances"]:::aws

    %% Relationships
    User -->|"uses"| AppJS
    EC2Manager -->|"APICall"| BE_main
    BE_main -->|"triggers"| INF_main
    INF_main -->|"provisions"| AWS

    %% Click Events
    click AppJS "https://github.com/pranav-8660/aws-ec2-instances-manager/blob/main/frontend/App.js"
    click EC2Manager "https://github.com/pranav-8660/aws-ec2-instances-manager/blob/main/frontend/EC2Manager.jsx"
    click BE_main "https://github.com/pranav-8660/aws-ec2-instances-manager/blob/main/backend/main.py"
    click INF_main "https://github.com/pranav-8660/aws-ec2-instances-manager/blob/main/backend/infrastructure/main.tf"

    %% Styles
    classDef user fill:#f9c,stroke:#333,stroke-width:2px;
    classDef frontend fill:#add8e6,stroke:#333,stroke-width:2px;
    classDef backend fill:#90ee90,stroke:#333,stroke-width:2px;
    classDef infra fill:#ffff99,stroke:#333,stroke-width:2px,stroke-dasharray: 5 5;
    classDef aws fill:#ffcc99,stroke:#333,stroke-width:2px;
```
