Drizzle Storage Module
The@credo-ts/drizzle-storage package provides a SQL-based storage implementation using Drizzle ORM, supporting both PostgreSQL and SQLite.
Installation
Database Drivers
Install the appropriate database driver:- PostgreSQL
- SQLite
Configuration
PostgreSQL
SQLite
Bundles
The module supports bundles for different Credo modules:core- Core storage (required)didcomm- DIDComm protocol storageanoncreds- AnonCreds storageopenid4vc- OpenID4VC storagetenants- Multi-tenancy storageaction-menu- Action menu protocol storagequestion-answer- Question-answer protocol storagedrpc- DRPC storage
Migrations
Run migrations using the Drizzle CLI:Advantages Over Askar
- SQL Database - Use existing PostgreSQL/SQLite infrastructure
- Query Flexibility - Full SQL query capabilities
- Debugging - Standard SQL tools for inspection
- Integration - Share database with other services
- Migrations - Schema versioning with Drizzle migrations
Performance Considerations
- Use connection pooling for PostgreSQL
- Configure appropriate indexes for your query patterns
- Consider read replicas for high-traffic applications
- Use prepared statements (handled automatically by Drizzle)
See Also
- Askar Module - Alternative secure storage backend
- Storage Concepts - Storage architecture overview
- Storage Migration - Migrating between storage backends