This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
This is a Go-based experimental project evaluating NATS JetStream as a primary data store alternative to SQLite. The project contains three distinct experiments demonstrating different aspects of NATS JetStream usage: point store, time-series database, and bi-directional synchronization.
# Build all experiments
go build ./...
# Run individual experiments
go run ./point-store/ # Point store experiment
go run ./tsd/ # Time-series database experiment
go run ./bi-directional-sync/ # Bi-directional sync experiment
# Pre-compiled TSD benchmark (already available as ./t)
./t # Runs time-series performance tests# Standard Go development
go mod tidy # Clean up dependencies
go mod download # Download dependencies
go fmt ./... # Format code
go list -m all # Check module statusThe project is organized around three self-contained experiments:
- Point Store (
point-store/) - Uses NATS streams as a key-value point store withGetLastMsgForSubjectfor current state retrieval - Time-Series Database (
tsd/) - Performance benchmarks for time-series data with sync/async publishing comparisons - Bi-directional Sync (
bi-directional-sync/) - Hub-leaf synchronization using JetStream domains and stream sources
- All experiments use embedded NATS servers (no external dependencies)
- JetStream streams with hierarchical subject patterns (
n.{nodeId}.{property}) - Context-based timeout handling for all operations
- Automatic resource cleanup and temporary directory management
- Stream configuration through declarative setup
github.com/nats-io/nats-server/v2 v2.11.8- NATS servergithub.com/nats-io/nats.go v1.45.0- NATS Go client- Go version 1.23.0+ (using toolchain go1.24.6)
- Each experiment is independent and self-contained
- No external NATS server required - uses embedded instances
- The
texecutable is a pre-compiled version of the TSD performance test - All experiments log detailed performance metrics to stdout
- Temporary JetStream state directories are created and cleaned automatically