Skip to content

feat: documents the add command #733

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions docs/reference/cli.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,52 @@ There are a few common commands that you will use frequently:
- `nitric start` runs the Nitric server locally
- `nitric up` deploys your stack to the cloud
- `nitric down` destroys your stack from the cloud
- `nitric add` adds new resources to your project

## Adding Resources

The `add` command helps you add new resources to your project:

```bash
nitric add
```

### Adding a Website

To add a new website to your project:

```bash
nitric add website
```

This will walk you through an interactive process to:

- Name your website
- Select a tool/framework (currently supports [Astro](https://astro.build/), [Vite](https://vite.dev/), and [Hugo](https://gohugo.io/))
- Configure the website's base URL path and dev server port

You can also specify the website name and tool directly:

```bash
# For Astro
nitric add website my-site astro

# For Vite
nitric add website my-site vite

# For Hugo
nitric add website my-site hugo
```

### Adding a Stack

The `add stack` command is an alias for `stack new` and can be used to create a new stack:

```bash
nitric add stack
```

This will walk you through an interactive process to create a new stack configuration for a particular cloud provider. For more details about stack configuration and options, see the [Stacks section](#stacks) below.

## Getting Started

Expand Down
33 changes: 33 additions & 0 deletions docs/websites.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,39 @@ websites:
url: http://localhost:4322
```

### Alternative: Using the Nitric CLI

You can also add a website to your project using the Nitric CLI's `add website` command:

```bash
nitric add website
```

This will walk you through an interactive process to:

- Name your website
- Select a tool/framework (currently supports [Astro](https://astro.build/), [Vite](https://vite.dev/), and [Hugo](https://gohugo.io/))
- Configure the website's base URL path and dev server port

You can also specify the website name and tool directly:

```bash
# For Astro
nitric add website my-site astro

# For Vite
nitric add website my-site vite

# For Hugo
nitric add website my-site hugo
```

The command will automatically:

1. Create a new website project using the framework's official package manager commands
2. Add the necessary configuration to your `nitric.yaml` file
3. Set up the build and development commands using the framework's native tools

### 3. Start your website locally

Run `nitric start` to start your website locally. This will use the `dev` configuration, which proxies requests to your local development server.
Expand Down
Loading