SQLite and MySQL

Configure SQLite automatically or connect Miblo to MySQL, then inspect and apply SQL migrations.

▶ Watch the demo
On this page

SQLite

Choose SQLite when creating a project. Miblo prepares .env, creates miblo.sqlite and applies initial migrations. No database server is needed.

Miblo operationSQLite migration
Create projectApplied automatically.
Add model with API stoppedApplied automatically.
Edit model with mApply with b or on the next API start.
.env
DATABASE_URL=sqlite://miblo.sqlite?mode=rwc

The generated API also creates a missing database file and applies migrations at startup.

MySQL

  1. Start a MySQL server, then choose MySQL when creating the project.
  2. Enter host, port, database, username and password in Miblo.
  3. Confirm Save the MySQL connection?. It is written to .env.
  4. In b, select Initialize the database and tables, then confirm.

The MySQL account needs permission for the requested operation. Miblo does not start a MySQL server.

Use the included compose.yaml

For local development, use the generated MySQL service and connection values from .env.example.

shell
docker compose up -d db
# Once MySQL is ready:
miblo db init
miblo run

Database commands

CommandEffect
miblo db checkTest the connection.
miblo db initInitialize if needed and apply migrations.
miblo db migrateApply pending migrations.
miblo db schemaPrint the actual schema as JSON.

--project PATH selects a project in another directory. Passwords are not passed as command arguments.

Configuration and limits

Miblo’s database commands read DATABASE_URL from the project’s .env first, falling back to the environment if absent. The generated API uses its runtime configuration; avoid conflicting file and shell values.

The database engine is selected at creation. Switching engines requires a separate code and data migration. The schema view distinguishes the actual database from declared models.

Search for a feature or command.

↑ ↓ browse Enter to open