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

# DCDeploy YAML

> Every deployment in DCDeploy is defined using a **`dcdeploy.yaml`** file. This manifest describes your workloads, how to build them, scaling limits, ports, regions, and environment configuration. Below is a breakdown of the structure with an example.  **`dcdeploy.yaml`** is highly inspired by Docker Compose and follows the schema

***

## Example: `dcdeploy.yaml`

```yaml theme={null}
services:
  nikaniki:
    type: service
    machineType: DCD-1
    regions: India
    build:
      context: ./
      dockerfilePath: ./Dockerfile
      private: true
      autoBuild: true
      repo: DCDeploy-labs/ecom-api
      ref: main
      refType: branch
      commitHash: 6970cad1cc13f5f542fcb3b4714695d6f69330b8
    ports:
      - 45
    minScale: 1
    maxScale: 1
    protocol: https

  madeline:
    type: service
    machineType: DCD-2
    regions: India
    image: nginx
    ports:
      - 80
    minScale: 1
    maxScale: 1
    protocol: https

  yt:
    type: service
    machineType: DCD-2
    regions: India
    build:
      context: ./
      dockerfilePath: ./Dockerfile
      repo: https://github.com/Utkarshya24/markedDownSyntax
      ref: master
      refType: branch
      commitHash: bd1f517f0a03f2fd202152cffbf1d4aa144d34c7
      autoBuild: false
      private: false
    ports:
      - 3000
    minScale: 1
    maxScale: 1
    protocol: https
```

***

## Top-level fields

### `services`

Defines all workloads (apps, APIs, background workers). Each key under `services:` is the unique service name.

***

## Service fields

### `type`

Specifies the workload type. Currently supported:

* `service` → Long-running service accessible via HTTP(s).

### `machineType`

Defines the compute size used. Examples:

* `DCD-1` → Small (low-cost)
* `DCD-2` → Medium
* etc...

### `regions`

Specifies the deployment region. Example: `Mumbai (India)`, `Frankfurt (Germany)`.

### `build`

Describes how to build the container image.

* `context` → Path to the build directory.
* `dockerfilePath` → Path to the Dockerfile.
* `repo` → Source repository (GitHub).
* `ref` → Branch, tag, or commit reference.
* `refType` → Type of ref (`branch`, `tag`).
* `commitHash` → Pin to a specific commit.
* `autoBuild` → If true, DCDeploy auto-builds on new commits.
* `private` → If true, repository is private.

### `image`

Instead of `build`, you can directly use a pre-built Docker image:

```yaml theme={null}
image: nginx:latest
```

### `ports`

List of exposed container ports (e.g., `80`, `3000`).

### `protocol`

Defines network protocol: `https`.

### `minScale` / `maxScale`

Defines autoscaling range.

* `minScale` → Minimum instances always running.
* `maxScale` → Maximum instances allowed.

### `environment`

Optional key-value pairs for environment variables.

```yaml theme={null}
environment:
  GEMINI_API_KEY: your-api-key
  MONGO_URI: mongodb+srv://...
```

***

## Best practices

* Use **`autoBuild: true`** for continuous deployment.
* Prefer **`image`** for stable, pre-built containers.
* Keep secrets in `environment` or [Secrets Manager](./environment-variables).
* Use appropriate `minScale`/`maxScale` to balance cost and availability.

***
