Botpress comes with support for SQL databases out-the-box and can be accessed by:
- The key-value store - This can be accessed via functions like
bp.kvs.set('key', 'value', 'path')
- A knex-instance - This allows you to work with the DB directly via
By default Botpress uses SQLite as its database. This will be fine for local development and for self-hosted installations, but you may run into issues when hosting using services like Heroku (which have an ephemeral storage, which means that your SQLite database will be erased at random intervals).
To address these kind of issues and make your bot production-ready, we also support Postgres out of the box.
How to switch from SQLite to Postgres
The database configuration is considered as Infrastructure, which means that it needs to be setup before the software is executed.
In this case, that means that you need to configure
DATABASE_URL environment variables.
If you want to use default postgres connection string simply set it as follow
Please make sure you are using Postgres 9.5 or higher.
If you don't want to type those variables each time you start Botpress, we also supports
.env files. Check out our configuration section for more informations about that