-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Labels
Description
Summary
Migrate the backend database layer from sqlite3 to better-sqlite3 for improved performance and simpler API.
Motivation
| Aspect | sqlite3 |
better-sqlite3 |
|---|---|---|
| API | Async (callback/Promise) | Synchronous |
| Performance | Slower due to async overhead | 2-10x faster for typical workloads |
| Simplicity | More complex with callbacks | Cleaner, simpler code |
| Transactions | Complex to handle properly | Easy: db.transaction(() => {...})() |
| Native builds | Often problematic | Generally more reliable |
| Maintenance | Less actively maintained | Actively maintained |
Benefits for EthAura
- Passkey credential storage is I/O-bound locally - SQLite operations are fast enough that synchronous calls won't block Node.js meaningfully
- Simpler transaction handling - Passkey/guardian data operations need atomic transactions, which
better-sqlite3handles elegantly - Better prepared statements - More intuitive API for parameterized queries (important for security)
- Fewer dependency issues -
sqlite3often has build problems with node-gyp
Tasks
- Install
better-sqlite3and removesqlite3 - Update database initialization code
- Migrate all database queries to synchronous API
- Update transaction handling
- Test all passkey CRUD operations
- Test guardian/recovery operations
- Update any error handling for sync exceptions