# Quick Start: REPL

This page runs the bundled ToriiDB REPL and turns on vector commands with an OpenAI API key.

## Run the REPL

```bash
go run cmd/test/main.go
# or
make test
```

The REPL opens `./temp` with `store.New` (not through the daemon):

```text
toriidb[0]> SET counter 1
OK
toriidb[0]> INCR counter
2
toriidb[0]> SET user {"name":"Torii","profile":{"level":1}}
OK
toriidb[0]> GET user.profile.level
1
toriidb[0]> SELECT 1
OK
toriidb[1]> KEYS *
(empty list)
```

`quit` or `exit` ends the session. `SIGINT` and `SIGTERM` close the store before the process exits.

## Enable Vector Operations

```bash
export OPENAI_API_KEY="your-api-key"
go run cmd/test/main.go
```

```text
SET article:1 Redis-style embedded storage VECTOR
SET article:2 JSON document database VECTOR
VSEARCH embedded vector search LIMIT 2
VSIM article:1 article:2
```

The vector is attached in the background after `SET` returns, so a new entry becomes searchable shortly afterwards.

## Build and Test

| Command | Action |
|---|---|
| `go build ./...` | Build all packages |
| `go vet ./...` | Static analysis |
| `make test` | Run the REPL |
| `make unit` | `go test ./core/... -count=1 -cover` |
| `make embed` | Run the OpenAI embedding integration test |

The Makefile `include`s and `export`s a local `.env` when present; the Go code itself never loads `.env`.

## Related Pages

- [Command Summary](/cli-reference)
- [Attaching Vectors](/vector-search)
- [API Key](/configuration-api-key)
