# Layers and Templates (/docs/concepts/layers)



A **Layer template** is a versioned definition of a capability — its commands,
its default configuration, the schema your project config must satisfy, and
the workflows it can trigger. A **project layer** is an instantiated template
attached to one of your projects with concrete config.

The pattern: a template is the recipe, a project layer is the meal.

## Available templates [#available-templates]

A subset of the templates available today:

| Template                        | What it does                                                                |
| ------------------------------- | --------------------------------------------------------------------------- |
| **Social Content**              | Generates posts (image/carousel/video) from a brand brief.                  |
| **Social Distribution**         | Schedules and publishes content to Instagram, TikTok, YouTube, X, LinkedIn. |
| **Managed Social Distribution** | Higher-touch distribution with managed-service inputs.                      |
| **Social Engagement**           | AI-driven comment replies and engagement.                                   |
| **Meta Ads Manager**            | Launches and optimizes Facebook + Instagram ad campaigns.                   |
| **TikTok Ad Manager**           | Launches and optimizes TikTok ad campaigns.                                 |
| **Apple Ads Manager**           | Manages Apple Search Ads campaigns and keywords.                            |
| **UGC Creator Management**      | Discovery, briefing, and tracking of UGC creators.                          |
| **Managed UGC (SideShift)**     | End-to-end managed UGC program.                                             |
| **App Machina**                 | AI-driven mobile app scaffolding and modification.                          |
| **RevenueCat**                  | RevenueCat metrics ingestion.                                               |
| **Stripe**                      | Stripe metrics ingestion.                                                   |
| **Elle Daily Digest**           | AI-curated daily email digest.                                              |
| **ASO**                         | App Store Optimization.                                                     |
| **Landing Page**                | Landing-page generation and management.                                     |

See [Layers overview](/docs/layers/overview) for the full list.

## Anatomy of a Layer [#anatomy-of-a-layer]

```
template
├─ id, name, version
├─ default_config        ← seeds project layer config on install
├─ config_schema         ← JSON Schema project config must validate against
└─ commands              ← map of commandId → { trigger, workflow, ... }
   ├─ initialize         ← runs once on install (internal; not externally callable)
   ├─ executable commands← triggered by POST /api/project-layers/:id/execute
   └─ scheduled commands ← cron-driven, picked up by the scheduler
```

When you install a template into a project, Layers:

1. Creates a new project layer bound to the template.
2. Seeds its config from the template's default config.
3. Runs the `initialize` command internally.
4. Scheduled commands then fire on their configured crons (or the per-layer
   override, if set).

## Configuration [#configuration]

Each project layer has a `config` JSON document, validated by the template's
`config_schema`. You can edit it from the layer's settings page in the UI, or
programmatically via the API. Common patterns:

* **Per-layer cron override** — set `config.schedule.cron = "37 9 * * *"` to
  override the template's default cron for this project only.
* **Distribution mode** (Social Distribution) —
  `config.distributionMode = "automatic" | "custom" | "manual"` and
  `config.willPublish = true | false`.
* **CAPI** — `config.capi = { enabled, pixel_id, access_token_vault_id }`.

## Commands [#commands]

Commands are the verbs of a layer. They map to workflows. You can:

* Trigger executable commands via the **Run** button on the layer settings page,
  or via the API (`POST /api/project-layers/:id/execute` with `{ commandId }`).
* Scheduled commands fire automatically on the configured cron.

Common commands:

| Pattern              | Meaning                                                               |
| -------------------- | --------------------------------------------------------------------- |
| `initialize`         | One-time setup when the layer is installed (internal).                |
| `refresh-schedule`   | (Social Distribution) Recompute upcoming distribution slots.          |
| `attach-to-schedule` | (Social Distribution) Atomically claim a content slot.                |
| `process-due`        | (Social Distribution) Publish posts whose scheduled time has arrived. |
| `content-refresh`    | (Ad Managers) Disable underperformers and refresh adset creatives.    |
| `ad-optimize`        | (Ad Managers) Optimizer pipeline.                                     |

See the [layer detail page](/docs/layers/detail) for how to invoke commands.

## Versioning [#versioning]

Templates are immutable per version. A new version of a template never silently
changes behavior of installed project layers — they remain pinned to the
version they were installed against. To upgrade, install the new version
side-by-side, copy config, and uninstall the old one.

The version your project uses is shown on the layer's detail page.
