Skip to content

Development

Peter J McDade edited this page Feb 2, 2026 · 2 revisions

πŸ”§ Development

For those who want to expand the factory and contribute blueprints!


πŸ—οΈ Architecture

The backend is a Go REST API that also serves the React frontend.

Route Description
/ 🌐 Frontend application
/api/* βš™οΈ REST API endpoints
/ws πŸ“‘ WebSocket for real-time updates

πŸ” API Authentication

Before accessing the API, you need to authenticate (like inserting a keycard):

# Login and save cookie
curl --cookie-jar cookie.txt --insecure \
  --data '{"username":"admin","password":"factorio"}' \
  -H "Content-Type: application/json" \
  -X POST https://localhost/api/login

# Use the cookie for subsequent requests
curl --cookie cookie.txt --insecure https://localhost/api/server/status

πŸ“¦ Requirements

Tool Version
🐹 Go 1.11+
πŸ“¦ NodeJS 10.13.0+

πŸš€ Building Releases

Create release zips for Windows and Linux:

git clone git@github.com:petejm/factorio-server-manager.git
cd factorio-server-manager
make gen_release

This produces:

  • build/factorio-server-manager-linux.zip
  • build/factorio-server-manager-windows.zip

πŸ”¨ Building for Development

Quick build for testing:

git clone git@github.com:petejm/factorio-server-manager.git
cd factorio-server-manager
make
./factorio-server-manager/factorio-server-manager --dir /path/to/factorio

βš›οΈ Frontend Development

The frontend uses React with Webpack.

Build Commands

Command Description
npm run dev πŸ”§ Development build with source maps
npm run watch πŸ‘€ Auto-rebuild on file changes
npm run hot πŸ”₯ Hot reload (in theory)
npm run build πŸ“¦ Production build (minified)

Quick Start

cd factorio-server-manager
npm install
npm run watch  # In one terminal

# In another terminal, run the Go server
cd src && go run . --dir /path/to/factorio

Output files:

  • app/bundle.js β€” Transpiled JavaScript
  • app/style.css β€” Compiled styles

πŸͺŸ Building for Windows

  1. πŸ“₯ Download and unzip the source code

  2. πŸ“¦ Install requirements:

  3. πŸ”¨ Build the backend:

    cd factorio-server-manager\src
    go build
  4. 🎨 Build the frontend:

    cd factorio-server-manager
    npm install
    npm run build
  5. πŸš€ Run:

    .\src.exe --dir C:\path\to\Factorio
  6. 🌐 Visit localhost:8080


πŸ“ Project Structure

factorio-server-manager/
β”œβ”€β”€ app/                    # 🌐 Built frontend assets
β”œβ”€β”€ docker/                 # 🐳 Docker configurations
β”œβ”€β”€ src/                    # 🐹 Go backend source
β”‚   β”œβ”€β”€ api/               # REST API handlers
β”‚   β”œβ”€β”€ bootstrap/         # Configuration & startup
β”‚   └── factorio/          # Factorio server control
β”œβ”€β”€ ui/                     # βš›οΈ React frontend source
β”‚   β”œβ”€β”€ App/               # React components
β”‚   └── api/               # API client
β”œβ”€β”€ Makefile               # πŸ”¨ Build automation
└── conf.json              # βš™οΈ Default configuration

🀝 Contributing

  1. 🍴 Fork the repository
  2. 🌿 Create a feature branch
  3. πŸ’» Make your changes
  4. βœ… Test thoroughly
  5. πŸ“¬ Submit a pull request

The factory always has room for more engineers! πŸ‘·