Local Development
Run your Flect app locally while pointing at real or local resources.
Option 1: Local services with Docker
Section titled “Option 1: Local services with Docker”Run sqld and Valkey locally:
# sqld (libSQL server)docker run -d \ --name sqld \ -p 8080:8080 \ ghcr.io/tursodatabase/libsql-server:latest \ /bin/sqld --enable-namespaces
# Valkeydocker run -d \ --name valkey \ -p 6379:6379 \ valkey/valkey:8-alpine \ valkey-server --save "" --appendonly noThen set env vars:
DB_URL=http://localhost:8080DB_NAMESPACE=myappCACHE_URL=redis://localhost:6379CACHE_PREFIX=myapp:No FLECT_TOKEN needed — the SDK skips proxy auth when FLECT_TOKEN is absent.
Option 2: Point at your production resources
Section titled “Option 2: Point at your production resources”You can run your app locally while talking to your real Flect database and KV store, bypassing the proxy. Get the connection details:
flect db get myapp-db --output jsonflect kv get myapp-cache --output jsonThen set:
# .env.local (direct, no proxy)DB_URL=http://100.64.0.1:8081DB_NAMESPACE=<sqld-namespace>CACHE_URL=redis://100.64.0.1:6380CACHE_PREFIX=<key-prefix>Note: Direct access bypasses flect-proxy. Suitable for development only — do not expose these addresses publicly.
Running your app
Section titled “Running your app”With tsx for TypeScript:
node --env-file=.env.local --import tsx/esm src/index.tsOr with the script in package.json:
{ "scripts": { "dev": "node --env-file=.env.local --import tsx/esm src/index.ts" }}Migrations in development
Section titled “Migrations in development”Run migrations against your local sqld:
flect db migrate myapp-db --dir migrationsOr apply SQL files directly if working locally:
sqlite3 local.db < migrations/0001_create_notes.sql