Skip to content

Development

blycr edited this page Feb 18, 2026 · 7 revisions

Development & Building

Prerequisites

  • Go: 1.25 or higher.
  • Node.js: Required for building frontend assets.
  • pnpm: Recommended (faster package manager). Installation:
    • Via corepack (built-in with Node.js 16.13+): corepack enable
    • Or via npm: npm install -g pnpm

Project Structure

msp/
├── cmd/
│   └── msp/
│       └── main.go      # Entry point
├── internal/            # Private application code
│   ├── config/          # Configuration logic
│   ├── db/              # Database layer
│   ├── handler/         # HTTP handlers
│   ├── media/           # Media processing
│   │   └── transcoder.go # FFmpeg transcoding logic
│   ├── server/          # Server core
│   └── web/             # Web embedding logic
├── web/
│   ├── src/             # Frontend source (JS/CSS)
│   ├── public/          # Static assets
│   ├── dist/            # Build output (gitignored)
│   └── vite.config.js   # Vite config
├── go.mod
└── config.example.json  # Config template

Build from Source

  1. Clone the repository:

    git clone https://github.com/blycr/msp.git
    cd msp
  2. Build Frontend:

    cd web
    pnpm install
    pnpm run build
    cd ..
  3. Build Backend:

    # Windows
    go build -o msp.exe ./cmd/msp
    
    # Linux
    go build -o msp ./cmd/msp

    Or use the PowerShell script (Windows):

    ./scripts/build.ps1

Multi-platform / Multi-architecture Build

Use the PowerShell script for automated cross-platform builds:

# Build for all platforms and architectures
./scripts/build.ps1 -Platforms windows,linux,macos -Architectures x64,arm64,x86,v7,v8

This will generate binaries in bin/, checksums in checksums/, and debug symbols in debug/.

For more details, see scripts/README.md.

Frontend Development

The frontend is located in web/src. It uses Vite for building.

  1. Run pnpm install in web/ directory.
  2. Run pnpm run dev for local development server (note: you might need to configure proxy to backend).
  3. Run pnpm run build to generate production assets in web/dist.

Dev Mode (Windows)

Use the provided dev script for a faster iteration loop:

.\scripts\dev.ps1
  • Backend will be built to bin/dev/msp-dev.exe and restarted automatically on *.go changes.
  • Dev config is bin/dev/config.json (created from config.example.json if missing).
  • Dev mode disables auto-opening the preview page by default.
  • Vite dev server is configured to listen on LAN (0.0.0.0), so you can open it on your phone:
    • http://<your-pc-lan-ip>:5173/

Clone this wiki locally