A browser-based Git application demonstrating WebRun VCS with swappable storage backends.
pnpm devThen open http://localhost:5173 in your browser.
Toggle between two storage options:
- In-Memory - Fast, ephemeral storage that resets on page refresh
- Browser Filesystem - Persistent storage using the File System Access API
- Initialize a new repository
- Add files to staging
- Create commits
- View commit history
| Browser | Supported |
|---|---|
| Chrome 86+ | Yes |
| Edge 86+ | Yes |
| Opera 72+ | Yes |
| Firefox | No (uses in-memory fallback) |
| Safari | No (uses in-memory fallback) |
In browsers without File System Access API support:
- The "Browser Filesystem" button is disabled
- Only in-memory storage is available
- All functionality works, but data is lost on refresh
┌─────────────────────────────────────────────────────────────────┐
│ Browser VCS Application │
├─────────────────────────────────────────────────────────────────┤
│ │
│ ┌────────────────────────────────────────────────────────────┐ │
│ │ @statewalker/vcs-core │ │
│ │ @statewalker/vcs-commands │ │
│ └────────────────────────────────────────────────────────────┘ │
│ ↓ │
│ FilesApi Interface │
│ (@statewalker/webrun-files) │
│ ↓ │
│ ┌──────────────────────┬──────────────────────────────────────┐│
│ │ │ ││
│ │ webrun-files-mem │ File System Access API ││
│ │ (In-Memory) │ (Browser Native) ││
│ │ │ ││
│ │ - Quick testing │ - Persistent storage ││
│ │ - No permission │ - User picks directory ││
│ │ - Lost on refresh │ - Survives refresh ││
│ │ │ - Works with local files ││
│ └──────────────────────┴──────────────────────────────────────┘│
│ │
└─────────────────────────────────────────────────────────────────┘
import type { FilesApi } from "@statewalker/webrun-files";
import { createFilesApi as createMemoryFiles } from "@statewalker/webrun-files-mem";
// In-memory storage
const memoryFiles = createMemoryFiles();
// Browser filesystem (File System Access API)
const dirHandle = await window.showDirectoryPicker();
const browserFiles = await createBrowserFilesApi(dirHandle);import { createGitRepository } from "@statewalker/vcs-core";
import { createGitStore, Git } from "@statewalker/vcs-commands";
const repository = await createGitRepository(files, ".git", {
create: true,
defaultBranch: "main",
});
const store = createGitStore({ repository, staging });
const git = Git.wrap(store);// Add file
const objectId = await store.blobs.store([data]);
const editor = store.staging.editor();
editor.add({ path, apply: () => ({ path, mode, objectId, stage, size, mtime }) });
await editor.finish();
// Commit
const commit = await git.commit().setMessage("Add files").call();
const commitId = await store.commits.storeCommit(commit);# Start development server
pnpm dev
# Build for production
pnpm build
# Preview production build
pnpm previewThis application runs entirely in the browser. No backend server is needed. Git operations are performed locally using the VCS library compiled to JavaScript.