Skip to content

Quick Start

This guide walks through initializing Keyraft, starting the server, and making your first API calls.

1. Initialize Database

bash
keyrafted init --data-dir ./data

Output:

✓ Keyraft initialized successfully!

Root token (save this securely):
  eyhQ3zLy6NdiMNwFJ-S3kS-GUA5RzI0p7ibnz-VI9jw=

Use this token to authenticate API requests:
  curl -H 'Authorization: Bearer eyhQ3zLy6NdiMNwFJ-S3kS-GUA5RzI0p7ibnz-VI9jw=' http://localhost:7200/v1/health

WARNING

Save the root token securely. You'll need it for all administrative operations.

2. Set Encryption Key

bash
# Generate a secure key
export KEYRAFT_MASTER_KEY=$(openssl rand -base64 32)

# Or use your own (minimum 16 bytes)
export KEYRAFT_MASTER_KEY="your-secure-key-here"

3. Start Server

bash
keyrafted start --data-dir ./data --listen :7200

The server is now running at http://localhost:7200.

4. Store Configuration

bash
curl -X PUT http://localhost:7200/v1/kv/myapp/prod/DB_HOST \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"value":"localhost","type":"config"}'

5. Store a Secret

bash
curl -X PUT http://localhost:7200/v1/kv/myapp/prod/DB_PASSWORD \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"value":"secret123","type":"secret"}'

6. Read a Value

bash
curl http://localhost:7200/v1/kv/myapp/prod/DB_HOST \
  -H "Authorization: Bearer YOUR_TOKEN"

7. List Keys

bash
curl http://localhost:7200/v1/kv/myapp/prod \
  -H "Authorization: Bearer YOUR_TOKEN"

Next Steps

Apache License 2.0