Skip to content

Repository files navigation

Minecraft Remote Pilot

This project is a web-based dashboard for remotely managing a local Minecraft server. It provides a user-friendly interface to start, stop, and interact with your server's console, as well as monitor its performance in real-time.

Architecture

The application works by connecting a web-based frontend to a local API "bridge" that you will run on the same machine as your Minecraft server. This setup allows the web interface to securely control and monitor the server.

The system has three main components:

  1. Frontend (This Project): A Next.js application that provides the user interface in your browser. It communicates with the API Bridge.
  2. API Bridge: A simple local server (e.g., built with Node.js/Express) that you need to create. It receives commands from the frontend and executes them on your machine (like starting the Minecraft server process). It also reads server logs and performance data and sends them back to the frontend.
  3. Minecraft Server: Your standard Java Minecraft server (server.jar).
[Web Browser] <--> [Frontend (Next.js)] <--> [API Bridge (Node.js)] <--> [Minecraft Server]
    (UI)           (This project)           (Listens on localhost:3001)    (Runs on your PC)

Setup and Configuration

Follow these steps to get the full application running.

1. Frontend Setup (This Project)

The frontend is already configured. To run it, open a terminal and execute the following commands:

# Install all the necessary packages
npm install

# Run the development server
npm run dev

The application will be available at http://localhost:9002. You will see an error in the console (WebSocket error), which is expected until the API Bridge is running.

2. API Bridge Setup (Required)

You need to create a simple API server to act as a bridge. This server will listen for requests from the frontend and interact with your Minecraft server.

The frontend expects the API Bridge to be running on http://localhost:3001 and to expose the following endpoints:

POST /start

  • Action: Starts the Minecraft server process.
  • Details: Should execute the command to run your server.jar file (e.g., java -Xmx2G -Xms2G -jar server.jar nogui).

POST /stop

  • Action: Stops the Minecraft server.
  • Details: Should send the stop command to the running Minecraft server's standard input.

POST /command

  • Action: Sends a command to the Minecraft server.
  • Request Body: { "command": "your-command-here" }
  • Details: Should write the received command to the Minecraft server's standard input.

WebSocket Connection (ws://localhost:3001)

  • Action: The frontend will establish a WebSocket connection to this address to receive real-time updates.
  • The bridge should send JSON messages with the following type:
    • 'LOG': For new log lines from the server.
      • Payload: string (the log message)
    • 'STATUS_UPDATE': For real-time server metrics.
      • Payload: { serverState: 'online' | 'offline' | 'starting' | 'stopping', players: number, cpu: number, ram: number }
    • 'ERROR': To report an error to the frontend.
      • Payload: string (the error message)
    • 'INITIAL_STATE': To send the current server status right after the WebSocket connects.
      • Payload: { serverState, players, cpu, ram, logs: string[] }

You can find example implementations for this bridge server in various languages (like Node.js, Python, etc.) online. Search for "Node.js child process management" and "WebSockets".

3. Running the Full System

  1. Start the API Bridge: Run the local API server you created.
  2. Start the Frontend: Run npm run dev in this project's directory.
  3. Open the App: Navigate to http://localhost:9002 in your web browser.

You can now use the web interface to start, stop, and manage your Minecraft server!

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages