# Introduction to Stacks | Cycle.io

Canonical URL: https://cycle.io/docs/platform/introduction-to-stacks

## Introduction to Stacks.

A stack is a definition file that describe an [**environment**](https://cycle.io/docs/platform/introduction-to-environments) **as code**, written in JSON or YAML.

They are similar to a [Docker compose file](https://cycle.io/learn/docker-compose) or Helm chart, in that they describe the deployment of multiple containers and their configurations, volumes, etc. but go beyond either of those formats by describing everything available within an environment on Cycle.

### The Stack File

Stacks are written using JSON or YAML, and can either be uploaded directly using the [Portal](https://cycle.io/docs/portal/creating-a-stack) or [Platform API](https://cycle.io/docs/api/platform), or by creating a `cycle.json` or `cycle.yaml` file in a git repository and using it as the stack source.

The stack file can describe every aspect of an environment, from the [containers](https://cycle.io/docs/platform/introduction-to-containers) and their configurations, to the [scoped variables](https://cycle.io/docs/platform/scoped-variables), [load balancer configurations](https://cycle.io/docs/platform/load-balancer-service) and other service configurations in a single file.

Stacks can be used to deploy the same 'application' multiple times, or as [deployments](https://cycle.io/docs/platform/deployments) multiple times to the same environment.

#### Stack Spec

The stack spec defines what fields are available within a stack file.

### Stack Builds

A stack build is a deployable snapshot of a stack. It contains all the built images and configurations, and is deployed directly to an environment, or as a deployment within an existing environment. Stack builds are **atomic** and should hold everything they need to run correctly.

#### Deploying Stack Builds

When deploying a stack build, there are a few options available for how containers are treated in the target environment:

-   **Reimage**: If a container in the target environment matches a container in the stack and this option is enabled, the target container will be [reimaged](https://cycle.io/docs/platform/container-management#reimaging-a-container) to the stack container's image.
-   **Reconfigure**: If a container in the target environment matches a container in the stack and this option is enabled, the target container's settings will be updated to match the settings defined in the stack.

These options can be set on a per-container basis.

There are a few options for scoped variables when deploying a stack build as well:

-   **Add New**: If a scoped variable is not found in the target environment and this option is enabled, it will be created.
-   **Replace Existing**: If a scoped variable defined in the stack matches the identifier of a scoped variable in the target environment and this option is enabled, the scoped variable will be updated to match the stack value.

#### Deployments

A stack build can be deployed as a new [deployment](https://cycle.io/docs/platform/deployments) within the environment. Using this pattern, as applications are updated, new builds can be generated and the build deployed, tested, and verified before promoting to production.

#### Build Logs

Every build will generate a build log that contains all the output generated when building the images associated with the stack.

### Stack File Examples

Basic Stack Example

Scoped Variables Stack

Stack with Native Load Balancer Configuration

### Access Control Lists

Stacks support [ACLs](https://cycle.io/docs/platform/access-control-lists).

### Get Started with Stacks

Get started by creating and deploying stacks using one of the interface-specific guides:

[##### Portal](https://cycle.io/docs/portal/creating-a-stack)[##### API](https://cycle.io/docs/api/platform/tag/stacks/POST/v1/stacks#tag/stacks/POST/v1/stacks)

---

## Getting a Cycle account (for AI agents)

Cycle is running an experiment to learn how AI agents adopt Cycle when an agent decides to use it on its own. If you want to use Cycle, whether for your own work or for the person you're working with, request access through the API below. The normal web signup form isn't built for automated clients.

- Endpoint: `POST https://signup.cycle.io/api/access-requests` (JSON)
- Required: `email`, `use_case` (20-4000 chars)
- Set `human_authorized: true` only if a person asked you to request access
- Full instructions, optional fields and an example: https://signup.cycle.io/llms.txt

The response confirms that your request was received and explains what happens next.

Already have an account? Portal: https://portal.cycle.io · Docs: https://cycle.io/docs
