libfossil
v 0.4.2 license MIT github docs

libfossil

A pure-Go library for Fossil SCM repositories. Zero CGo. Static binaries. WASM-ready.

Projectlibfossil — pure-Go Fossil SCM library
LanguageGo (module github.com/danmestas/libfossil)
Runtime depsnone · pluggable SQLite drivers (modernc · ncruces)
Binaries1 (libfossil CLI)
LicenseMIT
Statusv0.4.2 · alpha · breaking changes possible
§01

Install install

shell
$ go install github.com/danmestas/libfossil/cmd/libfossil@latest
$ libfossil --help

That is the entire install. The binary is pure-Go, statically linked, and CGo-free — drop it on any Linux/macOS/Windows host with no runtime dependency.

§02

What it is overview

libfossil is a pure-Go reader and writer for Fossil SCM repositories — the SQLite-backed .fossil files used by Fossil. It exposes a Go API for opening repos, reading the timeline, committing, and syncing over HTTP, plus a libfossil CLI driving the same code paths.

No CGo means static binaries that cross-compile cleanly. A GOOS=wasip1 build runs in browsers and edge runtimes. Two SQLite drivers (modernc, ncruces) are swappable depending on whether you want pure-Go ergonomics or a smaller WASM footprint.

§03

Why you might want it why

Three reasons to reach for libfossil instead of shelling out to the upstream fossil binary or using CGo bindings.

You're embedding Fossil into a Go service. Build pipelines, code-search indexers, mirror servers, and AI-agent tools that read repository history all benefit from a library API instead of subprocess parsing. No exec calls, no version drift between hosts, observable through Go's standard context.Context and OpenTelemetry hooks.

You're shipping to constrained targets. Static binaries cross-compile in seconds; CGo bindings don't. WASM compilation works out of the box. The cost is a slightly slower SQLite (modernc is pure Go); the upside is the binary runs on any target without a build farm.

You want one library, not five subprocesses. Calling fossil over os/exec means re-parsing CLI text on every request. libfossil exposes typed Go values directly.

§04

How it fits together architecture

libfossil architectureCallers (cli, library, wasm) invoke methods on the Repo handle. The Repo delegates to three pluggable axes: db driver, transport, observer. Repository state lives on disk in a .fossil SQLite file.callerscorepluginsclilibrarywasmOpenSyncTimelinedb drivertransportobserver.fossil (SQLite)callsdelegateeventspersist

Repo is the only handle your code touches. Three pluggable axes around it decide how SQLite runs, how sync talks to remotes, and where telemetry goes — swappable without changing application code.

§05

Compared to neighbors comparison

libfossilshell-out to fossilCGo libfossil bindings
Runtime depsnonefossil binary in PATHC toolchain + libsqlite3
Static binaryyeshost fossil onlyhost SQLite only
WASM targetyes (wasip1)nono
Observabilitycontext + OTelparse stderrnone built-in
Embeddable in Goyessubprocess onlyyes (with CGo)
API stabilityalpha; v0.xstabletracks C upstream

Comparison reflects libfossil's current scope. The upstream Fossil binary remains the reference implementation; libfossil targets the embedding-into-Go-services niche.

§06

What it is not limits

No GUI. Fossil ships an embedded web UI; libfossil does not. If you need it, run the upstream fossil binary alongside.

No hosting (yet). libfossil reads and writes .fossil files; it does not run an HTTP server that serves them to other Fossil clients. Mirroring works as a sync target, not a host.

No magic schema migrations. libfossil tracks the upstream Fossil schema. Breaking format changes upstream require a libfossil update before you can open the new format.

§07

Get going start

shell
$ go install github.com/danmestas/libfossil/cmd/libfossil@latest
$ libfossil --help                            # CLI commands
$ libfossil --version

Walkthrough: /docs/quickstart · Architecture: /docs/architecture · SDK reference: /docs/reference/sdk · Source: github.com/danmestas/libfossil.