---
title: Storage | Developer Documentation
---

Storage in LlamaIndex.TS works automatically once you’ve configured a `StorageContext` object.

Per default a local directory is used for storage. Depening on the storage type (i.e. doc stores, index stores or vector stores), you can configure a different persistence layer. Most commonly a vector database is used as vector store.

## Local Storage

You can configure the `persistDir` to define where to store the data locally.

```
import {
  Document,
  VectorStoreIndex,
  storageContextFromDefaults,
} from "llamaindex";


const storageContext = await storageContextFromDefaults({
  persistDir: "./storage",
});


const document = new Document({ text: "Test Text" });
const index = await VectorStoreIndex.fromDocuments([document], {
  storageContext,
});
```

## API Reference

- [StorageContext](/typescript/framework-api-reference/interfaces/storagecontext/index.md)
