Installing from CLI
The content of this page might not be fully up-to-date with Strapi 5 yet.
Strapi CLI (Command Line Interface) installation scripts are the fastest way to get Strapi running locally. The following guide is the installation option most recommended by Strapi.
Preparing the installationβ
Before installing Strapi, the following requirements must be installed on your computer:
- Node.js: Only Active LTS or Maintenance LTS versions are supported (currently
v18
andv20
). Odd-number releases of Node, known as "current" versions of Node.js, are not supported (e.g. v19, v21). - Your preferred Node.js package manager:
- Python (if using a SQLite database)
A supported database is also required for any Strapi project:
Database | Recommended | Minimum |
---|---|---|
MySQL | 8.0 | 8.0 |
MariaDB | 10.6 | 10.5 |
PostgreSQL | 14.0 | 12.0 |
SQLite | 3 | 3 |
Strapi does not support MongoDB.
Creating a Strapi projectβ
Follow the steps below to create a new Strapi project, being sure to use the appropriate command for your installed package manager:
In a terminal, run the following command:
- NPM
- Yarn
- pnpm
npx create-strapi@latest
Additional explanations for the command:
npx
runs a command from a npm packagecreate-strapi
is the Strapi package@latest
indicates that the latest version of Strapi is used
Instead of npx, the traditional npm command can be used too, with
npm create strapi@latest
.Please note the additional dash between create and strapi when using npx:
npx create-strapi
vs.npm create strapi
.yarn create strapi
βοΈ NoteYarn does not support passing the version tag such as
@latest
, as opposed to npm. If you experience unexpected results with yarn and the latest version of Strapi is not installed, you might need to run theyarn cache clean
command to clean your Yarn cache.pnpm create strapi
Type the name of your project. If you press
Enter
instead of typing something, the defaultmy-strapi-project
name will be used.π‘ TipThis question can be skipped by passing the project name to the command at step 1 (e.g.,
npx create-strapi@latest my-strapi-project
).Choose whether you want to use TypeScript or not, by typing
y
for yes orn
for no, then pressingEnter
.
If you pressEnter
without typing anything, as "yes" is the default selected option, it will create a TypeScript project.Choose whether you want to use the default database type (SQLite) or not, by typing
y
for "yes" orn
for "no", then pressingEnter
.
If you pressEnter
without typing anything, as "yes" is the default selected option, it will create a project with a SQLite database.(optional) If you answered
n
for "no" to the previous (default database) question, the CLI will ask for more questions about the database:- Use arrow keys to select the database type you want, then press
Enter
. - Give the database a name, define the database host address and port, define the database admin username and password, and define whether the database will use a SSL connection.
For any of these questions, if you pressEnter
without typing anything, the default value (indicated in parentheses in the terminal output) will be used.
- Use arrow keys to select the database type you want, then press
Once all questions have been answered, the script will start creating the Strapi project.
CLI installation optionsβ
The above installation guide only covers the basic installation option using the CLI. There are other options that can be used when creating a new Strapi project, for example:
Option | Description |
---|---|
--no-run | Do not start the application after it is created |
--ts --typescript | Initialize the project with TypeScript (default) |
--js --javascript | Initialize the project with JavaScript |
--use-npm | Force the usage of npm as the project package manager |
--use-yarn | Force the usage of yarn as the project package manager |
--use-pnpm | Force the usage of pnpm as the project package manager |
--skip-cloud | Skip Strapi Cloud login and project creation steps |
--dbclient <dbclient> | Define the database client to use by replacing <dbclient> in the command by one of the these values:
|
--dbhost <dbhost> | Define the database host to use by replacing <dbclient> in the command by the value of your choice |
--dbport <dbport> | Define the database port to use by replacing <dbclient> in the command by the value of your choice |
--dbname <dbname> | Define the database name to use by replacing <dbclient> in the command by the value of your choice |
--dbusername <dbusername> | Define the database username to use by replacing <dbclient> in the command by the value of your choice |
--dbpassword <dbpassword> | Define the database password to use by replacing <dbclient> in the command by the value of your choice |
--dbssl <dbssl> | Define that SSL is used with the database, by passing --dbssl=true (No SSL by default) |
--dbfile <dbfile> | For SQLite databases, define the database file path to use by replacing <dbclient> in the command by the value of your choice |
--quickstart | (Deprecated in Strapi 5) Directly create the project in quickstart mode. |
- If you do not pass a
--use-yarn|npm|pnpm
option, the installation script will use whatever package manager was used with the create command to install all dependencies (e.g.,npm create strapi
will install all the project's dependencies with npm). - For additional information about database configuration, please refer to the database configuration documentation.
- Experimental Strapi versions are released every Tuesday through Saturday at midnight GMT. You can create a new Strapi application based on the latest experimental release using
npx create-strapi@experimental
. Please use these experimental builds at your own risk. It is not recommended to use them in production.
Skipping the Strapi Cloud login stepβ
When the installation script runs, the terminal will first ask you if you want to login/signup. Choosing Login/signup
will create a free, 14-day trial Strapi Cloud project as described in the Quick Start Guide.
If you prefer skipping this Strapi Cloud login part, use the arrow keys to select Skip
. The script will resume and create a local project. To deploy this project and host it online, you could later choose to:
- host it yourself by pushing the project's code to a repository (e.g., on GitHub) before following a 3rd-party deployment guide,
- or use the Cloud CLI commands to login to Strapi Cloud and deploy your project there.
If you want to host your project yourself and are not already familiar with GitHub, the following togglable content should get you startedπ.
Steps required to push your Strapi project code to GitHub:
In the terminal, ensure you are still in the folder that hosts the Strapi project you created.
Run the
git init
command to initialize git for this folder.Run the
git add .
command to add all modified files to the git index.Run the
git commit -m "Initial commit"
command to create a commit with all the added changes.Log in to your GitHub account and create a new repository. Give the new repository a name, for instance
my-first-strapi-project
, and remember this name.Go back to the terminal and push your local repository to GitHub:
a. Run a command similar to the following:
git remote add origin git@github.com:yourname/my-first-strapi-project.git
, ensuring you replaceyourname
by your own GitHub profile name, andmy-first-strapi-project
by the actual name you used at step 4.b. Run the
git push --set-upstream origin main
command to finally push the commit to your GitHub repository.
Additional information about using git with the command line interface can be found in the official GitHub documentation.
Running Strapiβ
To start the Strapi application, run the following command in the project folder:
- Yarn
- NPM
yarn develop
npm run develop