# Azion CLI init

The Azion CLI `init` command starts a project from a preset and a template, in a folder it creates inside the current directory. A preset gives the project the build settings of one framework or language, and the template is the starter code for that preset. The command writes the `azion` folder that [Azion CLI deploy](/en/documentation/devtools/cli/deploy/) reads later. The presets the build accepts are listed on [Azion CLI presets](/en/documentation/devtools/cli/resources/presets/), and the options every command accepts, such as `--format`, `--out`, and `-y`, are on [Global options](/en/documentation/devtools/cli/globals/).

---

## Usage

`azion init` asks for the preset and the template in two pickers, then fetches the template and sets up the project:

```bash
azion init [flags]
```

| Flag                     | Short | Type   | Default   | Description                                                                                                                     |
| ------------------------ | ----- | ------ | --------- | ------------------------------------------------------------------------------------------------------------------------------- |
| `--auto`                 | —     | —      | —         | Skips the questions about a local development server and a deploy at the end of the command.                                    |
| `--config-dir`           | —     | string | `"azion"` | Relative path to the folder that holds your `azion.json` and `args.json` files.                                                 |
| `--local`                | —     | —      | —         | Runs the build and the deploy on your machine when you deploy the project from this command.                                    |
| `--name`                 | —     | string | —         | Name of the application. The command creates the project in a folder with this name. Without it, the command asks for the name. |
| `--package-manager`      | —     | string | —         | Package manager that installs the project dependencies, such as `npm`, `yarn`, or `pnpm`.                                       |
| `--skip-framework-build` | —     | —      | —         | Skips the framework build that runs before `azion build`.                                                                       |
| `--sync`                 | —     | —      | —         | Synchronizes the local `azion.json` file with the remote resources when you deploy the project from this command.               |

The command has no flag that sets the preset or the template: `--preset` and `--template` are refused with `Error: unknown flag`. You choose both in the pickers on every run, even with `--auto`. To also answer the dependency question without stopping, add `-y` to `--auto`.

The pickers need a terminal. Without one, the command stops with `Error: EOF`.

After the command ends, change to the project folder before you build or deploy. The command prints this reminder in its output.

### Prompts

`azion init` asks these questions in this order. A picker moves with the arrow keys and filters as you type:

| Prompt                                                                                                           | When it appears                                                                                                                                                                              | How to skip it   |
| ---------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------- |
| `Your application's name:`                                                                                       | Without `--name`. The suggested name in parentheses is random on each run.                                                                                                                   | `--name`         |
| `Choose a preset:`                                                                                               | On every run.                                                                                                                                                                                | No flag          |
| `Choose a template:`                                                                                             | After the preset. It lists the templates of the chosen preset.                                                                                                                               | No flag          |
| `Do you want to install project dependencies? This may be required to generate initial configuration file (Y/n)` | After the template is fetched and configured.                                                                                                                                                | `-y` answers yes |
| `Do you want to start a local development server? (y/N)`                                                         | After the dependencies are installed and the configuration is built. With `n`, the command prints that [Azion CLI dev](/en/documentation/devtools/cli/dev-command/) starts the server later. | `--auto`         |
| `Do you want to deploy your project? (y/N)`                                                                      | After the development server question. With `n`, the command prints that `azion deploy` deploys the project later.                                                                           | `--auto`         |

The preset picker offers 25 presets: *AI Studio*, *Angular*, *Astro*, *Docusaurus*, *Eleventy*, *Emscripten*, *Gatsby*, *Hexo*, *Hono*, *Hugo*, *Javascript*, *Jekyll*, *Next*, *Nuxt*, *OpenNextJS*, *Preact*, *Qwik*, *React*, *Rustwasm*, *Stencil*, *Svelte*, *Typescript*, *Vitepress*, *Vue*, and *Vuepress*.

This list differs from the one `azion list presets` prints, and it has no HTML entry. To set up an HTML site, run `azion link --preset html` in the site folder, as [Azion CLI link](/en/documentation/devtools/cli/link-command/) describes.

---

## Examples

Each example shows the command and the output it prints.

### Initialize a project interactively

This command starts a project named `my-app`. In the pickers, select *Javascript* and then *Hello World*, and answer `Y` to the dependency question:

```bash
azion init --name my-app
```

The command fetches the template, installs the dependencies, and builds the initial configuration:

