Live configuration in API route handlers using a singleton ConfigWatcher.
- Singleton watcher pattern for server-side config (Next.js / Node.js servers)
field.valuein route handlers — always fresh, no polling- Separate endpoints for server config and feature flags
- gRPC is Node.js only — decree runs server-side, not in the browser
lib/config.ts → singleton watcher, exports watched fields
app/api/config/route.ts → reads field.value in GET handler
app/api/features/route.ts → reads field.value in GET handler
cd examples
npm install
npx tsx nextjs-integration/main.tsThen:
curl http://localhost:3001/api/config
curl http://localhost:3001/api/featuresChange a value and refresh:
decree config set <tenant-id> features.dark_mode false
curl http://localhost:3001/api/features- error-handling — retry, nullable, error hierarchy