SQLite-JS
lastmod 2025-06-09created 2025-06-091 edits
Create custom SQLite functions in JavaScript. Extend your database with scalars, aggregates, window functions, and collations directly in JavaScript.
An extension that adds JavaScript capabilities to SQLite
Features
- An extension tool for implementing user-defined functions, aggregates, window functions, collations, etc. in JavaScript in a SQLite DB
- Logic that is hard to express in SQL can be registered and run directly as JavaScript code
Key functions
- Scalar Functions: Return one result per row, used for data processing/calculation (e.g., calculating age from a birthday, extracting an email domain)
- Aggregate Functions: Process multiple rows and return a single value (e.g., custom aggregates such as standard deviation, median)
- Window Functions: Can access the whole data set, support complex window operations such as sliding/cumulative statistics, moving averages
- Collation Sequences: Implement custom sorting algorithms in JavaScript; locale, natural-language, case-insensitive sorting, etc. are possible
- JavaScript Evaluation: Runs JavaScript code instantly within SQL queries, for arbitrary operations, data transformation, etc.
- Distributed environment sync: Integrated with sqlite-sync, created JS functions are automatically synced across both cluster and offline environments