Database
Minoro requires a relational database to store some data such as user accounts and roles for authentication and authorization.
We currently support SQLite and PostgreSQL.
By default, when Minoro boots up, it will run migrations to create the necessary tables in the database. This means you can start using Minoro without having to worry about setting up the database schema yourself.
Note on Serverless Environments
When using Minoro in serverless environments, such as AWS Lambda or Vercel, the migrations will run on every function call. This is because the database connection is established on each invocation, and Minoro checks if migrations need to be run.
In such cases, you can disable migrations in the config and run them once in your CI/CD pipeline before deploying.
const minoro = createMinoro({
async setup() {
return {
database: {
type: 'postgres',
connection: '...',
runMigrations: false,
},
}
},
})You would then run migrations manually via a simple script during your deployment process, for example:
import { migrateDatabase } from 'minoro'
await migrateDatabase({
type: 'postgres',
connection: '...',
})
console.log('Database migrations completed successfully!')You can find examples in the Deployment documentation.
SQLite
Under the hood, Minoro uses @libsql/client to connect to a SQLite database. This means you can use any SQLite database, and other providers such as Turso.
To connect to a SQLite database, you can use the following configuration:
import { createMinoro } from 'minoro'
const minoro = createMinoro({
setup() {
return {
database: {
type: 'sqlite',
connection: 'file:/your/db/file.db'
},
},
},
})PostgreSQL
Minoro uses pg to connect to a PostgreSQL database. This means you can use any PostgreSQL database, including managed services such as Neon, Supabase, or any other provider.
import { createMinoro } from 'minoro'
const minoro = createMinoro({
setup() {
return {
database: {
type: 'postgres',
connection: 'your-postgres-connection-string',
},
},
},
})