Skip to main content

Installing from CLI

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​

A supported database is also required for any Strapi project:

DatabaseMinimumRecommended
MySQL5.7.88.0
MariaDB10.310.6
PostgreSQL11.014.0
SQLite33
caution

Strapi v4 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:

    yarn" label="Yarn">

    yarn create strapi-app my-project
    # 'yarn create' creates a new project
    # 'strapi-app' is the Strapi package
    # 'my-project' is the name of your Strapi project

    npm" label="NPM">

    npx create-strapi-app@latest my-project
    # 'npx' runs a command from an npm package
    # 'create-strapi-app' is the Strapi package
    # '@latest' indicates that the latest version of Strapi is used
    # 'my-project' is the name of your Strapi project
  2. Choose an installation type:

    • Quickstart (recommended), which uses the default database (SQLite)
    • Custom (manual settings), which allows to choose your preferred database
  3. (Custom installation type only) Among the list of databases, choose a database for your Strapi project.

  4. (Custom installation type only) Name your project's database.

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:

  • --quickstart: Directly create the project in quickstart mode.

  • --template: Create a project with pre-made Strapi configurations (see Templates).

  • --typescript/--ts: Create a project in TypeScript.

  • --no-run: Prevent Strapi from automatically starting the server (useful in combination with --quickstart).

  • --skip-cloud: Automatically answers "Skip" to the Login/Signup question, which prevents the installation script from login into Strapi Cloud (useful in combination with --quickstart).

For more information on available flags, see our CLI documentation.

Strapi also offers a starters CLI to create a project with a pre-made frontend application (see our dedicated blog post).

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-app@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:

  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" label="Yarn">

yarn develop

npm" label="NPM">

npm run develop
Where is my content?

For self-hosted Strapi projects, all your content is saved in a database file (by default, SQLite) found in the .tmp subfolder in your project's folder. So anytime you start the Strapi application from the folder where you created your Strapi project, your content will be available (see database configuration for additional information).

If the content was added to a Strapi Cloud project, it is stored in the database managed with your Strapi Cloud project (see advanced database configuration for Strapi Cloud for additional information).