Skip to main content

Database Driver Options

Because we use Keyv, you are able to set your database driver to anything Keyv supports. The list of options are available at https://www.npmjs.com/package/keyv but we will provide the two most common ones in this guide.

Defaults

The default storage adapter (the type of storage) is SQLite which will store your data in a file, if you use Git then this file will most likely be overwritten when you make an update to your files.

Setting a Database Driver

To set a database driver, add this bit of code to the theme config.
theme: SoftUI({
    dbdriver: String;
})

MongoDB

To add a driver like MongoDB you need to install the adapter with this command.
npm install --save @keyv/mongo
And then set the driver to your connection string such as this.
theme: SoftUI({
    dbdriver: "mongodb://localhost:27017/yourdb";
})

MySQL

To add a driver like MySQL you need to install the adapter with this command.
npm install --save @keyv/mysql
And then set the driver to your connection string such as this.
theme: SoftUI({
    dbdriver: "mysql://user:pass@localhost:3306/dbname";
})
I