---
title: Filesystem Storage
description: Store a Migration V1 estate on the local filesystem
icon: folder-open
---

## Quick Start

```ts
import { createMigrationClient } from "viborm/migrations";
import { createFsStorageWriter } from "viborm/migrations/storage/fs";

const migrations = createMigrationClient(client, {
  storage: createFsStorageWriter("./migrations"),
});
```

`createFsStorageWriter` is the public filesystem owner. There is no
`createFsStorageDriver` and no path-level `get` / `put` / `delete`.

## Configuration

```ts
const storage = createFsStorageWriter(baseDir);
```

| Parameter | Type | Description |
|-----------|------|-------------|
| `baseDir` | `string` | Estate root. Absolute, or relative to the current working directory. |

## Directory Structure

```
migrations/
├── estate.json
├── snapshots/
│   └── <snapshot-hash>.json
├── sql/
│   └── <sql-hash>.sql
└── states/
    └── <state-id>.json
```

Publication is write-temp, fsync, rehash, then a no-replace hard link. A
filename that looks like a digest is not proof until the parser recomputes the
hash.

## Version Control

Estate artifacts are designed to be committed to git:

```bash
git add migrations/
git commit -m "Add user table state"
```

For the generate/apply/status workflow, see [Migrate](/docs/migration/migrate).

## Next Steps

**[Storage](/docs/migration/storage)**

Semantic estate readers and writers

**[Migrations](/docs/migration)**

Push and migrate workflows
