SQLite Adapter
The SQLite adapter provides a lightweight, file-based database solution perfect for small to medium applications, local development, and embedded systems.
Deprecated Feature
@c15t/backend v1 did not deliver the flexibility we wanted and fell short of our standards. It is now deprecated as we work on a full rewrite, with v2 entering canary soon. This does not affect Consent.io deployments, which remain stable.
Installation
Install the SQLite adapter and its dependencies:
Configuration
Configure the SQLite adapter with your database file path:
In-Memory Database
For testing or development, you can use an in-memory database:
Schema Management
Initialize your database schema:
Usage Examples
Basic CRUD Operations
Transactions
Advanced Queries
Performance Optimization
Backup and Maintenance
Best Practices
- Use WAL mode for better concurrency and performance
- Create proper indexes on columns frequently used in WHERE clauses
- Use transactions for operations that must be atomic
- Implement regular backups using VACUUM INTO
- Set busy timeout to handle concurrent access conflicts
- Use prepared statements to prevent SQL injection (handled automatically by the adapter)
Limitations
- Limited concurrency compared to client-server databases
- No built-in user management or access control
- Maximum database size limited to 281 TB (though practical limits are much lower)
- Limited support for ALTER TABLE operations
Related Resources
Edit on GitHub
Last updated: April 10, 2025