SQLite Installation
SQLite is the default (Quick Start) and recommended database to quickly create an app locally.
Install SQLite during app creation
Use one of the following commands:
- yarn
- npm
yarn create strapi-app my-project --quickstart
npx create-strapi-app@latest my-project --quickstart
This will create a new project and launch it in the browser.
tip
The Quick Start Guide is a complete step-by-step tutorial.
Install SQLite manually
In a terminal, run the following command:
- yarn
- npm
yarn add better-sqlite3
npm install better-sqlite3
Add the following code to your ./config/database.js
or ./config/database.ts
file:
- JavaScript
- TypeScript
./config/database.js
module.exports = ({ env }) => ({
connection: {
client: 'sqlite',
connection: {
filename: path.join(__dirname, '..', env('DATABASE_FILENAME', '.tmp/data.db')),
},
useNullAsDefault: true,
},
});
./config/database.ts
import path from 'path';
export default ({ env }) => ({
connection: {
client: 'sqlite',
connection: {
filename: path.join(__dirname, '..', '..', env('DATABASE_FILENAME', '.tmp/data.db')),
},
useNullAsDefault: true,
},
});