This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
./bundle.sh- Complete build pipeline that:- Builds
sqlite-web-corewithwasm-pack build --target web - Embeds WASM into JavaScript worker template
- Builds
sqlite-webpackage with embedded core - Packages with
npm packand updates Svelte test integration
- Builds
cd packages/sqlite-web-core && wasm-pack build --target web --out-dir ../../pkgcd packages/sqlite-web && wasm-pack build --target web --out-dir ../../pkg
./test.sh- Run all Rust WASM tests (both packages)cd packages/sqlite-web-core && wasm-pack test --headless --chrome- Test core package onlycd packages/sqlite-web && wasm-pack test --headless --chrome- Test worker package only
cd svelte-test && bun dev- Start development servercd svelte-test && bun build- Production buildcd svelte-test && bun run check- TypeScript checking with svelte-check
This is a Rust WebAssembly SQLite Worker project with a workspace architecture consisting of two main packages and a Svelte test application.
- Purpose: Core SQLite functionality and worker implementation
- Key modules:
worker.rs- Main worker entry point called byworker_main()database.rs- SQLite database operations usingsqlite-wasm-rscoordination.rs- Worker coordination and messagingdatabase_functions.rs- Custom database functions (uses rain.math.float)messages.rs- Message serialization/deserialization
- Dependencies: sqlite-wasm-rs, alloy (Ethereum tooling), rain-math-float
- Output: WASM module with JS glue code
- Purpose: Public API that creates self-contained workers with embedded core
- Key files:
lib.rs-SQLiteWasmDatabasestruct with async query interfaceworker_template.rs- Generates self-contained worker JavaScriptembedded_worker.js- Generated template with embedded WASM
- Pattern: Creates blob URLs from JavaScript code that includes base64-encoded WASM
- Output: Final WASM package that consumers can use
- Purpose: Mathematical floating-point operations library
- Integration: Custom functions accessible from SQLite via
database_functions.rs - Architecture: Solidity-compatible decimal float operations with Rust/WASM bindings
- Purpose: Integration test and example usage
- Technology: SvelteKit + TypeScript + Vite
- Pattern: Imports
sqlite-webpackage from local tarball
- Core Build:
sqlite-web-corecompiled to WASM + JS glue - Embedding: WASM converted to base64 and embedded into JavaScript template
- Wrapper Build:
sqlite-webcompiled with embedded worker generator - Packaging: NPM package created and integrated into Svelte test
- Self-contained Workers: No external WASM file dependencies
- Async/Promise-based API: JavaScript promises for query results
- Workspace Dependencies: Shared dependency versions across packages
- Embedded WASM: Base64-encoded WASM included directly in JavaScript
- The build process creates a fully self-contained worker that includes all WASM code
- The
embedded_worker.jsfile is generated and should not be manually edited - Database functions from
rain.math.floatare available in SQLite queries - Workers communicate via message passing with structured message types