Skip to content

Latest commit

 

History

52 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Easy MC Server — Backend

Monorepo for a Rust backend API that hosts and controls Minecraft servers.

Project structure

Cargo.toml                 # Workspace root
backend/
├── Cargo.toml             # HTTP API server (axum + sqlite)
├── build.rs               # Builds + embeds the web UI into the binary
├── src/                   # Auth, middleware, serve, settings, ...
├── docs/api.md            # Full API endpoint reference
├── data/                  # Runtime data (app.db, settings.json, blacklist.json)
├── mc-server-manager/     # Library crate: spawn & control MC server processes
│   ├── Cargo.toml
│   └── src/lib.rs         # ServerConfig, ServerInstance API
└── mc-gateway/            # Library crate: sleep mode, wake-on-connect, IP policy,
    └── src/lib.rs         # DDoS protection (see docs/mc-gateway.md)

Quick start

# Build everything from the workspace root.
# build.rs automatically builds the frontend (bun if available, else npm)
# and bundles it into the binary — no manual steps needed.
cargo build

# Create the first admin user
./target/debug/eazymc-backend create-sudo --username admin

# Start the API server — the bundled web UI is served on / as well
RUST_LOG=info ./target/debug/eazymc-backend serve
# → open http://localhost:3000

Web UI

The frontend is a static SPA (adapter-static, ssr=false). backend/build.rs rebuilds it on every cargo build and embeds frontend/build into the binary:

  • dependencies are installed automatically when missing or stale (bun install / npm install)
  • frontend source changes trigger a rebuild (cargo:rerun-if-changed tracks src/, static/ and the configs)
  • if the frontend directory is absent, the binary embeds a placeholder page instead (the API still works)

The backend serves the embedded UI on every non-/api/* path with an index.html SPA fallback (deep links like /servers/<id>/console work), so UI + API come from a single process and port. Hashed assets under _app/immutable/ get Cache-Control: immutable.

The same frontend/build output can also be deployed to Cloudflare Pages (static assets + _redirects for SPA fallback).

See backend/docs/api.md for the full API reference. See backend/docs/external_apis.md for server-software download APIs. See backend/docs/server_software_guide.md for how to obtain and install each server platform. See backend/docs/mc-server-installer.md for the installer crate API. See backend/docs/mc-gateway.md for the gateway (sleep mode / IP policy / DDoS protection) config and API.

Workspace members

Crate Path Description
backend backend/ HTTP API server — auth, fail2ban, settings
mc-server-manager backend/src/mc-server-manager/ Library for launching/managing MC server JAR processes
mc-server-installer backend/src/mc-server-installer/ Library for downloading MC server software from multiple sources
mc-gateway backend/src/mc-gateway/ TCP middleware: sleep mode, wake-on-connect, idle stop, IP black/white lists, DDoS protection

About

A simple minecraft server hosting + managing tool for linux

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages