# nitayelzur/10play architecture

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

- Interactive diagram: https://gitdiagram.com/nitayelzur/10play
- Repository: https://github.com/nitayelzur/10play

## Overview

##### Main Components

A. Client-Side (Frontend):
- React + Vite application
- Key components:
- AddEntry component
- ViewEntries component
- Utils layer for data handling

B. Server-Side (Backend):
- Node.js/TypeScript server
- Controllers layer
- Routes layer
- AWS S3 integration

C. AWS Infrastructure:
- EC2 instance hosting both frontend and backend
- S3 bucket for data storage
- CloudFormation stack

**[Client Layer]**
- ↕️
**[Application Layer]**
- ↕️
**[Storage Layer]**

##### Component Relationships

- Frontend (port 5173) → Backend (port 3000) via HTTP/REST
- Backend → AWS S3 for data storage
- EC2 instance boundary containing both frontend and backend

##### Specific Elements

A. Frontend Container (EC2):
**┌─ Frontend (React + Vite) ─────┐**
- AddEntry Component         │
- ViewEntries Component      │
- Data Utils                 │
- ┘

B. Backend Container (EC2):
**┌─ Backend (Node.js/TS) ───────┐**
- Data Controllers           │
- API Routes                 │
- AWS SDK Integration        │
- ┘

C. AWS Services:
**┌─ AWS Infrastructure ─────────┐**
- EC2 Instance              │
- S3 Bucket                 │
- CloudFormation Stack      │
- ┘

##### Important Details to Highlight

- Environment Variables:
- VITE_SERVER for frontend
- AWS_BUCKET and AWS_REGION for backend
- Port mappings (3000 for backend, default Vite port for frontend)
- SSH access point to EC2
- Public IPv4 address access point

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph AWS["AWS Cloud Infrastructure"]
        direction TB
        subgraph EC2["EC2 Instance"]
            direction TB
            subgraph FrontEnd["Frontend Layer (React + Vite)"]
                direction TB
                App["Main App"]:::frontend
                AddEntry["AddEntry Component"]:::frontend
                ViewEntries["ViewEntries Component"]:::frontend
                DataUtils["Data Utils"]:::frontend
                MainEntry["Entry Point"]:::frontend
                ViteConfig["Vite Config"]:::frontend
                
                App --> AddEntry
                App --> ViewEntries
                AddEntry --> DataUtils
                ViewEntries --> DataUtils
                MainEntry --> App
            end

            subgraph BackEnd["Backend Layer (Node.js/TypeScript)"]
                direction TB
                Server["Main Server"]:::backend
                Controllers["Data Controllers"]:::backend
                Routes["API Routes"]:::backend
                TSConfig["TypeScript Config"]:::backend
                BuildServer["Built Server"]:::backend
                
                Server --> Controllers
                Server --> Routes
                Controllers --> Routes
                Server --> BuildServer
            end

            FrontEnd --> |"HTTP/REST (Port 3000)"| BackEnd
        end

        S3["S3 Bucket"]:::aws
        CloudFormation["CloudFormation Stack"]:::aws
        
        BackEnd --> |"AWS SDK"| S3
        CloudFormation --> EC2
    end

    %% Click Events
    click App "https://github.com/NitayElzur/10Play/blob/master/front/src/App.tsx"
    click AddEntry "https://github.com/NitayElzur/10Play/blob/master/front/src/Components/AddEntry/AddEntry.tsx"
    click ViewEntries "https://github.com/NitayElzur/10Play/blob/master/front/src/Components/ViewEntries/ViewEntries.tsx"
    click DataUtils "https://github.com/NitayElzur/10Play/blob/master/front/src/utils/data.ts"
    click Server "https://github.com/NitayElzur/10Play/blob/master/back/server.ts"
    click Controllers "https://github.com/NitayElzur/10Play/blob/master/back/controllers/data.ts"
    click Routes "https://github.com/NitayElzur/10Play/blob/master/back/routes/data.ts"
    click ViteConfig "https://github.com/NitayElzur/10Play/blob/master/front/vite.config.ts"
    click TSConfig "https://github.com/NitayElzur/10Play/blob/master/back/tsconfig.json"
    click MainEntry "https://github.com/NitayElzur/10Play/blob/master/front/src/main.tsx"
    click BuildServer "https://github.com/NitayElzur/10Play/blob/master/back/build/server.js"

    %% Styles
    classDef frontend fill:#2196F3,color:white
    classDef backend fill:#4CAF50,color:white
    classDef aws fill:#FF9800,color:white
    
    %% Legend
    subgraph Legend
        Frontend["Frontend Component"]:::frontend
        Backend["Backend Component"]:::backend
        AWSService["AWS Service"]:::aws
    end
```
