---
title: "The JSS app initializer"
slug: "the-jss-app-initializer"
abstract: "Describes using the initializer to create a JSS app with guided prompts"
---
# The JSS app initializer

The Sitecore JavaScript Rendering SDK (JSS) provides the `create-sitecore-jss` package that contains an app initialization script and JSS application templates for popular JavaScript frameworks and application add-ons.

To use the JSS initializer, in a terminal, you can run one of the following commands:

```shell
npx create-sitecore-jss

```

```shell
npm init sitecore-jss

```

```shell
yarn create sitecore-jss

```

To provide any arguments, use the `npx` command.

<details>
<summary><h2>Required arguments</h2></summary>

When creating a JSS application with the initializer, you can follow the prompts to provide information about the setup you want for your application.

Alternatively, you can override any prompt by passing in that value as a flag using the following arguments:

| Argument | Type | Description |
| --- | --- | --- |
| `templates` | `string[]` | A comma-separated list of template names to use in scaffolding the JSS application. It can include the name of a [base app template](https://doc.sitecore.com/xp/en/developers/hd/23/sitecore-headless-development/the-jss-app-initializer.html#UUID-8f4a9c59-1b15-1364-e191-2154cabd4afe_section-idm4491549494326432908720097911), for example, `nextjs`, and any number of [add-on templates](https://doc.sitecore.com/xp/en/developers/hd/23/sitecore-headless-development/the-jss-app-initializer.html#UUID-8f4a9c59-1b15-1364-e191-2154cabd4afe_section-idm4584257198067232908721719464), such as `nextjs-styleguide`.<br><br>For example, `npx create-sitecore-jss --templates nextjs,nextjs-styleguide`.<br><br>You can also supply a list of templates using the positional argument: `npx create-sitecore-jss nextjs,nextjs-styleguide`. |
| `appName` | `string` | The name of your JSS application.<br><br>Default: *sitecore-jss-app*. |
| `destination` | `string` | Path/directory for the application. If you provide a non-empty directory path, the initializer shows potential changes to existing files. It also provides options for handling the change (approve the changes to the current file, skip the file, approve changes to all files, or abort). Using the initializer in a non-empty destination helps you apply add-on templates to an existing JSS project.<br><br>Default: *<current-directory-path>/<base-template-name>*. |
| `fetchWith` | `string` | Method for fetching data. Choose `REST` or `GraphQL`.<br><br>Default: *GraphQL*. |
| `prerender` | `string` | Only available if using the `nextjs` template. Prerendering method for the application. Choose between static site generation (SSG) and server-side rendering (SSR).<br><br>Default: *SSG*. |
| `language` | `string` | Only valid if using the `nextjs-styleguide` add-on. Language and locale code. For example, `es-MX`.<br><br>Default: *da-DK*. |
| `hostName` | `string` | The hostname of your Sitecore instance.<br><br>Default: *<app-name>.dev.local*. |

For example, if you want to skip the `templates`, `appName`, and `fetchWith` prompts, you can run the following command:

```shell
npx create-sitecore-jss --templates nextjs --appName my-nextjs-app --fetchWith GraphQL

```

You can shorten the command by using the positional argument as follows:

```shell
npx create-sitecore-jss nextjs --appName my-nextjs-app --fetchWith GraphQL

```

</details>

<details>
<summary><h2>Optional arguments</h2></summary>

In addition to the required arguments, the JSS initializer accepts the following optional parameters:

| Argument | Type | Description |
| --- | --- | --- |
| `appPrefix` | `boolean` | If present, the application:<br><br><ul><li>Uses the `appName` argument to prefix templates, ensuring each template has a unique name when deployed to Sitecore. Multiple templates with the same name cause errors when using strongly typed GraphQL queries because of naming conflicts.</li><li>Uses the `appName` argument to prefix placeholders. When using prefixed placeholders, if you have multiple JSS apps deployed to Sitecore, the Sitecore interface for inserting components in a placeholder shows only the components for the current site.</li></ul> |
| `force` | `boolean` | If provided, suppresses any questions related to file system operations, and the initializer runs default actions. |
| `silent` | `boolean` | If provided, suppresses log messages.<br><br>Usage: `npx create-sitecore-jss --silent` |
| `prePushHook` | `boolean` | If provided, runs a linting script that checks TypeScript type and code formatting validity. |
| `yes` | `boolean` | If provided, suppresses any questions related to the CLI argument values, and the initializer uses the default values. |

</details>

<details>
<summary><h2>Base templates</h2></summary>

When creating a project, you can provide *one base template name* using the positional argument or by using the `--templates` flag:

```shell
npx create-sitecore-jss <base-template-name>

```

Or:

```shell
npx create-sitecore-jss --templates <base-template-name>

```

The available *base template names* are:

- `nextjs`.
- `react`.
- `angular`.
- `vue`.
- `react-native`.
- `node-headless-ssr-experience-edge`.
- `node-headless-ssr-proxy`.

</details>

<details>
<summary><h2>Add-on templates</h2></summary>

When creating a project, in addition to the base template name, you can also provide *multiple add-on template names* using the positional argument or the `--templates` flag:

```shell
npx create-sitecore-jss <base-template-name>,<first-add-on-template-name>,<second-add-on-template-name>

```

Or:

```shell
npx create-sitecore-jss --templates <base-template-name>,<first-add-on-template-name>,<second-add-on-template-name>

```

The available *add-on template names* are:

- `nextjs-styleguide` - includes example components and the setup for [working disconnected](https://doc.sitecore.com/xp/en/developers/hd/23/sitecore-headless-development/working-disconnected-in-jss.html "Working disconnected in JSS").
- `nextjs-styleguide-tracking` - includes an example tracking component for applications running against a Sitecore Experience Platform (XP) instance. It requires the `nextjs-styleguide` add-on.
- `nextjs-sxa` - includes example components and setup for Headless SXA projects.
- `nextjs-multisite` - includes an example setup for hosting multiple sites from a single Next.js application.

</details>