```text
? Choose a preset:  [Use arrows to move, type to filter]
> AI Studio
  Angular
  Astro
  Docusaurus
  Eleventy
  Emscripten
  Gatsby
  Hexo
  Hono
  Hugo
  Javascript
  Jekyll
  Next
  Nuxt
  OpenNextJS
  Preact
  Qwik
  React
  Rustwasm
  Stencil
  Svelte
  Typescript
  Vitepress
  Vue
  Vuepress
? Choose a preset: Javascript
? Choose a template:  [Use arrows to move, type to filter]
> Hello World
  HTMX Boilerplate
  Simple Javascript Router Node
  Simple Javascript Router
  QStash EdgeFunction Scheduler
  Upstash Geolocation
  Upstash Rate Limit
? Choose a template: Hello World

Fetching selected template...

Template successfully fetched
Template successfully configured
🤔 Do you want to install project dependencies? This may be required to generate initial configuration file (Y/n) Y
Installing application dependencies
up to date, audited 1 package in 307ms
found 0 vulnerabilities
…
[Azion] [Build] › ℹ  info      Using preset: javascript
[Azion] [Build] › ✔  success   Build completed successfully with only azion.config
[Azion] [IaC] › ✔  success   Manifest generated successfully at <project-dir>/.edge/manifest.json
```

The command then asks whether to start a local development server and whether to deploy the project. With `n` to both, it prints how to run each later and ends with `Your application my-app was initialized successfully`.

The command creates the project in a `my-app` folder inside the current directory. For the *Hello World* template of the *Javascript* preset, the folder holds these files:

```text
.
./.edge
./.edge/manifest.json
./.gitignore
./azion
./azion.config.mjs
./azion/azion.json
./index.js
./info.json
./package-lock.json
./package.json
./README.md
./src
./src/function
./src/function/index.js
```

The template sets the extension of the configuration file, `azion.config.mjs` or `azion.config.cjs`. For more information, refer to [azion.config.js](/en/documentation/devtools/cli/azion-config-js/).

### Initialize a project with fewer questions

This command starts the same project with only the two pickers to answer. Select *Javascript* and then *Hello World*:

```bash
azion init --name my-app --auto -y
```

The `-y` option installs the dependencies, and `--auto` skips the development server and deploy questions. The command deploys nothing:

```text
? Choose a preset:  [Use arrows to move, type to filter]
> AI Studio
  Angular
  Astro
  Docusaurus
  Eleventy
  Emscripten
  Gatsby
  Hexo
  Hono
  Hugo
  Javascript
  Jekyll
  Next
  Nuxt
  OpenNextJS
  Preact
  Qwik
  React
  Rustwasm
  Stencil
  Svelte
  Typescript
  Vitepress
  Vue
  Vuepress
? Choose a preset: Javascript
? Choose a template:  [Use arrows to move, type to filter]
> Hello World
  HTMX Boilerplate
  Simple Javascript Router Node
  Simple Javascript Router
  QStash EdgeFunction Scheduler
  Upstash Geolocation
  Upstash Rate Limit
? Choose a template: Hello World

Fetching selected template...

Template successfully fetched
Template successfully configured
Installing application dependencies
up to date, audited 1 package in 354ms
found 0 vulnerabilities
…
[Azion] [Build] › ℹ  info      Using preset: javascript
[Azion] [Build] › ✔  success   Build completed successfully with only azion.config
[Azion] [IaC] › ✔  success   Manifest generated successfully at <project-dir>/.edge/manifest.json
If you want to start a local development server later, run 'azion dev'
Make sure to change to the new working directory before running building or deploying your project
If you want to deploy your application later, run 'azion deploy'
Make sure to change to the new working directory before running building or deploying your project
Your application my-app was initialized successfully
```

---

## Related resources

- [Global options](/en/documentation/devtools/cli/globals.md): The options every command accepts, such as `-y`, which answers the dependency question.
- [Azion CLI presets](/en/documentation/devtools/cli/resources/presets.md): The presets the build and the link command accept, and how they differ from the init picker.
- [Azion CLI link](/en/documentation/devtools/cli/link-command.md): The command that sets up an existing folder, such as an HTML site, instead of starting from a template.
- [Azion CLI deploy](/en/documentation/devtools/cli/deploy.md): The command that deploys the project from its folder after the init.
