local-preview

command module
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 6, 2026 License: GPL-3.0 Imports: 3 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README ΒΆ

local-preview

Test status Deploy Status Docs Go Reference PyPI

A local-first preview-deployment orchestrator: every commit of a registered git repository becomes a servable preview at its own subdomain (<sha>.<repo>.preview.localhost:8080), built once, deduplicated by content, and served from a single binary.

local-preview resolves each commit into a (frontend artifact, backend artifact) pair by content-addressing the relevant subtrees. Commits that don't touch the frontend (or backend) reuse the existing artifact β€” and the already-running backend process. Backend state follows git lineage: a new backend version forks its data from the nearest deployed ancestor, so previews feel continuous on a straight line of commits while divergent branches can never corrupt each other.

Install

uv tool install local-preview

This installs the binary to ~/.local/bin/preview. Make sure to have that on your PATH.

Run

preview serve

The server listens on :8080. Open http://localhost:8080/ for the dashboard.

Or with Docker:

docker compose up -d --build

Develop

# Backend on :8080 (wgo restarts on save; plain `go run` works too)
wgo run . serve

# Frontend on :5173, proxying /api to the backend
cd web && npm install && npm run dev
Docs site

The docs/ VitePress site deploys to GitHub Pages automatically: pushes to master that touch docs/** run .github/workflows/docs.yml, which builds the site and publishes it through the Pages Actions deploy (no gh-pages branch). Run it locally with:

cd docs && npm install && npm run docs:dev   # http://localhost:5175

See CLAUDE.md for the full development reference (tests, lint, E2E, docs conventions).

πŸ“– Documentation

Full documentation lives at https://jmelahman.github.io/local-preview/:

  • Quickstart β€” register a repo, deploy a commit, open the preview.
  • Configuration β€” flags and env vars.
  • REST API β€” endpoints exposed by the running server.
  • CLI β€” serve, repo, deploy, install-hook.

Documentation ΒΆ

The Go Gopher

There is no documentation for this package.

Directories ΒΆ

Path Synopsis
cmd
internal
api
Package api defines the HTTP surface served at the apex host: JSON endpoints under /api/ plus the embedded dashboard SPA at /.
Package api defines the HTTP surface served at the apex host: JSON endpoints under /api/ plus the embedded dashboard SPA at /.
build
Package build turns deploy requests into published artifacts.
Package build turns deploy requests into published artifacts.
client
Package client is a small HTTP client for the app's REST API, used by the CLI subcommands in cmd/server.
Package client is a small HTTP client for the app's REST API, used by the CLI subcommands in cmd/server.
config
Package config resolves where the application keeps its on-disk state.
Package config resolves where the application keeps its on-disk state.
db
Package db wraps the SQLite store.
Package db wraps the SQLite store.
dockerapi
Package dockerapi is a deliberately tiny Docker Engine API client β€” plain HTTP over the unix socket, no SDK dependency β€” sufficient to run one-shot build-step containers: ensure an image, create/start a container, stream its output, wait, remove.
Package dockerapi is a deliberately tiny Docker Engine API client β€” plain HTTP over the unix socket, no SDK dependency β€” sufficient to run one-shot build-step containers: ensure an image, create/start a container, stream its output, wait, remove.
gitrepo
Package gitrepo manages the orchestrator's mirror clones and exposes the git plumbing the pipeline needs: ref resolution, tree listing (for content addressing), file reads at a commit, ancestry walks, and tree extraction.
Package gitrepo manages the orchestrator's mirror clones and exposes the git plumbing the pipeline needs: ref resolution, tree listing (for content addressing), file reads at a commit, ancestry walks, and tree extraction.
hashkey
Package hashkey computes the content-address of a commit's frontend and backend partitions.
Package hashkey computes the content-address of a commit's frontend and backend partitions.
manifest
Package manifest parses preview.toml, the contract a target repository declares so the orchestrator can build and run it.
Package manifest parses preview.toml, the contract a target repository declares so the orchestrator can build and run it.
proxy
Package proxy is the top-level request router.
Package proxy is the top-level request router.
store
Package store owns on-disk content-addressed artifacts and mutable backend state directories.
Package store owns on-disk content-addressed artifacts and mutable backend state directories.
supervise
Package supervise owns backend process lifecycles: one process per distinct backend artifact per repo, started on demand, health-checked, and killed as a process group.
Package supervise owns backend process lifecycles: one process per distinct backend artifact per repo, started on demand, health-checked, and killed as a process group.
Package orchestrator is the embeddable API of local-preview: everything the standalone server does β€” mirror clones, content-addressed builds, on-demand supervised backends, lineage-forked state, Host-header preview routing β€” behind a small facade another Go application can wire into its own HTTP server.
Package orchestrator is the embeddable API of local-preview: everything the standalone server does β€” mirror clones, content-addressed builds, on-demand supervised backends, lineage-forked state, Host-header preview routing β€” behind a small facade another Go application can wire into its own HTTP server.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL