Skip to main content

Installing from CLI

πŸ— Work in progress

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 and v20). 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:

DatabaseRecommendedMinimum
MySQL8.08.0
MariaDB10.610.5
PostgreSQL14.012.0
SQLite33
βœ‹ Caution

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:

  1. In a terminal, run the following command:

    npx create-strapi@latest
    Additional explanations for the command:
    • npx runs a command from a npm package
    • create-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.

  2. Type the name of your project. If you press Enter instead of typing something, the default my-strapi-project name will be used.

    πŸ’‘ Tip

    This question can be skipped by passing the project name to the command at step 1 (e.g., npx create-strapi@latest my-strapi-project).

  3. Choose whether you want to use TypeScript or not, by typing y for yes or n for no, then pressing Enter.
    If you press Enter without typing anything, as "yes" is the default selected option, it will create a TypeScript project.

  4. Choose whether you want to use the default database type (SQLite) or not, by typing y for "yes" or n for "no", then pressing Enter.
    If you press Enter without typing anything, as "yes" is the default selected option, it will create a project with a SQLite database.

  5. (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 press Enter without typing anything, the default value (indicated in parentheses in the terminal output) will be used.

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:

OptionDescription
--no-runDo not start the application after it is created
--ts
--typescript
Initialize the project with TypeScript (default)
--js
--javascript
Initialize the project with JavaScript
--use-npmForce the usage of npm as the project package manager
--use-yarnForce the usage of yarn as the project package manager
--use-pnpmForce the usage of pnpm as the project package manager
--skip-cloudSkip 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:
  • sql for a SQLite database (default)
  • postgres for a PostgreSQL database
  • mysql for a MySQL database
--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.
✏️ Notes
  • 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:

  • 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:
  1. In the terminal, ensure you are still in the folder that hosts the Strapi project you created.
  2. Run the git init command to initialize git for this folder.
  3. Run the git add . command to add all modified files to the git index.
  4. Run the git commit -m "Initial commit" command to create a commit with all the added changes.
  5. 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.
  6. 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 replace yourname by your own GitHub profile name, and my-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 develop