npm package: @fnd-platform/cli
Description: CLI tool for fnd-platform monorepo scaffolding
Latest version: 1.0.0-alpha.39

# @fnd-platform/cli

Command-line interface for fnd-platform projects.

## Installation

```bash
# Global installation (recommended)
pnpm add -g @fnd-platform/cli

# Or use npx
npx @fnd-platform/cli <command>
```

## Commands

### `fnd new <name>`

Create a new fnd-platform monorepo project.

```bash
fnd new my-app
```

**Arguments:**

| Argument | Description                                                                  |
| -------- | ---------------------------------------------------------------------------- |
| `name`   | Project name (lowercase alphanumeric with hyphens, must start with a letter) |

**Options:**

| Option                   | Default | Description                               |
| ------------------------ | ------- | ----------------------------------------- |
| `--package-manager <pm>` | `pnpm`  | Package manager to use (`pnpm` or `yarn`) |
| `--no-git`               | -       | Skip git repository initialization        |
| `--no-install`           | -       | Skip dependency installation              |

**Examples:**

```bash
# Create a new project with defaults
fnd new my-saas-app

# Create without installing dependencies
fnd new my-app --no-install

# Create with yarn instead of pnpm
fnd new my-app --package-manager yarn

# Create without git initialization
fnd new my-app --no-git
```

### `fnd synth`

Synthesize project configuration using Projen. Run this after modifying `.projenrc.ts` to regenerate configuration files.

```bash
fnd synth
```

**Options:**

| Option    | Description                                               |
| --------- | --------------------------------------------------------- |
| `--watch` | Watch for changes and re-synthesize (not yet implemented) |

### `fnd build`

Build all packages using NX.

```bash
fnd build
```

**Options:**

| Option             | Description                   |
| ------------------ | ----------------------------- |
| `--skip-cache`     | Skip NX cache (force rebuild) |
| `--parallel <n>`   | Number of parallel tasks      |
| `--package <name>` | Build specific package only   |

**Examples:**

```bash
# Build all packages
fnd build

# Build without cache
fnd build --skip-cache

# Build with limited parallelism
fnd build --parallel 2

# Build specific package
fnd build --package api
```

### `fnd add <type>`

Add a package to an existing project. Modifies `.projenrc.ts` with the new package configuration.

**Subcommands:**

#### `fnd add api`

Add a Lambda API package.

```bash
fnd add api --name=api
```

| Option            | Default           | Description                      |
| ----------------- | ----------------- | -------------------------------- |
| `--name <name>`   | **required**      | Package name                     |
| `--outdir <path>` | `packages/<name>` | Output directory                 |
| `--no-dynamodb`   | -                 | Disable DynamoDB integration     |
| `--no-cognito`    | -                 | Disable Cognito auth integration |

#### `fnd add frontend`

Add a Remix frontend package (requires API package).

```bash
fnd add frontend --name=frontend --api=api
```

| Option            | Default           | Description                        |
| ----------------- | ----------------- | ---------------------------------- |
| `--name <name>`   | **required**      | Package name                       |
| `--api <api>`     | **required**      | API package name to link           |
| `--outdir <path>` | `packages/<name>` | Output directory                   |
| `--no-auth`       | -                 | Disable authentication integration |
| `--port <port>`   | `3000`            | Development server port            |
| `--theme <theme>` | `zinc`            | shadcn/ui theme color              |

#### `fnd add cms`

Add a CMS admin package (requires API package).

```bash
fnd add cms --name=cms --api=api
```

| Option                        | Default           | Description                        |
| ----------------------------- | ----------------- | ---------------------------------- |
| `--name <name>`               | **required**      | Package name                       |
| `--api <api>`                 | **required**      | API package name to link           |
| `--outdir <path>`             | `packages/<name>` | Output directory                   |
| `--port <port>`               | `3001`            | Development server port            |
| `--no-media-upload`           | -                 | Disable media upload features      |
| `--rich-text-editor <editor>` | `tiptap`          | Rich text editor (tiptap\|lexical) |
| `--theme <theme>`             | `zinc`            | shadcn/ui theme color              |

#### `fnd add component-library`

Add a component library package with Storybook.

```bash
fnd add component-library --name=ui
```

| Option            | Default           | Description               |
| ----------------- | ----------------- | ------------------------- |
| `--name <name>`   | **required**      | Package name              |
| `--outdir <path>` | `packages/<name>` | Output directory          |
| `--port <port>`   | `6006`            | Storybook dev server port |

## Quick Start

```bash
# Create a new project
fnd new my-saas-app

# Navigate to project
cd my-saas-app

# Modify .projenrc.ts if needed, then regenerate
fnd synth

# Build all packages
fnd build

# Add packages to an existing project
fnd add api --name=api
fnd add frontend --name=frontend --api=api
fnd add cms --name=cms --api=api

# Deploy (coming in Phase 8)
# fnd deploy --stage=dev
```

## Project Name Requirements

Project names must:

- Start with a lowercase letter
- Contain only lowercase letters, numbers, and hyphens
- Match pattern: `/^[a-z][a-z0-9-]*$/`

Valid examples: `my-app`, `saas-platform`, `app123`

Invalid examples: `MyApp`, `123-app`, `my_app`

## Requirements

- Node.js 20+
- pnpm 8+ (or yarn)
- Git (optional, for repository initialization)

## API Reference

See the [full API documentation](../../docs/api/modules/cli_src.html) for detailed type definitions and examples.

## Related

- [@fnd-platform/core](../core/README.md) - Core Projen project classes
- [CLI Commands Reference](../../docs/api-reference/cli-commands.md) - Detailed command documentation

## License

MIT