> ## Documentation Index
> Fetch the complete documentation index at: https://fit4lifecare.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Deployment, Twilio & A2P

> How Fit4Life OS ships: Vercel auto-deploy from master, the commit-author gotcha that blocks deploys, schema migrations, the Mintlify docs site (hosted at fit4lifecare.com/docs) and its AI endpoints, and the Twilio A2P 10DLC + Messaging Service wiring.

## Deployment

The repo is the **private** GitHub repo `orenbenbrith/fit4lyfe-os` (must stay private, it commits `real-data.ts`, the PII seed). Vercel auto-deploys:

* **Push to `master` → production build + deploy** (build \~1–3 min). `vercel --prod` (CLI) still works as a manual deploy.
* Pushes to other branches create preview deploys.
* Aliased to `fit4lifecare.com` and `fit4lyfe-nine.vercel.app`.

<Warning>
  **Commit-author gotcha.** On Vercel's Hobby plan, only commits whose author email is connected to the `orenbenbrith` account deploy. Commits **must** be authored as `66269401+orenbenbrith@users.noreply.github.com` (already this repo's `git config user.email`). Any other email gets "Deployment was blocked."
</Warning>

## Documentation site (Mintlify)

This docs site is built with Mintlify from `docs/` on `master` and is GitHub-connected: any push to `master` that changes a file under `docs/` auto-republishes it. The app's Vercel build is **skipped** for docs-only commits via the repo-root `vercel.json` `ignoreCommand`, so docs and app deploy independently from one repo.

It is served at a **subpath on the customer domain**, with "Host at `/docs`" enabled in the Mintlify dashboard and a host-scoped Vercel rewrite proxying the traffic:

* **Primary:** `https://fit4lifecare.com/docs` (the `vercel.json` rewrite proxies `/docs` and `/docs/*` to the Mintlify origin, scoped to the `fit4lifecare.com` host).
* **Origin:** `https://fit4life.mintlify.site/docs`.
* The `fit4lyfe-nine.vercel.app` domain does **not** expose `/docs` (the rewrite is host-scoped).

### AI / agent endpoints

Mintlify exposes machine-readable endpoints under the same `/docs` subpath:

| What                                        | Endpoint                                      |
| ------------------------------------------- | --------------------------------------------- |
| MCP server (live search + read of the docs) | `https://fit4lifecare.com/docs/mcp`           |
| llms.txt (page index)                       | `https://fit4lifecare.com/docs/llms.txt`      |
| llms-full.txt (entire docs as one file)     | `https://fit4lifecare.com/docs/llms-full.txt` |

Connect the MCP server in Claude Code:

```bash theme={null}
claude mcp add --transport http fit4life https://fit4lifecare.com/docs/mcp
```

<Note>
  Enabling "Host at `/docs`" moved these from the domain root under `/docs`. The old `fit4life.mintlify.site` **root** paths (e.g. `/llms.txt`) now 404, use the `/docs/...` paths above.
</Note>

## Schema migrations

If a change adds schema, run the additive migration **first**: `POST /api/admin/db-setup` (idempotent, `IF NOT EXISTS`). No separate DDL tooling. See [Admin Runbooks](/docs/architecture/runbooks) for the full procedure and the `?examplesOnly=1` caveat.

## Twilio + A2P 10DLC

The SMS bot sends through an **A2P 10DLC Messaging Service** (carrier-vetted; approved).

| Resource              | Value                                              |
| --------------------- | -------------------------------------------------- |
| Bot number            | **+1 305-570-4986**                                |
| Messaging Service SID | `MG241544cd4927ac3444619281df96e9fb`               |
| Inbound webhook       | `https://fit4lyfe-nine.vercel.app/api/sms/webhook` |

<Note>
  Set `TWILIO_MESSAGING_SERVICE_SID` in Vercel Production so outbound application-initiated SMS routes through the service. A2P traffic sent from the bare `from` number can be rejected. The var is load-bearing for delivery; remove it and outbound falls back to the bare number.
</Note>

<Warning>
  **Inbound-webhook gotcha.** When a number is in a Messaging Service, the **service** controls inbound, the number's own `sms_url` is ignored. The service must have `UseInboundWebhookOnNumber = true` (set via `POST messaging.twilio.com/v1/Services/MG…`) or inbound is received and routed nowhere, with no error. If inbound ever goes silent, check this flag first.
</Warning>

<Warning>
  **Do not re-add the `twilio` MCP server.** Its auto-generated `List*` tools name range params with `<`/`>` (e.g. `DateSent<`), which are illegal in Anthropic's tool-property-key pattern and hard-freeze every session with an API 400. The app does **not** depend on it, all Twilio usage is the `twilio` npm SDK. For Twilio ops in a session, use the REST API via `curl` with the `.env.local` creds.
</Warning>

## Credential rotation

Neon DB credentials are integration-managed in Vercel: **Settings → Environments → Production → ⋯ on a Neon var → Rotate Integration Secrets**, confirm with the project name, then **redeploy**. This rotates all Neon vars together (they share one credential) and leaves non-Neon secrets untouched. After rotating, refresh `.env.local` from Neon's "Connect" dialog for local dev + the mirror.
