livedir

A static file server featuring atomic directory hot-swapping via a secured admin panel.

Go 1.25 Zero Dependency

Overview

Livedir is designed for scenarios where you need to serve multiple static sites and update them without SSH access, CI/CD pipelines, or server restarts.

It runs as a standalone binary, serving specified local directories on specific routes. It includes a built-in administrative interface that allows authenticated users to upload a .zip file, which Livedir uses to atomically replace the contents of a serving directory.

🔄 Atomic Swaps

Updates happen instantly via os.Rename. There is no period where files are missing or partially updated.

🔒 Built-in Auth

Includes a secure, session-based login system for the admin panel using standard HTTP-only cookies.

Installation

Install directly via Go:

go install github.com/phillip-england/livedir@latest

Usage

Start the server by specifying a port and the directories you want to serve:

# Serve ./site1 at /sites/site1/ and ./public at /sites/public/
livedir serve 8080 ./site1 ./public

Environment Variables

Variable Description Default
LIVEDIR_USER Username for the admin panel admin
LIVEDIR_PASS Password for the admin panel admin

Atomic Hot-Swapping

The core feature of Livedir is the ability to update a site without stopping the server. This is achieved via the Admin API.

  1. Navigate to /admin and log in.
  2. Select the directory you wish to update.
  3. Upload a .zip file containing the new build artifacts.
  4. Livedir extracts the zip to a temporary location.
  5. Livedir performs an atomic os.Rename operation, swapping the old directory for the new one instantly.

MIT License © 2026 Phillip England

View on GitHub