Skip to Content
🚀 Legit SDK Alpha preview – help shape it on Discord here.

Overview

The Legit SDK has two layers:

  1. Legit SDK API – top-level API like initLegitFs() that help you initialize a versioned filesystem.

  2. Legit FS API – once you have a Legit FS file system instance, you can use its .promises API just like Node’s fs. Any file you write is automatically tracked and versioned in .legit. You can read files, inspect history, or check out previous versions.

Key points:

  • The SDK API help you bootstrap and manage the repo.
  • The FS API is where you read/write files, inspect commits, and interact with history.
  • Because Legit FS mimics the Node.js fs.promises interface, it’s compatible with in-memory or real filesystems, and portable across environments (Node, Docker, Python, Java, etc.).

Overview:

/ └─ .legit/ ├─ branches/ │ └─ main/ │ ├─ document.txt # current HEAD content │ └─ .legit/ │ ├─ head │ └─ history └─ commits/ └─ ab/ # first 2 chars of SHA └─ cdef1234567890.../ # remaining 38 chars of SHA └─ document.txt # snapshot of the file in that commit
Last updated on