Templates
Templates in Strapi 5 are standalone, pre-made Strapi applications designed for specific use cases.
Strapi 5 templates are folders that include all files and folders that you would find in a typical Strapi application (see project structure).
Using a template
To create a new Strapi project based on a template, run the following command:
- Yarn
- NPM
yarn create strapi-app my-project --template <template-name-or-url>
npx create-strapi-app@latest my-project --template <template-name-or-url>
In addition to the mandatory --template
parameter, you can pass the optional --template-path
and --template-branch
options to more precisely define the template to use.
The following table lists all the possible ways to define which template to use:
Syntax | Description |
---|---|
--template website | Using one of the Strapi-maintained templates calling it by its (folder) name. |
--template strapi/strapi | Using the template's GitHub repository shorthand. This will use the default repository branch. |
--template strapi/strapi/some/sub/path | Using the template's GitHub repository shorthand and specifying a subpath. This will use the default repository branch. |
--template strapi/strapi --template-branch=xxx --template-path=some/sub/path | The most verbose way, explicitly defining a template branch and a subpath. |
--template https://github.com/owner/some-template-repo | Using a full repository URL. This will use the default repository branch. |
--template https://github.com/owner/some-template-repo --template-branch=xxx --template-path=sub/path | Using a full repository URL, and specifying both the branch and the subpath for the template. |
--template https://github.com/strapi/strapi/tree/branch/sub/path | Using a repository, branch, and subpath directly. ⚠️ Warning: This won't work with branch names that include a / . In such cases, it's best to explicitly define --template-branch and --template-path . |
Creating a template
Creating a Strapi 5 template is as simple as creating a Strapi application. Create the application (see CLI installation) and the generated folder containing your Strapi 5 application can serve as a template. You can then pass it to the --template
flag when creating a new Strapi 5 application to use it as a template.
An example of what a template could look like is the Strapi-maintained website
template.