---
title: "Create a JSS app locally"
slug: "create-a-jss-app-locally"
abstract: ""
---
# Create a JSS app locally

If you want to create a JSS app locally before [connecting it to your SitecoreAI instance](https://doc.sitecore.com/sai/en/developers/jss/22/jss-sai/connect-your-jss-app-to-sitecoreai.html "Connect your JSS app to SitecoreAI"), you can do so using the command line. This method gives you precise control over your initial app, letting you choose a framework for your app (either Angular or Next.js) and specify various other settings.

After creating an app this way, you can use it to replace the one [generated automatically](https://doc.sitecore.com/sai/en/developers/jss/22/jss-sai/create-a-jss-app-using-the-deploy-app.html "Create a JSS app using the Deploy app") for your SitecoreAI instance.

Creating an app from the command line is also the quickest way to upgrade your existing app to a newer version, because you can use files from the new app to replace any older unmodified versions in your current app.

> [!note]
> **Before you begin**
> -   Install [Node.js](https://nodejs.org/). We recommend using the most recent long-term support (LTS) version.

To create a JSS app locally based on your preferred framework:

::::tabs
:::tab{title="nextJS"}
## Next.js { .notintoc }

1. In a terminal, start the initializer using your preferred package manager:

    ```shell
    npx create-sitecore-jss nextjs
    ```

    ```shell
    npm init sitecore-jss nextjs
    ```

    ```shell
    yarn create sitecore-jss nextjs
    ```

    > [!tip]
    > If you're using `npx`, you can [include additional parameters](https://doc.sitecore.com/sai/en/developers/jss/22/jss-sai/jss-initializer-parameters.html "JSS initializer parameters") to manually configure the JSS initializer. Doing so can save you time by skipping some or all of the remaining steps in this process.

2. If prompted to install the `create-sitecore-jss@<latest-version>` package, answer `y`.
3. Enter the folder path for your new app.

    > [!tip]
    > This will default to `./nextjs-starter/`.
    >
    > The simplest approach is to use the default, but if you want to use a different name you can either copy your new JSS app's files into the `./headapps/nextjs-starter/` folder in your SitecoreAI app or reconfigure the XM Cloud app to use a different path.

4. Specify whether to use the pre-push hook for linting check, which validates all TypeScript types and code formatting each time you push changes to your remote repository.
5. Enter a name for your app.
6. Specify your Sitecore hostname or use the default value.
7. For the data fetching strategy, select `GraphQL`.
8. For the rendering strategy, select `SSG` or `SSR`, depending on your needs.
9. When asked if you are building for XM Cloud, answer `y`. This installs additional functionality including the XM Cloud add-on.

    > [!note]
    > **XM Cloud is now SitecoreAI**
    > Some code examples, images, and UI labels may still use XM Cloud while engineering assets are being updated.

10. When asked if you want to install other add-ons, take the following actions:
    - `nextjs-sxa` - always select this add-on, because it provides various core services and middleware for working with SitecoreAI, such as redirects, robots.txt, and sitemaps. It also provides samples components to help you quickly build your site content with Next.js.
    - `nextjs-multisite` - select this add-on if you want to include a sample Next.js configuration for working with environments that have multiple sites.

When you finish making your choices, the initializer will create your app in the specified directory. You can then use the new app to replace the one in your [locally cloned SitecoreAI app](https://doc.sitecore.com/sai/en/developers/jss/22/jss-sai/create-a-jss-app-using-the-deploy-app.html "Create a JSS app using the Deploy app") as needed. The default name and location used for these apps by SitecoreAI are as follows, and we recommend you use these unless you want to reconfigure the default paths yourself:

| App name | Path |
| --- | --- |
| `nextjs-starter` | `./headapps/` |

:::
:::tab{title="angular"}
## Angular { .notintoc }

1. In a terminal, start the initializer using your preferred package manager:

    ```shell
    npx create-sitecore-jss angular
    ```

    ```shell
    npm init sitecore-jss angular
    ```

    ```shell
    yarn create sitecore-jss angular
    ```

    > [!tip]
    > If you're using `npx`, you can [include additional parameters](https://doc.sitecore.com/sai/en/developers/jss/22/jss-sai/jss-initializer-parameters.html "JSS initializer parameters") to manually configure the JSS initializer. Doing so can save you time by skipping some or all of the remaining steps in this process.

2. If prompted to install the `create-sitecore-jss@<latest-version>` package, answer `y`.
3. Enter the folder path for your new app.

    > [!tip]
    > This will default to `./angular/`.
    >
    > The simplest approach is to use the default, but if you want to use a different name you can either copy your new JSS app's files into the `./headapps/spa-starters/angular/` folder in your SitecoreAI app or reconfigure the SitecoreAI app to use a different path.

4. Specify whether to use the pre-push hook for linting check, which validates all TypeScript types and code formatting each time you push changes to your remote repository.
5. When asked if you are building for XM Cloud, answer `y`. This installs additional functionality including the XM Cloud Node proxy app.

    > [!note]
    > **XM Cloud is now SitecoreAI**
    > Some code examples, images, and UI labels may still use XM Cloud while engineering assets are being updated.

6. Enter a name for your app.
7. Enter the folder path for your proxy app. This will default to `./node-xmcloud-proxy/`.

When you finish making your choices, the initializer will create your app in the specified directory. You can then use the new app to replace the one in your [locally cloned SitecoreAI app](https://doc.sitecore.com/sai/en/developers/jss/22/jss-sai/create-a-jss-app-using-the-deploy-app.html "Create a JSS app using the Deploy app") as needed. The default names and locations used for these apps by SitecoreAI are as follows, and we recommend you use these unless you want to reconfigure the default paths yourself:

| App type | App name | Path |
| --- | --- | --- |
| Angular | `angular` | `./headapps/spa-starters/` |
| Node proxy | `proxy` | `./headapps/spa-starters/` |

:::::::
