# Stack

URL: https://briq.cloud/docs/concepts/stack

> A named group of briqs that can talk to each other.

A **stack** groups briqs inside a team. Briqs in a stack find each other by name, which is how a
multi-briq recipe (Redis and its dashboard, an app and its database) wires itself up.

## Using one

`briq_run` uses the stack `default` unless you pass `stack`, and creates the stack on first use:

```text
briq_run({ recipe: "postgres", stack: "checkout" })
briq_run({ recipe: "redis", stack: "checkout" })
briq_run({ image: "ghcr.io/acme/checkout-api:pr-412", stack: "checkout", ports: [3000],
           env: { REDIS_HOST: "{{briq:redis}}" } })
```

## Reaching another briq

* **Recipe outputs** already carry the right address: pass `DATABASE_URL` to another briq as is.
* **`{{briq:<name>}}`** in an `env` value becomes the address of the briq with that name in the
  same stack. The briq waits for it to be running before it starts. It works in plain values, not
  inside a secret's `value`: put the address in a plain variable and the password in a secret.

These addresses only resolve inside the team's network. From outside, use `briq_exec`, or
`briq_expose` an HTTP port.

## Isolation

The tenant boundary is the **team**: one private network per team, never shared with another
customer. A stack is not a security boundary: any briq can reach any other briq of the same team.
