---
id: w1/m24/t001
title: bex.yml schema — services list + databases; render.yaml vocabulary; legacy files unchanged
worker: worker1
status: todo
estimate: 35m
depends_on: []
---

## Objective

Grow `bex.yml` from one service to a stack: a `services:` list (each entry the existing single-service shape, including `type` worker/cron, `rootDir`, env) and a `databases:` list (name/plan mapping to the `Database` CR vocabulary, docs/ADR009-postgresql-management.md). Field names follow render.yaml's Blueprint spec — verify against the current spec and classify every field honored / omitted-documented (envVarGroups→m16's groups if trivially mappable, previews, sync-delete, `fromService` → t002's call). Single-service legacy files parse byte-identically.

## Context

- Current parser: the `bex.yml` → `CreateRequest` mapper in `lego/backend/internal/apps/deploy.go` (mirrors `scripts/app-apply.sh`); duplicate-name validation within the file.
- render.yaml top-level keys are `services:`/`databases:`/`envVarGroups:` — bex.yml should keep that shape.

## Steps

1. Multi-doc/stack parse + per-entry validation (names unique, types valid, plans in the tiers catalog).
2. Field classification table into docs/ADR006-bex-api.md's bex.yml section.
3. Typed result: ordered resource set for t003.

## Files

- `lego/backend/internal/apps/deploy.go`
- `docs/ADR006-bex-api.md`

## Acceptance criteria

- [ ] Multi-service file parses into N validated service requests + M database specs; a legacy single-service file still parses identically; every render.yaml field classified.

## Out of scope

- fromDatabase resolution (t002); applying (t003).
