> For the complete documentation index, see [llms.txt](https://docs.madrix.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.madrix.dev/hands-on-tutorials/3.-deployment-and-cloud-environments.md).

# 3. Deployment and Cloud Environments

### Prerequisites

* Your project already runs on **Preview**.
* You have permission to **purchase/provision** environments (billing).
* (Optional) You have access to **DNS** of the domain, if using a custom domain.

{% hint style="info" %}
**Dev** to test quickly. **Staging** to validate release. **Prod** for end users.
{% endhint %}

{% stepper %}
{% step %}

### Open Cloud Environments

* [ ] Go to **Project Settings → Cloud Environments**
  {% endstep %}

{% step %}

### Create the environment

* [ ] Click **Purchase Environment**
* [ ] Set the **name** of the environment (e.g.: `dev-myapp`, `staging-myapp`, `prod-myapp`)

{% hint style="info" %}
Choose a name that makes the environment type obvious. Prevents deploying to the wrong place.
{% endhint %}
{% endstep %}

{% step %}

### Configure domain and scaling

* [ ] (Optional) Configure a **domain** (if you want a custom URL)
* [ ] Configure the **scaling**

{% hint style="info" %}
Start smaller. Increase later if there is slowness, timeouts, or real load.
{% endhint %}
{% endstep %}

{% step %}

### Provision and wait until Ready

* [ ] Proceed with provisioning
* [ ] Wait for the status to become **Ready**

<details>

<summary>Expected time</summary>

Usually takes a few minutes. If it stays stuck for a long time, follow the "If it fails" section.

</details>
{% endstep %}

{% step %}

### Publish (deploy)

* [ ] Click **Publish** and deploy your project to this environment

{% hint style="info" %}
Avoid "deploy spam." If needed, wait a few minutes and try again.
{% endhint %}
{% endstep %}

{% step %}

### Validate the deploy

* [ ] Open the **URL** of the domain
* [ ] Confirm that the home page loads
* [ ] Log in and validate a critical flow (e.g.: create/edit a record)
  {% endstep %}
  {% endstepper %}

### If it fails

* **Deploy fails with error:** follow [Deployment issues](/troubleshooting/deploy-issues.md).
* **Environment “Ready”, but the URL doesn't open:** if using a custom domain, review DNS and wait for propagation.
* **Deploy completes, but the app doesn't start:** treat as a **runtime** and follow the diagnosis in the troubleshooting.


---

# 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, and the optional `goal` query parameter:

```
GET https://docs.madrix.dev/hands-on-tutorials/3.-deployment-and-cloud-environments.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
