Powergit is a local-first Git explorer that mirrors repositories into PowerSync so you can browse branches, files, and commit history through a fast, reactive UI—no external network calls required once synced.
pnpm install
pnpm dev:stack:up
pnpm devpnpm install
pnpm dev:prod
pnpm dev:produses.env.prod(remote Supabase/PowerSync). Usepnpm dev:stackif you want a local Docker-backed stack.
- Supabase + PowerSync setup:
docs/supabase.md - Profiles (local-dev / prod / staging):
docs/profiles/remote.example.md
If you want to trigger the GitHub Actions workflow instead of the local daemon:
- Create
supabase/.env(gitignored) and setTOKEN,GITHUB_REPO_OWNER, andGITHUB_REPO_NAME(you can start from.env.github.example). - Start the local stack:
pnpm dev:stack:up(Edge Functions are available athttp://127.0.0.1:55431/functions/v1). - Run the explorer in prod mode:
pnpm dev:prod(uses the Edge Function dispatcher, not the daemon). - Paste a GitHub repo URL in the UI; this calls the
github-importEdge Function, which dispatches theclone-and-push.ymlworkflow with your token. Watch the run in GitHub Actions to confirm it fired.
Uses Tanstack DB integration to handle queries for the commit explorer.
You can view diffs.
In this repo we have built a custom git remote protocol that allows us to push git data into a Supabase database. We can later use PowerSync to see the data in the frontend. We use the powersync-tanstack-db package to query the database and show it reactively using the @tanstack/powersync-db-collection package.
TanStack DB gives us a great query layer, but it does not include a sync engine or durable storage. PowerSync is the replicated store that keeps the Git metadata and pack metadata in step across the daemon and the explorer.
- Offline-first persistence: PowerSync streams
refs,commits,file_changes, andobjectsinto SQLite (daemon) and IndexedDB (browser), so TanStack DB queries stay fast and continue to work without network access. - Delta sync, not re-downloads: after the initial push of a large repo, only new refs/commits are streamed; the UI never has to resync the full history on each launch.
- Shared cache across surfaces: the daemon, CLI, and browser all query the same replicated tables via
@tanstack/powersync-db-collection, avoiding bespoke cache plumbing while honoring the Supabase/PowerSync auth model. - Pack handling: pack bytes stay in Supabase Storage while PowerSync ships the lightweight metadata we query. The explorer pulls packs lazily and indexes them locally, keeping PowerSync focused on the syncable metadata layer.
At a high level the happy path looks like this:
- Import request (UI → daemon). A user pastes a GitHub URL into the explorer. The frontend posts that payload to the local daemon. The daemon clones the repo, configures the custom
powersync::remote, fetches every ref, and pushes the data into Supabase via our remote-helper. - Persist metadata + packs. During
git push --mirror, the daemon writes refs/commits/file_changes rows into Supabase tables and uploads each pack file to the Supabase Storage bucket (git-packs). Only metadata lands inpublic.objects; the raw pack bytes live in storage. - PowerSync replication. The PowerSync service streams those tables down to every connected explorer instance. The browser uses
@powersync/web+ TanStack DB collections to reactively query refs, commits, file changes, and the lightweight pack metadata. - File tree & viewer. When the explorer receives the first pack row for a repo,
gitStore.indexPacksdownloads the pack via the daemon’s signed URL endpoint, indexes it inside the browser’s virtual FS, and marks the referenced commit as “ready.” The file tree then renders real Git entries while the viewer can read blobs directly from the locally indexed pack. - Commit explorer. The commit view queries the replicated commits/refs table via
@tanstack/powersync-db-collectionand renders filters, diffs, and history without any additional backend calls.
This flow means that after the initial clone/push, all navigation (branch switching, file viewing, commit diffing) happens entirely locally with the data mirrored inside PowerSync.
