> For the complete documentation index, see [llms.txt](https://docs.baas.sh/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.baas.sh/baas-cli/advanced/deployment.md).

# Advanced deployment

The default [`baas deploy`](/baas-cli/deploy.md) flow uses a relayer (no private key). When you need full control (your own RPC endpoint and private key, or a Foundry deployment script), use one of these passthrough commands. Both register the deployed contract(s) with BaaS afterwards.

## `baas deploy create`

Deploys a single contract with `forge create`, exposing all of its flags.

```bash
baas deploy create src/Token.sol:MyToken \
  --rpc-url $RPC_URL \
  --private-key $PRIVATE_KEY \
  --constructor-args "My Token" "MTK" 18
```

All `forge create` flags are supported (`--verify`, `--gas-limit`, `--evm-version`, …). A few flags are added for you:

* `--broadcast` — added if absent (so the deployment actually happens).
* `--json` — added if absent (stable machine-readable output).
* `--gas-price 0 --priority-gas-price 0` — added when deploying to the BaaS network.

{% hint style="warning" %}
Put `--constructor-args` **last**, because `forge` consumes every argument after it as a constructor value.
{% endhint %}

## `baas deploy script`

Runs a Foundry deployment script and registers **all** the contracts it creates with BaaS.

```bash
baas deploy script script/Deploy.s.sol \
  --rpc-url $RPC_URL \
  --private-key $PRIVATE_KEY
```

`--broadcast` is added if absent (and `--with-gas-price 0 --priority-gas-price 0` on the BaaS network).

{% hint style="warning" %}
With these commands, **you** manage the private key, unlike the relayer flow. Pass it from an environment variable (`--private-key $PRIVATE_KEY`), never hard-code it, and never commit it. See [Configuration](/baas-cli/reference/configuration.md#environment-variables).
{% endhint %}

## Next

* [Deploy a contract](/baas-cli/deploy.md) — the default relayer flow (no private key).
* [Configuration](/baas-cli/reference/configuration.md) — credentials and environment variables.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.baas.sh/baas-cli/advanced/deployment.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
