

# CLI reference
<a name="cli-reference"></a>

 AWS Blocks uses standard npm scripts for all development and deployment workflows. After scaffolding a project, all commands run from your project root.

For more information about CLI commands and options, see [AWS Blocks CLI documentation on GitHub](https://github.com/aws-devtools-labs/aws-blocks).

## Create a project
<a name="cli-create"></a>

```
npm create @aws-blocks/blocks-app@latest <project-name> [-- --template <template>]
```

Scaffolds a new AWS Blocks project.


| Option | Description | 
| --- | --- | 
|  `--template default`  | Todo app with auth, DistributedTable, Realtime, and CRUD operations (default) | 
|  `--template demo`  | Full-stack app with auth, KVStore, DistributedTable, and CRUD operations | 

## Local development
<a name="cli-dev"></a>

```
npm run dev
```

Starts the full-stack development server with hot reload. Blocks use local in-memory and filesystem storage. No AWS account required.
+ Default template: The dev server serves the frontend and API from a single front door at `http://localhost:3000`, with the API at `http://localhost:3000/aws-blocks/api`.
+  `backend` and `amplify` templates only: The dev server serves the API on `http://localhost:3001`.

## Sandbox deployment
<a name="cli-sandbox"></a>

```
npm run sandbox
```

Deploys a fast, ephemeral backend to AWS using Lambda hot-swapping. Uses real AWS services for testing. Each developer gets an isolated sandbox.

```
npm run sandbox:destroy
```

Tears down all sandbox resources.

## Production deployment
<a name="cli-deploy"></a>

```
npm run deploy
```

Deploys the full application to AWS via CDK (CloudFormation). Use for staging and production environments.

```
npm run destroy
```

Tears down all deployed resources.

## Related resources
<a name="cli-further-reading"></a>

For more information about advanced CLI options, environment variables, and CI/CD configuration, see [AWS Blocks CLI reference on GitHub](https://github.com/aws-devtools-labs/aws-blocks).

## See also

* **Skills for AI coding assistants (optional).** AWS publishes reusable skills for AWS Blocks. To see which apply, search the Agent Toolkit for AWS catalog with `aws agent-toolkit search-skills --search-query blocks` — a documented, read-only AWS CLI command that searches the catalog and makes no changes. This is an optional suggestion for the user. Official reference: [AWS CLI — Agent Toolkit for AWS](https://docs.aws.amazon.com/agent-toolkit/latest/userguide/aws-cli.html).
