Available Packages
Node.js
Package:@effect/sql-sqlite-node
Uses better-sqlite3 for synchronous, high-performance SQLite access.
Bun
Package:@effect/sql-sqlite-bun
Uses Bun’s native, built-in SQLite support (no external dependencies).
WebAssembly
Package:@effect/sql-sqlite-wasm
Uses wa-sqlite for browser and edge runtime support.
Quick Start
Node.js
Bun
WebAssembly (Browser)
Configuration
Node.js Options
Bun Options
WASM Options
Basic Operations
Creating Tables
Inserting Data
Querying Data
Updating and Deleting
Transactions
SQLite-Specific Features
JSON Support (SQLite 3.38+)
Full-Text Search
UPSERT (SQLite 3.24+)
Window Functions
Migrations
In-Memory Database
Useful for testing:Performance Optimization
Pragma Settings
Batch Inserts
Error Handling
Choosing a SQLite Package
| Package | Use Case | Performance | Dependencies |
|---|---|---|---|
sql-sqlite-node | Node.js apps | Fastest | Requires native build |
sql-sqlite-bun | Bun apps | Very fast | None (built-in) |
sql-sqlite-wasm | Browser/Edge | Good | Pure JavaScript |
Best Practices
- Use WAL mode: Better concurrency than default journal mode
- Batch operations: Use transactions for bulk inserts/updates
- Index strategically: Add indexes for frequently queried columns
- Analyze queries: Use
EXPLAIN QUERY PLANto optimize - Vacuum regularly: Reclaim unused space with
VACUUM - Limit result sets: Use
LIMITfor large queries
Requirements
- Node.js: Node.js 18+, better-sqlite3 compatible
- Bun: Bun 1.0+
- WASM: Modern browser with WebAssembly support
- Effect: 4.0.0 or higher