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

# Deployment

> How Moveat is deployed across Vercel, DigitalOcean, Mintlify and the production Docker stack.

# Deployment

Moveat is deployed across three hosting surfaces:

| Surface       | Platform             | What runs there                                                             |
| ------------- | -------------------- | --------------------------------------------------------------------------- |
| Frontend      | Vercel               | Web client and frontend previews.                                           |
| Backend stack | DigitalOcean droplet | Platform, Agent, PostgreSQL, Redis, Caddy, Grafana, Loki, Alloy and Komodo. |
| Documentation | Mintlify             | Product, technical and operations docs at `docs.mov-eat.app`.               |

This split keeps the frontend deploy loop fast while keeping backend services close to PostgreSQL and Redis.

## Production stack

The backend production stack is defined in the `infra` repository through Docker Compose.

Core services:

* Caddy for HTTPS and reverse proxy.
* Platform for business APIs.
* Agent for WhatsApp and LLM orchestration.
* PostgreSQL for product data.
* Redis for short-lived state and cache.
* Grafana for dashboards.
* Loki for logs.
* Alloy for log collection.
* Komodo for container management.

## Domains

| Domain                 | Service       | Hosting path                |
| ---------------------- | ------------- | --------------------------- |
| `api.mov-eat.app`      | Platform      | DigitalOcean through Caddy. |
| `agent.mov-eat.app`    | Agent         | DigitalOcean through Caddy. |
| `<grafana-domain>`     | Grafana       | DigitalOcean through Caddy. |
| `<ops-console-domain>` | Komodo        | DigitalOcean through Caddy. |
| `docs.mov-eat.app`     | Documentation | Mintlify.                   |

## Vercel deployment

Vercel is responsible for frontend delivery. Frontend deployments should not require rebuilding the backend stack.

Typical Vercel responsibilities:

* Preview deployments for pull requests.
* Production deploys for the web client.
* Frontend environment variables such as API base URL and Google client ID.
* CDN delivery and frontend routing.

When frontend auth does not work, check browser cookie behavior, CORS settings, `credentials: "include"`, and whether the API origin is included in Platform `ALLOWED_ORIGINS`.

## DigitalOcean deployment

The droplet hosts the production backend stack. A typical backend deploy updates one or more repositories and recreates the affected containers.

Recommended Platform deploy order:

1. Pull latest `platform` and `infra` changes.
2. Run Platform migrations.
3. Rebuild the Platform image.
4. Recreate the Platform container.
5. Check Platform health.
6. Inspect Grafana/Loki for startup errors.

Recommended Agent deploy order:

1. Pull latest `agent` and `infra` changes.
2. Confirm required environment variables are present.
3. Rebuild the Agent image.
4. Recreate the Agent container.
5. Check Agent health and webhook behavior.
6. Send a controlled test message if webhook changes were deployed.

## Migrations

Platform database migrations must run before relying on code that expects new schema changes.

A migration mismatch can create a production boot failure or runtime errors when a new service version queries columns that do not exist yet.

Recommended rule:

<Warning>
  Do not deploy Platform code that depends on a Prisma migration unless the migration has already been applied to the production database.
</Warning>

## Documentation deployment

Mintlify reads the docs repository and deploys automatically when commits land on the configured branch.

If the docs site does not update:

1. Confirm Mintlify is connected to the correct GitHub organization and repository.
2. Confirm the branch is `main`.
3. Confirm `docs.json` is at the repository root unless a subdirectory is explicitly configured.
4. Check Mintlify deployment activity.
5. Trigger a manual redeploy.

## Rollback principle

Rollback should consider both code and database compatibility.

Frontend rollback is usually simple through Vercel. Backend rollback is more sensitive because Platform owns schema and durable data. If a migration is not backward compatible, rolling code back may not be enough.
