# yukihiradeve/webservercontroller architecture

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

- Interactive diagram: https://gitdiagram.com/yukihiradeve/webservercontroller
- Repository: https://github.com/yukihiradeve/webservercontroller

## Overview

The Minecraft Server Manager is a full-stack project with a clear separation between a Node.js API backend and a React-based frontend. The backend, which handles server management tasks through dedicated routes and shell scripts, interacts with external processes and dependencies (Java, Python, and the Debian environment) to manage Minecraft servers. The frontend, on the other hand, provides the user interface and integrates Three.js for 3D visualization of the Minecraft maps.

##### Main Components
- Frontend: A React application (with Tailwind CSS and Three.js integration) that includes UI components (e.g., MinecraftControl, MinecraftModelLoader, ServerList, etc.) and pages (e.g., ServerPanel).
- Backend: A Node.js Express application with middleware (e.g., authenticate), routes (e.g., minecraft.js, system-stats.js), and an API layer exposing endpoints to manage operations such as /create, /shutdown, /export, /modify, etc.
- Server Scripts: A collection of shell scripts (e.g., createServer.sh, startServer.sh, shutdownServer.sh, exportMap.sh, etc.) used to perform the actual server management tasks.
- External / Third-party Tools: Components such as the Python script (SpawnCoordinate.py) and the jar file (jMc2Obj) used in exporting 3D models.
- System/Environment Dependencies: The project requires Debian or macOS, Node.js, Java, and Python.

##### Relationships and Interactions
- The Frontend calls the Backend API endpoints to trigger operations (e.g., creating, modifying, exporting, or shutting down a server).
- The Backend processes HTTP requests and, based on routes, invokes corresponding shell scripts and other external executables. For instance, a request to export server data might trigger the exportMap.sh script which, in turn, may use jMc2Obj for converting Minecraft data.
- Middleware (e.g., for authentication) intercepts requests in the backend to ensure security.
- The output from these scripts and tools is then relayed back through the API to the frontend or stored/logged as needed.

##### Architectural Patterns
- Separation of Concerns: The clear division between frontend and backend, where each handles a distinct part of functionality.
- API-Driven Design: The backend exposes RESTful endpoints that encapsulate the business logic and interact with system-level operations.
- Modular Design: With scripts for different functionalities and a modular React component structure, the project is built to be extensible and maintainable.

##### Relevant Technologies
- Frontend: React, Three.js, Tailwind CSS.
- Backend: Node.js, Express (assumed from the file structure), and middleware for API protection.
- Scripts: Shell scripting for UNIX systems.
- External Tools: Python for specific tasks (SpawnCoordinate.py) and Java (jMc2Obj) for 3D export.

##### Elements
- Labels for external dependencies: “Java (jMc2Obj), Python (SpawnCoordinate.py)” and note how these integrate into the backend’s export system.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Layer
    subgraph "Frontend (React & Three.js)"
        a1("React Application"):::frontend
        a2("UI Components"):::frontend
        a3("ServerPanel Page"):::frontend
    end

    %% Backend Layer
    subgraph "Backend (Node.js API)"
        b1("App (app.js)"):::backend
        b2("Middleware (authenticate.js)"):::backend
        subgraph "Routes"
            b3("Minecraft Route (minecraft.js)"):::backend
            b4("System Stats Route (system-stats.js)"):::backend
        end
        b5("API Endpoints (/create, /shutdown, /export, /modify)"):::backend
    end

    %% Server Management Scripts
    subgraph "Server Management Scripts"
        s1("Shell Scripts"):::scripts
    end

    %% External Tools
    subgraph "External Tools"
        e1("Python Script (SpawnCoordinate.py)"):::external
        e2("Java Tool (jMc2Obj)"):::external
    end

    %% Connections
    a1 -->|"API_Call"| b5
    b1 -->|"applies"| b2
    b1 -->|"handles"| b3
    b1 -->|"handles"| b4
    b2 -->|"secures"| b5
    b5 -->|"triggers"| s1
    b5 -->|"uses_export"| e1
    b5 -->|"uses_export"| e2

    %% Click Events
    click a1 "https://github.com/yukihiradeve/webservercontroller/tree/master/frontend/"
    click a2 "https://github.com/yukihiradeve/webservercontroller/tree/master/frontend/src/components/"
    click a3 "https://github.com/yukihiradeve/webservercontroller/blob/master/frontend/src/pages/ServerPanel.js"
    click b1 "https://github.com/yukihiradeve/webservercontroller/blob/master/Backend/app.js"
    click b2 "https://github.com/yukihiradeve/webservercontroller/blob/master/Backend/middleware/authenticate.js"
    click b3 "https://github.com/yukihiradeve/webservercontroller/blob/master/Backend/routes/minecraft.js"
    click b4 "https://github.com/yukihiradeve/webservercontroller/blob/master/Backend/routes/system-stats.js"
    click s1 "https://github.com/yukihiradeve/webservercontroller/tree/master/Backend/scripts/"
    click e1 "https://github.com/yukihiradeve/webservercontroller/blob/master/Backend/export/SpawnCoordinate.py"
    click e2 "https://github.com/yukihiradeve/webservercontroller/blob/master/Backend/export/jMc2Obj-124.jar"

    %% Styles
    classDef frontend fill:#B3E5FC,stroke:#0288D1,stroke-width:2px;
    classDef backend fill:#C8E6C9,stroke:#2E7D32,stroke-width:2px;
    classDef scripts fill:#FFF9C4,stroke:#FBC02D,stroke-width:2px;
    classDef external fill:#FFCDD2,stroke:#C62828,stroke-width:2px;
```
