Features and capabilities in @photostructure/sqlite.
- 100% API Compatible with Node.js built-in sqlite module
- Synchronous Operations - Fast, blocking database operations
- Zero Dependencies - Pure native implementation
- Cross-Platform - Windows, macOS, Linux (x64 and ARM64)
- Node.js 20+ - No experimental flags required
- TypeScript Support - Complete type definitions included
- Performance - Matches leading SQLite libraries in benchmarks
This package includes SQLite 3.52.0 with extensive compile-time options enabled. For complete build flag documentation, comparison with Node.js, and customization options, see Build Flags & Configuration.
SQLITE_ENABLE_FTS3- Full-text search version 3SQLITE_ENABLE_FTS3_PARENTHESIS- Enhanced FTS3 query syntaxSQLITE_ENABLE_FTS4- Full-text search version 4SQLITE_ENABLE_FTS5- Full-text search version 5 (latest)
SQLITE_ENABLE_JSON1- JSON functions and operators- Full JSON path expressions
- JSON aggregation functions
SQLITE_ENABLE_RTREE- R*Tree spatial indexingSQLITE_ENABLE_GEOPOLY- GeoJSON and polygon functionsSQLITE_ENABLE_MATH_FUNCTIONS- Math functions (sin, cos, sqrt, etc.)SQLITE_SOUNDEX- Soundex algorithm
SQLITE_ENABLE_SESSION- Session and changeset supportSQLITE_ENABLE_PREUPDATE_HOOK- Pre-update hooks for sessions- Session class exposed - Full access to SQLite sessions for advanced workflows
- Database replication capabilities
- Change tracking and synchronization
SQLITE_ENABLE_STAT4- Advanced query planner statisticsSQLITE_ENABLE_DBSTAT_VTAB- Database statistics virtual tableSQLITE_ENABLE_RBU- Resumable Bulk Update support
SQLITE_ENABLE_COLUMN_METADATA- Column metadata APIsSQLITE_ENABLE_UPDATE_DELETE_LIMIT- LIMIT clause on UPDATE/DELETESQLITE_ENABLE_NORMALIZE- Unicode normalizationSQLITE_ENABLE_SNAPSHOT- Database snapshotsSQLITE_USE_URI- URI filename supportSQLITE_DEFAULT_FOREIGN_KEYS=1- Foreign keys enabled by defaultSQLITE_THREADSAFE=2- Multi-thread safe (serialized mode)
SQLITE_DQS=0- Double-quoted strings disabled by defaultSQLITE_DEFAULT_WAL_SYNCHRONOUS=1- Safe WAL mode defaultsSQLITE_OMIT_DEPRECATED- Deprecated features removedSQLITE_OMIT_SHARED_CACHE- Shared cache mode disabled (deprecated)
SQLITE_DEFAULT_CACHE_SIZE=-16000- 16MB default cache- Thread-safe multi-connection access
- Error handling with detailed error codes
- In-memory databases (
:memory:) - File-based databases with full path support
- URI filenames with query parameters
- Read-only mode support
- Configurable busy timeout
- Foreign key constraint enforcement
enhance()function - Adds.pragma()and.transaction()methods to any compatible database- Works with
node:sqlite- Enhance nativenode:sqliteDatabaseSync instances - Transaction helpers - Automatic BEGIN/COMMIT/ROLLBACK with savepoint support for nested transactions
- Pragma convenience - Simple API for reading and setting SQLite pragmas
- Prepared statements with parameter binding
- Named and positional parameters
- Statement iteration support
- Expanded SQL for debugging
- Anonymous parameter support
- Automatic type conversions
- Scalar function registration
- Aggregate function support
- Window function compatibility
- Deterministic function optimization
- Variable argument functions
- Database backup with progress monitoring
- Session-based change tracking
- Changeset generation and application
- Conflict resolution callbacks
- Extension loading support
- INTEGER (number and BigInt)
- REAL (number)
- TEXT (string)
- BLOB (Buffer)
- NULL (null)
- Automatic BigInt for large integers
- Automatic disposal - DatabaseSync and StatementSync implement
Symbol.disposenatively in C++ usingstatement support - Automatic cleanup with explicit resource management- Manual cleanup - Traditional close()/finalize() methods
- Exception safety - Resources cleaned up even when errors occur
- Enhanced error information
- SQLite error codes
- Extended error codes
- System error numbers
- Human-readable error descriptions
- Windows: 10 and later (x64, ARM64)
- macOS: 10.15 and later (x64, Apple Silicon)
- Linux: GLIBC 2.31+ (Ubuntu 20.04+, Debian 11+, RHEL 8+)
- Alpine Linux: 3.21+ (musl libc)
- Node.js 20.0.0 and later
- Full worker thread support
- ESM and CommonJS compatibility
- x64 (Intel/AMD 64-bit)
- ARM64 (Apple Silicon, AWS Graviton, Raspberry Pi 4+)
- Prebuilt binaries for all platforms
- Automatic compilation fallback
These SQLite features are not enabled in this build:
SQLITE_ENABLE_ICU- International Components for UnicodeSQLITE_ENABLE_MEMSYS5- Alternative memory allocatorSQLITE_ENABLE_MEMSYS3- Alternative memory allocatorSQLITE_ENABLE_UNLOCK_NOTIFY- Unlock notificationSQLITE_ENABLE_ATOMIC_WRITE- Atomic write support
See our detailed comparison with:
- Node.js built-in sqlite module
- better-sqlite3
- node-sqlite3 (deprecated)
- Synchronous operations eliminate async overhead
- Direct SQLite C API access
- Minimal JavaScript wrapper overhead
- Efficient parameter binding
- Prepared statement caching
- SQL injection protection via prepared statements
- Read-only database support
- URI filename sanitization
- Extension loading disabled by default
- Memory limits configurable
- Resource cleanup on errors
- Getting Started - Installation and first database
- Build Flags & Configuration - Complete build flag documentation
- API Reference - Complete API documentation
- Advanced Patterns - Performance optimization tips