# Quick Start: Embedded Store

This page opens a ToriiDB data directory in-process with `store.New`, for programs that are the only owner of that directory.

## Use the Embedded Store

When a single process owns the directory, use `store.New` directly. The directory argument is required; an empty path fails.

```go
package main

import (
    "fmt"
    "log"

    "github.com/pardnchiu/toriidb/core/store"
)

func main() {
    torii, err := store.New("./data")
    if err != nil {
        log.Fatal(err)
    }
    defer torii.Close()

    fmt.Println(torii.Exec("SET greeting hello"))
    fmt.Println(torii.Exec("GET greeting"))
}
```

Always call `Close` before exit. It waits for background vector jobs, compacts each loaded database into a new snapshot, and removes superseded generations.

## Related Pages

- [Core Concepts](/core-concepts)
- [store](/api-reference-store)
- [Compaction and GC](/persistence-compaction)
