Connecting to a Database
Connecting to a database is critical to give your app access to real data. This section will cover how to connect to a database using the AI Builder.
To connect to a database you will need a DB_URI
. Reflex.build currently supports postgresql
and mysql
databases.
This is what it looks like for a Postgres database:
postgresql://username:password@hostname:port/database_name
postgresql://admin:secret123@db.mycompany.com:5432/mydatabase
You can also use a MySQL database. The connection string looks like this:
mysql://username:password@hostname:port/database_name
Connecting your Database before the app is generated
You can add your Database URI
at the start of your generation as shown below.

Here if you wanted to build a dashboard for example we recommend a prompt as follows:
Build a dashboard around my database data
Connecting your Database after the app is generated
You can add your Database URI
after you've already generated an app or directly from a template that you have forked as shown below.

Here if you wanted to hook up your data correctly we recommend a prompt as follows:
Use the database I added to rewrite the dashboard to display my expense reporting data, keep the existing layout charts and structure the same