You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Run `npx create-stackbit-app` in your terminal to create a new Stackbit application or add Stackbit into an existing site.
4
+
5
+
## Usage
6
+
7
+
To create a new Stackbit project from a starter, run the following command:
8
+
9
+
```txt
10
+
npx create-stackbit-app [dir]
11
+
```
12
+
13
+
To see a full list of options use the `--help` flag:
14
+
15
+
```txt
16
+
> npx create-stackbit-app --help
17
+
18
+
Options:
19
+
--version Show version number [boolean]
20
+
-s, --starter Choose a starter [choices: "nextjs", "ts-nextjs"]
21
+
--help Show help [boolean]
22
+
```
23
+
24
+
### Choosing a Starter
25
+
26
+
Use the `--starter` option for specifying a starter. Run the command with the `--help` flag to see a full list of available starters.
27
+
28
+
```txt
29
+
npx create-stackbit-app --starter ts-nextjs
30
+
```
31
+
32
+
If no starter option is provided, [the default starter](https://github.com/stackbit-themes/nextjs-starter) is used.
33
+
34
+
### Setting Project Directory
35
+
36
+
Pass a directory name as the only argument when running the command. For example, if you wanted your directory to be name `my-site`, the command would look something like this:
37
+
38
+
```txt
39
+
npx create-stackbit-app my-site
40
+
```
41
+
42
+
If no name is provided, the directory will be `my-stackbit-site-[id]`, where `[id]` is a randomly-generated string used to avoid directory conflicts.
43
+
44
+
## Adding Stackbit to Existing Projects
45
+
46
+
The script detects when you may be working with an existing project (it looks for a `package.json` file in the working directory).
47
+
48
+
If in an existing project, the script asks if you'd like to add Stackbit to the project. Today, this only prints a resource URL. If you choose _no_, the command exits.
0 commit comments