Skip to content

Bring your own database

This is one of the most iconic feature of Fief. "Bring your own database" allows you to configure your very own SQL database, hosted anywhere you want, and let Fief store all your data into it. This is especially useful if you have special requirements about where and how your data should be stored.

Then, Fief will execute its logic by reading and writing data to your database, and nowhere else.

I want to host everything myself!

If you don't want to use our cloud instance at all, you can also host the entire Fief server on your own! You can find detailed instructions here.

Setup your database

You can configure your database during the creation of your workspace. At step 2, select the option My own database.

Select the option My own database

Then, you'll need to enter the details about your database.

External database configuration

  • Database type: you have the choice between a PostgreSQL and MySQL database.
  • Host
  • Port
  • Username
  • Password
  • Database name

Credentials are encrypted on Fief

To protect your database credentials, we encrypt them using the Fernet method. It means that even if a malicious individual achieves to access our systems, they couldn't steal your credentials.

After this step, we'll try to connect to your database and create the schema Fief needs to work. You'll then be redirected to your admin dashboard, where you'll be able to manage your workspace.

Admin dashboard

IP allow-list

If your database server controls which IP are allowed to connect, you can allow the following list of IP. Those are the ones used by our cloud server:

How Fief uses your database?


Fief won't directly use the database instance you provide. Instead, it'll create another dedicated schema.

  • For PostgreSQL servers, it'll create a schema, which could be more or less described as a "sub-database".
  • For MySQL servers, it'll create another database instance.


Fief maintain a migration table in your database to keep track of changes to the tables schema. When we deploy updates to Fief that needs to add or modify tables, we'll automatically apply migrations on your database.

Don't edit data yourself!

When you have access to the database, it might be tempting to manually add or modify data. DON'T DO THIS. If you make a mistake, you'll probably break your whole Fief workspace and your users won't be able to authenticate anymore.

If you really need to make a special operation on your data, please ask us first, we'll help you to do it safely.