Docs/Resonant Mind/Deployment

Deployment

Resonant Mind supports two storage backends. Choose based on your needs.

Option A: D1 (Simpler)

D1 is Cloudflare’s serverless SQLite database. Everything stays within Cloudflare — no external accounts needed.

Setup

# Create database
npx wrangler d1 create resonant-mind

# Create vector index for semantic search
npx wrangler vectorize create resonant-mind-vectors --dimensions=768 --metric=cosine

# Create R2 bucket for images
npx wrangler r2 bucket create resonant-mind-images

Add bindings to wrangler.toml:

[[d1_databases]]
binding = "DB"
database_name = "resonant-mind"
database_id = "your-database-id-from-above"

[[vectorize]]
binding = "VECTORS"
index_name = "resonant-mind-vectors"

[[r2_buckets]]
binding = "IMAGES"
bucket_name = "resonant-mind-images"

Run the migration:

npx wrangler d1 migrations apply resonant-mind --remote

When to Use D1

  • Getting started quickly
  • Smaller deployments (personal AI, experimentation)
  • Want everything on one platform
  • Free tier is sufficient

Option B: Neon Postgres (Production)

Neon is a serverless Postgres provider. Cloudflare Hyperdrive provides connection pooling and low-latency access from Workers.

Setup

1. Create a Neon project

Sign up at neon.tech (free tier includes 0.5 GB storage). Create a new project and copy your connection string:

postgresql://user:[email protected]/neondb?sslmode=require

2. Enable pgvector

In the Neon SQL Editor:

CREATE EXTENSION IF NOT EXISTS vector;

3. Create the schema

Run the Postgres migration:

psql "your-connection-string" -f migrations/postgres.sql

4. Create a Hyperdrive config

npx wrangler hyperdrive create resonant-mind-db \
  --connection-string="your-connection-string"

5. Configure wrangler.toml

[[hyperdrive]]
binding = "HYPERDRIVE"
id = "your-hyperdrive-id"

[[r2_buckets]]
binding = "IMAGES"
bucket_name = "resonant-mind-images"

No D1 or Vectorize bindings needed — Resonant Mind auto-detects Hyperdrive.

When to Use Postgres

  • Production deployments
  • Larger datasets (thousands of entities/observations)
  • Need Postgres-specific features
  • Already using Neon for other projects

Deploy

With either backend configured:

# Set required secrets
npx wrangler secret put MIND_API_KEY
npx wrangler secret put GEMINI_API_KEY

# Deploy
npx wrangler deploy

Verify:

curl https://resonant-mind.your-subdomain.workers.dev/health

Custom Domains

To use a custom domain instead of the .workers.dev URL:

  1. Add a custom domain in the Cloudflare dashboard under Workers > your worker > Settings > Domains & Routes
  2. Update WORKER_URL in your wrangler vars to match
  3. Redeploy

Monitoring

The /health endpoint returns status for all systems. Use it for uptime monitoring:

curl https://your-worker-url/health
# {"status":"ok","service":"resonant-mind"}

The mind_health tool provides deeper cognitive metrics — memory density, processing backlog, identity coherence, and thread staleness.