testing local-first datastores
CLAUDE.md#
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Project Overview#
Node.js/TypeScript benchmark suite comparing local datastore performance (TinyBase, LevelGraph, SQLite) with ~1GB test data. Each benchmark runs 10 iterations, discards high/low scores, and reports the median.
Commands#
npm install # Install dependencies
npm run generate # Generate test data (~1GB) to test-data/
npm run bench # Run benchmarks on all stores (10 iterations each)
npm run bench:store tinybase # Benchmark single store
npm run bench:store levelgraph
npm run bench:store sqlite
npm run charts # Regenerate charts from latest results
Architecture#
src/generator/- Test data generation (URLs, images, documents, metadata)src/harness/- Benchmark runner, timing, and result reportingsrc/stores/- Datastore adapters implementingDatastoreAdapterinterfacesrc/runner.ts- Main CLI entry point
Adding a New Datastore#
- Create
src/stores/yourstore.tsimplementingDatastoreAdapterfromsrc/harness/types.ts - Register in
src/stores/index.ts
The adapter interface requires: init(), cleanup(), addUrls(), addImage(), addDocument(), addMetadata(), getRecentUrls(), getImages(), getDocuments(), getDiskUsage()