Skip to content

About

Every branch, its own universe. Self-hosted pull request previews with Docker Compose.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Branchverse banner

Latest stable release · Release notes

Branchverse

Every branch, its own universe.

Latest unreleased build (main): Latest unreleased build CI (main) Setup guide · Report an issue

Branchverse is a small, self-hosted server for preview environments. It runs every pull request of your GitHub repository as its own Docker Compose stack on its own host name, next to the branches that should always be available. Your CI builds the images; Branchverse runs them, keeps them current and removes them when the pull request is closed.

The overview page with the previews of the latest release, the default branch and three pull requests, one of them stopped

Installation

You need:

  • a Linux host (amd64 or arm64) with Docker 28 or newer, used for previews only,
  • a domain with a wildcard record, such as preview.example.com and *.preview.example.com (or *.example.com for one-level preview names),
  • a reverse proxy or tunnel that terminates TLS, keeps the Host header and controls access, and
  • CI that pushes an image of your application for every branch.

Run Branchverse with Docker Compose:

name: branchverse
services:
  branchverse:
    image: neokil/branchverse:latest
    command: ["--config", "/config/config.yaml"]
    group_add: ["999"] # the group of the Docker socket: stat -c %g /var/run/docker.sock
    ports:
      - "127.0.0.1:8080:8080"
    networks:
      default:
        gw_priority: 1
    volumes:
      - ./config:/config
      - data:/data
      - /var/run/docker.sock:/var/run/docker.sock
    read_only: true
    tmpfs: [/tmp]
    cap_drop: [ALL]
    security_opt: ["no-new-privileges:true"]
    pids_limit: 256
    restart: unless-stopped
    stop_grace_period: 30s
volumes:
  data:

Save this as compose.yaml, then run:

mkdir -p config/docker && sudo chown -R 65532 config
docker compose up -d        # creates config/config.yaml
sudoedit config/config.yaml # repository, image, domain, github_token
docker compose restart branchverse

Then:

  1. Add deploy/compose.branchverse.yml to your application repository; start from the example.
  2. Push an image for every branch from your CI.
  3. Route your reverse proxy for the domain and the preview host names to port 8080, and open the domain.

The previews and their state are kept in the data volume, the settings in ./config. The image is built from scratch and runs as user 65532. Images are published only when a GitHub release is published. latest follows stable releases; pin a version tag for reproducible deployments. See the setup guide, configuration and operations for private images, backup, restore and upgrades.

Security: Branchverse has no login. It controls the Docker daemon, which equals root access to the host, and runs the code of your pull requests. Protect it with your proxy, use a dedicated host and only preview repositories whose contributors you trust. Read the security notes before exposing it.

Features

  • A preview per pull request: feature-login.preview.example.com, or feature-login-preview.example.com, appears when a pull request for feature/login is opened and is removed with its data when it is closed. Pull requests from forks are ignored. With many open pull requests, they can wait to be started instead.
  • Persistent previews: latest runs the newest release and edge the default branch. Further branches can be listed in the configuration.
  • Your stack: every preview is its own Compose project, described by a file in the branch, with its own network and volumes. The file is checked against an allow-list, so it cannot reach the host.
  • Secrets stay out of the repository: shared variables from a file on the server can be passed to your services.
  • Always current: new commits and images are deployed automatically and keep the data. No webhooks are needed: GitHub never has to reach your server.
  • Faster from CI: with an API key, your pipeline can deploy a branch as soon as its image is pushed.
  • In your hands: start, stop and restart previews; start and restart pull the newest image. Delete one to have it created again from scratch, for example after a breaking change.
  • See what runs: the overview shows status, source commit, last update and logs, and whether an image was built from the latest commit.
  • Easy on the host: one container and one configuration file. Unused images are deleted after a day.

On the overview page, open API key to create the key for CI; see refresh from CI. A stopped preview stays stopped, also across new commits, until you start it or its pull request is closed.

License

Branchverse is licensed under the MIT License. Copyright © 2026 Neokil. Third-party components retain their respective licenses; see third-party notices.

Development

Requires Go matching go.mod, Node.js matching .nvmrc, npm and GNU Make. The container build pins its toolchain versions.

make build
./bin/branchverse --config config.yaml # creates the file and stops; fill it in and repeat

Running locally lists the settings for development and how to work without Docker or GitHub. For live frontend development, run npm --prefix web run dev next to the server.

make check          # format, lint, types, generation, tests, build, audits
make test-race      # needs a C compiler
make e2e            # browser tests against the real server with fakes
make container-test # the production image with real Docker, on Linux

CI runs quality, security, browser and container checks on pushes to main, on pull requests and before a release. Run make generate after editing SQL, the API contract or dependencies and commit the generated files.

See the product overview, architecture, decisions, releases and the API contract.

About

Every branch, its own universe. Self-hosted pull request previews with Docker Compose.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages