# Backend Greenfield Bootstrap

The single-process CRM bootstrap and server runbook is retired. Serving now
uses the app-blind Runtime API, Runtime Workers, Integration, and the separately
released L1 AppService. Metadata installation alone does not start that topology.

## L0 substrate and endpoint

Use the checked-in [standalone L0 deployment guide](../../../infra/runtime/README.md)
for database profiles, substrate initialization, TLS bootstrap, and activation.
Its commands are owned by `infra/runtime/deploy.py`. From the repository root,
a clean local substrate can be initialized with the selected Runtime API image:

```bash
python3 infra/runtime/deploy.py init \
  --database-mode local \
  --database-env-file /secure/path/database.local.env \
  --controlplane-env-file /secure/path/controlplane.env \
  --runtime-api-image "$RUNTIME_API_IMAGE"
```

Select an immutable image and fill the environment files using the examples in
`infra/runtime/`. TLS bootstrap is deliberately unready for business operations;
activation requires the Catalog and workload configuration described by that guide.

## Application composition

Select the L1 AppRelease, AppService image, frontend, and optional L2 metadata
independently of the L0 Engine. Use the target delivery repository's checked-in
serviceified deployment runbook to initialize metadata, publish Catalog, prepare
workload identities and grants, and activate serving processes. Keep environment
credentials and tenant payload in that delivery repository. A public greenfield
composition must satisfy the [public bootstrap contract](public-greenfield-bootstrap-contract.md)
without depending on tenant-specific metadata.

For source development, the retained `backend/cmd/setup` and
`backend/distributions/cmd/setup` tools provide platform and CRM metadata
operations. They are not serving entrypoints. Runtime image and process contracts
live in `infra/runtime/`; the public Salesforce HTTP routes belong to the
[SFCRM AppService](https://github.com/pingcap-inc/nexuscrm-app-packs/tree/main/appservices/sfcrm).

Verify the running composition using its deployment readiness checks, then point
the [REST contract tests](../../../tests/contract/rest_api/README.md) at its public
ingress. A live L0 TLS endpoint alone is not successful CRM bootstrap evidence.
