> ## Documentation Index
> Fetch the complete documentation index at: https://domoinc-openapi-sync-dataflows.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Domo Apps Generator

[![npm version](https://img.shields.io/npm/v/@domoinc/da.svg)](https://www.npmjs.com/package/@domoinc/da)
[![TypeScript](https://img.shields.io/badge/TypeScript-Ready-blue.svg)](https://www.typescriptlang.org/)

The DA CLI (Domo Apps CLI) is a powerful command-line tool for generating and managing Domo applications built with Vite and React. It provides a streamlined workflow for creating new apps, generating components, managing manifests, and more.

## Overview

The DA CLI (Domo Apps CLI) streamlines Domo app development with four main capabilities:

* **App Creation** - Generate new Domo apps from templates
* **Code Generation** - Create components, reducers, and other code structures
* **Manifest Management** - Handle environment-specific configurations
* **Template System** - Support for custom templates from NPM, GitHub, or local paths

## Installation

Install the DA CLI (Domo Apps CLI) globally to use it from anywhere:

```bash theme={"dark"}
# Using pnpm (recommended)
pnpm add -g @domoinc/da

# Using npm
npm install -g @domoinc/da

# Using yarn
yarn global add @domoinc/da
```

**Package**: [@domoinc/da on npm](https://www.npmjs.com/package/@domoinc/da)

Verify your installation:

```bash theme={"dark"}
da --version
```

## Quick Start

Create your first Domo app in seconds:

```bash theme={"dark"}
da new my-awesome-app
cd my-awesome-app
pnpm start
```

## Commands

### da new

Creates a new Domo application from a template.

**Syntax:**

```bash theme={"dark"}
da new <name> [options]
```

**Arguments:**

* `name` - The name of your application (required)

**Options:**

* `--force, -f` - Overwrite existing directory
* `--template, -t` - Specify a custom template (npm package, GitHub repo, or local path)

**Examples:**

```bash theme={"dark"}
# Create a new app
da new my-domo-app

# Create with force overwrite
da new my-domo-app --force

# Use a custom template
da new my-app --template @myorg/custom-template
da new my-app --template github.com/user/repo
da new my-app --template ./local-template
```

**What happens:**

1. Validates the app name
2. Checks for existing directory
3. Prompts for package manager selection
4. Downloads/clones the [@domoinc/vite-react-template](https://www.npmjs.com/package/@domoinc/vite-react-template) (or custom template)
5. Updates package.json with your app name
6. Initializes git repository
7. Installs dependencies

### da generate

Generates code files from templates.

**Syntax:**

```bash theme={"dark"}
da generate [template] [name]
```

**Available Templates:**

#### Component Generator

Creates a complete React component with associated files.

```bash theme={"dark"}
da generate component MyComponent
# or
da g component MyComponent
```

**Creates:**

* `src/components/MyComponent/MyComponent.tsx` - Main component file
* `src/components/MyComponent/MyComponent.module.scss` - Styles
* `src/components/MyComponent/MyComponent.test.tsx` - Test file (optional)
* `src/components/MyComponent/MyComponent.stories.tsx` - Storybook file (optional)

#### Reducer Generator

Creates a Redux slice with automatic imports.

```bash theme={"dark"}
da generate reducer myFeature
# or
da g reducer myFeature
```

**Creates:**

* `src/reducers/myFeature/slice.ts` - Redux slice
* Auto-imports into `src/reducers/index.ts`

### da manifest

Add a manifest override for additional deployment/proxy environments. If you need to deploy to multiple instances, or proxy to different cards for various testing environments, you can use this command to add a manifest override.

**Syntax:**

```bash theme={"dark"}
da manifest [identifier] [description]
```

**Arguments:**

* `identifier` - Key for the manifest override (e.g., `instance.prod`, `instance.dev`)
* `description` - Description of the override

**Examples:**

```bash theme={"dark"}
# Create a production override
da manifest instance.prod "Production environment for instance.domo.com"

# Create a development override
da manifest instance.dev "Development environment for dev.domo.com"
```

Minimal override example (what you might store and apply):

```json theme={"dark"}
{
  "<override-name>": {
    "description": "description of the override",
    "manifest": {
      "id": "asset-id",
      "proxyId": "proxy-id"
    }
  }
}
```

### da apply-manifest

Applies manifest overrides to your application. This will substitute properties from manifestOverride into your manifest.json file. Useful for deploying to multiple instances, or proxying to different cards for various testing environments.

**Syntax:**

```bash theme={"dark"}
da apply-manifest [id]
```

**Arguments:**

* `id` - The identifier of the override to apply

**Examples:**

```bash theme={"dark"}
# Apply specific override
da apply-manifest instance.prod

# Interactive selection
da apply-manifest
```

## Templates

### Default Template

The DA CLI uses the [@domoinc/vite-react-template](https://www.npmjs.com/package/@domoinc/vite-react-template) by default, which includes:

* **Vite** for fast development and building
* **React 18** with TypeScript support
* **SCSS** for styling
* **Jest** and **Testing Library** for testing
* **Storybook** for component development
* **ESLint** and **Prettier** for code quality
* **Domo Toolkit** integration

### Custom Templates

You can use custom templates in several ways:

#### NPM Package

```bash theme={"dark"}
da new my-app --template @myorg/custom-template
```

#### GitHub Repository

```bash theme={"dark"}
da new my-app --template github.com/user/repo
da new my-app --template user/repo/subdirectory
```

#### Local Path

```bash theme={"dark"}
da new my-app --template ./local-template
da new my-app --template ~/templates/my-template
```

### Template Structure

Templates should follow this structure:

```text theme={"dark"}
template/
├── package.json
├── src/
├── public/
├── gitignore
└── ... (other files)
```

## Configuration

### Environment Variables

For local development, you can set a default template path:

```bash theme={"dark"}
# Create .env file
echo "DA_TEMPLATE_PATH=~/my-templates/custom-template" > .env
```

### Package Manager

The CLI supports multiple package managers:

* **pnpm** (recommended) - Fastest and most efficient
* **npm** - Standard Node.js package manager
* **yarn** - Alternative package manager

## Troubleshooting

### Debug Mode

Enable verbose logging for troubleshooting:

```bash theme={"dark"}
# Set debug environment variable
DEBUG=da:* da new my-app
```

## Support

For issues and questions:

* **GitHub Issues**: [Create an issue](https://github.com/DomoApps/da/issues)
* **NPM**: [@domoinc/da on npm](https://www.npmjs.com/package/@domoinc/da)
