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β
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
The terminal will ask you whether you want to
Login/Signup
to Strapi Cloud (and start using your free 14-day trial projects), orSkip
this step. Use arrow keys and pressEnter
to make your choice. If you choose to skip this step, you will need to host the project yourself.The terminal will ask you a few questions. For each of them, if you press
Enter
instead of typing something, the default answer (Yes) will be used:π‘ TipYou can skip these questions using various options passed to the installation command. Please refer to the table for the full list of available options.
(optional) If you answered
n
for "no" to the default (SQLite) 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 |
--install | Install all dependencies, skipping the related CLI prompt |
--no-install | Do not install all dependencies, skipping the related CLI prompt |
--git-init | Initialize a git repository, skipping the related CLI prompt |
--no-git-init | Do not initialize a git repository, skipping the related CLI prompt |
--example | Add example data, skipping the related CLI prompt |
--no-example | Do not add example data, skipping the related CLI prompt |
--skip-cloud | Skip Strapi Cloud login and project creation steps |
--skip-db | Skip all database-related prompts and create a project with the default (SQLite) database |
--template <template-name-or-url> | Create the application based on a given template. Additional options for templates are available, see the templates documentation for details. |
--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 the 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