livedir
A static file server featuring atomic directory hot-swapping via a secured admin panel.
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.
- Navigate to
/adminand log in. - Select the directory you wish to update.
- Upload a
.zipfile containing the new build artifacts. - Livedir extracts the zip to a temporary location.
- Livedir performs an atomic
os.Renameoperation, swapping the old directory for the new one instantly.
MIT License © 2026 Phillip England
View on GitHub