> ## Documentation Index
> Fetch the complete documentation index at: https://docs.gatojs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# gato create

> Assemble a new GatoJS project from a local kit checkout: options, prompts, the order of checks, what is rolled back on failure and what the project gets.

```bash theme={null}
gato create <dir> --kit <path> [options]
```

`gato create` assembles a new project from a local kit checkout: the core plus the kit modules you choose, with your project's names, a ready `.env` and, optionally, installed dependencies, a first commit, a running database and a first admin. Most people run it through [`create-gato-app`](https://docs.gatojs.com/cli/create-gato-app), which downloads the kit and passes `--kit` for you.

```bash theme={null}
git clone https://github.com/webamigos/gatojs.git ~/gatojs
npx gato-cli@latest create ./my-app --kit ~/gatojs
npx gato-cli@latest create ./my-app --kit ~/gatojs --yes --modules audit-logs,api-keys --no-install
```

## Options

**dir** `string` *required*

Target directory. It must not exist or be empty. Its last path segment becomes the [project slug](#project-name).

**--kit** `path` *required*

Local GatoJS checkout the project is assembled from. Required for `gato`. With `npm run wa -- create` inside a kit checkout it defaults to that checkout. An empty value is an error.

**--modules** `a,b`

Kit modules to install besides the core. `--modules ""` or `--modules=` means core only. Without it you are asked; with `--yes` you get core only.

**--locales** `pl,en`

App languages. Only `pl` and `en` are allowed, `pl` is required, no duplicates. Default `pl,en`.

**--title** `string`

Display name. Default: the slug with each word capitalised (`acme-app` → `Acme App`).

**--admin-email** `string`

First admin's address. Written to `ADMIN_EMAIL` in `.env`, used by `admin:create` during `--setup` and printed in the next steps.

**--yes** `boolean`

No questions: options you did not give get their defaults. Required without a terminal (CI, redirected input).

**--setup** `boolean`

After `npm install`, run `docker compose up -d --wait`, `npx prisma migrate dev --name init` and, with an admin email, `npm run admin:create`. Cannot be combined with `--no-install`.

**--no-install** `boolean`

Skip `npm install`. Also skips the first commit (see [step 9](#what-it-does-step-by-step)).

**--no-git** `boolean`

Skip `git init` and the first commit. `git` is still required to read the kit's file list.

**--cli-source** `tarball`

Write `"gato-cli": "file:<absolute path>"` instead of `"^<version>"` into the project's `devDependencies`, to test a packed CLI in CI. The file must exist.

> [!WARNING]
>
> `--title` and `--admin-email` are not validated or escaped. A title with double quotes, such as `Acme "Q"`, breaks `src/shared/config/project.ts` and leaves an unclosed quote in `EMAIL_FROM`. A title containing `wa-app` or `wa_app` is also rewritten by the placeholder replacement. Use plain titles.

## Prompts

Without `--yes`, the CLI asks for everything you did not pass, in this order: modules, languages, display name, admin email and, when it will install dependencies, whether to run the setup now.

* **Modules and languages** are checkbox lists: arrows move, space toggles, `a` selects all, `i` inverts, Enter confirms. The module list shows every kit module except `core` with its description, nothing preselected; Enter with nothing selected means core only. On the language list `pl` and `en` are preselected and `pl` cannot be unchecked.
* **Display name** defaults to the name derived from the slug; **admin email** can be left empty to skip.
* **Setup** (`Uruchomić bazę, migrację i admin:create teraz? [t/N]`, "run the database, migration and admin:create now?") accepts `t`, `tak`, `y` or `yes`; anything else, including Enter, means no.

The setup question appears even when every other option is given, because `--setup` has no "no" form. In scripts and CI, always pass `--yes`.

Without a terminal, the first question stops the command with `Brak terminala: użyj --yes` ("no terminal: use --yes") before the project directory is created. Ctrl+C on a list stops it with `Przerwano` ("aborted"), also before anything is written.

## Project name

The last segment of `<dir>` must match `^[a-z][a-z0-9-]{1,49}$`: lowercase letters, digits and hyphens, starting with a letter, 2 to 50 characters. Three names are derived from it and replace the kit's placeholders in the files listed in `placeholderFiles` of `kit/kit.json`:

| Name | Derived from | For `acme-app` | Used in |
| - | - | - | - |
| Display name | `--title`, or the slug with capitalised words | `Acme App` | `src/shared/config/project.ts`, `EMAIL_FROM` in `.env.example`, `project.name` in `.wa/kit.json` |
| Slug | The last path segment | `acme-app` | `name` in `package.json`, the uploads bucket `acme-app-uploads` |
| Snake | The slug with `_` instead of `-` | `acme_app` | Database `acme_app` in `docker-compose.yml` and `.env.example`, `acme_app_test` for integration tests |

## What it does, step by step

Nothing is asked or run before the checks in steps 1 and 2.

**1. Options, name and directory**

Parse options, check `--kit` is given (`gato create needs --kit <path to a GatoJS checkout>`), check `--cli-source` exists, check the slug, then the target directory. A directory with any entry, hidden files included, stops the command: `Katalog <path> istnieje i nie jest pusty` ("directory exists and is not empty"). An existing empty directory is fine.

**2. Kit checkout**

A missing path gives `--kit: <path> does not exist`; a directory without `kit/kit.json` gives `<path> is not a GatoJS checkout (no kit/kit.json)`. Then the CLI reads `kit/kit.json` and the manifests in `kit/modules/`.

**3. Prompts**

Questions or defaults, as described above.

**4. Modules**

The selected modules plus every module they `requires`, plus `core`. An unknown name stops the command with `Nieznany moduł: <name>. Dostępne: <list>` ("unknown module; available: …") before the directory is created.

**5. Assembly**

The directory is checked again, created, and filled with the files of the selected modules. Kit-only files (`kitOnly` in `kit/kit.json`) and generated files are skipped. File permission bits are kept. Placeholders are replaced, and the hash of every copied file is recorded in `.wa/kit.json`. `package.json` gets the slug as `name`, version `0.1.0`, the dependencies of the selected manifests and, from `gato`, `gato-cli` in `devDependencies`. `package-lock.json` is renamed and loses the kit's tool packages. Finally the CLI writes `.wa/kit.json` and runs [`gato generate`](https://docs.gatojs.com/cli/generate).

**6. .env**

A copy of `.env.example` with `BETTER_AUTH_SECRET` set to 32 random bytes in base64url, and `ADMIN_EMAIL` when you gave one. The file gets mode `0600`. Module variables (`API_KEY_PEPPER`, `STORAGE_*`, `S3_*`) get their example values from the `wa:modules` region.

**7. git init**

Unless `--no-git`.

**8. npm install**

Unless `--no-install`. It aligns the lockfile with the project's `package.json`.

**9. First commit**

Only with git and after `npm install`: `chore: initial commit from wa-kit v<kitVersion>`, with `--no-verify`. With `--no-install` the CLI only runs `git init`, because the first install would change the committed lockfile and leave a dirty tree for `gato update`. A failed commit (for example no `user.name` or `user.email`) does not stop the command; it prints `Uwaga: nie utworzono commita (<reason>). Skonfiguruj git i zrób commit ręcznie.` ("no commit created; configure git and commit by hand").

**10. Setup**

With `--setup` or a "yes" answer: `docker compose up -d --wait`, `npx prisma migrate dev --name init` and, with an admin email, `npm run admin:create -- --email <address>`.

**11. Next steps**

Without setup, the CLI prints `cd <path>`, `docker compose up -d`, `npx prisma migrate dev --name init`, `npm run admin:create -- --email <address or <your-email>>` and `npm run dev`. With `--no-install`, `npm install` and (with git) `git add -A && git commit -m "chore: initial commit"` come right after `cd`. After a successful setup it prints only `cd <path>` and `npm run dev`.

## Rollback and its limits

* **A failure during assembly (step 5)** deletes the project directory. If the directory existed (empty) before, its contents are deleted and the directory stays. A failure of the cleanup itself is swallowed; you see the original error.
* **A failure after assembly** (writing `.env`, `git init`, `npm install`, setup) rolls nothing back. The project directory stays and the later steps neither run nor get printed.
  * A failed `npm install` gives `Projekt utworzony w <path>, ale npm install się nie powiódł. Uruchom: cd <path> && npm install` ("project created, but npm install failed; run …"). There is no commit and no setup then.
  * A failed setup step gives `Project created at <path>, but the setup failed (<reason>). Continue with:` followed by the remaining commands. The first commit already exists. The usual cause is a port in use; see [Installation](https://docs.gatojs.com/installation.md).

## What the project gets

The project has the same directory layout as the kit, with these differences:

| In the project | Compared with the kit |
| - | - |
| `kit/`, `docs/`, `packages/gato-cli`, `packages/create-gato-app` | Absent: they are kit-only. |
| `prisma/migrations/` | Absent. The kit commits no migrations; your first migration goes into the project's repository ([Database and migrations](https://docs.gatojs.com/guides/database-and-migrations.md)). |
| `.wa/kit.json` | `kitVersion`, `kitRepo`, project name and slug, locales, the selected modules with versions, manifests and file hashes, and empty `projectModules` ([reference](https://docs.gatojs.com/cli/kit-json.md)). |
| `package.json` | `name` equal to the slug, `version` `0.1.0`, the dependencies of the core and the selected modules, `gato-cli` in `devDependencies`. |
| `src/i18n/locales.generated.ts` | Only the selected languages. |
| `wa:*` regions | Filled for the selected modules: relations in the Prisma schema, variables in `.env.example`, services in `docker-compose.yml`, CI steps in the workflows. Empty without modules. |
| `.env` | Ready to start, with a random secret and example values for module variables. |
| `.wa/bin/wa.mjs` | The same CLI bundle as in the kit, so `npm run wa -- <command>` works without building anything. |

> [!WARNING]
>
> The example `API_KEY_PEPPER` copied into `.env` is for development only: with `NODE_ENV=production` the `api-keys` module rejects it and the app does not start. Set your own value of at least 32 characters before deploying. See [API keys](https://docs.gatojs.com/modules/api-keys.md).

## Examples

```bash theme={null}
# Interactive
npx gato-cli@latest create ./acme-app --kit ~/gatojs

# Scripted, all modules, English and Polish, no install
npx gato-cli@latest create ./acme-app --kit ~/gatojs --yes \
  --modules audit-logs,api-keys,uploads --title "Acme" --no-install

# Inside a kit checkout, using the committed bundle
node .wa/bin/wa.mjs create ../acme-app --yes --kit .
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.