> For the complete documentation index, see [llms.txt](https://docs.snapfix.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.snapfix.com/engineering-reference/infra.md).

# Infrastructure

{% hint style="info" %}
Draft, written by an agent and not yet checked by a person ([how to read these docs](https://docs.snapfix.com/how-to-read.md)). [Source on GitHub](https://github.com/snapfix/docs/blob/main/spec/infra.md).
{% endhint %}

Where Snapfix runs: the hosts each build calls, what each service does and how it reaches its server, the third parties and data stores behind them, and how releases and monitoring work. This is an overview. Endpoints are in the [API docs](https://docs.snapfix.com/engineering-reference/api.md), tables in the [database docs](https://docs.snapfix.com/engineering-reference/db.md), and what the product does in [product](https://docs.snapfix.com/product/product.md).

The hosts below are the ones the builds and config files name. No repo says which machine answers each name, and no repo maps hosts to AWS accounts or regions \[[ASK-259](https://github.com/snapfix/docs/blob/main/ASK.md#ask-259-which-hosts-run-each-service-in-production-and-how-many-instances)].

## Environments

Three environments, named the same way in every build. Dev builds use the test hosts.

| Environment | Web app build (`web_app_v2`)                        | iOS and Android                            | API hosts                | Chat database, Stripe mode, AI host                 |
| ----------- | --------------------------------------------------- | ------------------------------------------ | ------------------------ | --------------------------------------------------- |
| Production  | `web.snapfix.com`, configuration `production`       | iOS `ProductionUrl`; Android flavor `prod` | `z1` to `z4.snapfix.com` | `chat-live`, `prod`, `ai-agent.snapfix.com`         |
| Staging     | `staging.snapfix.com`, configuration `staging-live` | iOS `StagingUrl`; Android flavor `staging` | `y1` to `y4.s6eur.com`   | `chat-live`, `prod`, `ai-agent.snapfix.com`         |
| Test        | `{uuid}-test.snapfix.com`, configuration `staging`  | iOS `TestUrl`; Android flavor `qa`         | `b1` to `b4.s6eur.com`   | `chat-test`, `sandbox`, `ai-agent-test.snapfix.com` |

Sources: web\_app\_v2 @ 0989b8e685, `src/environments/environment.production.ts:2-18`, `environment.staging-live.ts`, `environment.staging.ts`, `angular.json:81-140`; ios @ aa31967ac8, `APIManagers/ApiEndpointManager.swift:11-15`, `:18-22`, `:25-29`; android @ 86068bfeea, `app/build.gradle:83-107`.

* **Host pattern.** `*1` is php-apis, `*2` apipy, `*3` authpy and `*4` the Laravel API. The table per service is in [Services and hosts](https://docs.snapfix.com/engineering-reference/api.md#services-and-hosts). `s6eur.com` is a second domain used next to `snapfix.com`; z1 to z3 answer the same on both \[[ASK-8](https://github.com/snapfix/docs/blob/main/ASK.md#ask-8-confirm-the-environments)].
* **Build names do not match.** The web configuration called `staging` builds the test environment, and `staging-live` builds staging. Their `envName` values are `production`, `staging` and `test`; `environment.ts` is `development` and uses the test hosts with `localhost:4200`.
* **Staging is not isolated from production.** The staging web build uses the production chat database, the production AI host and Stripe mode `prod` \[[ASK-8](https://github.com/snapfix/docs/blob/main/ASK.md#ask-8-confirm-the-environments)]. The Laravel setup guide says staging and live servers point at the same downstream services and database, as of 2024-07-05 (api\_php\_live\_v2 @ ef3c4319f6, `AUTOMATED_SETUP.md:17-22`) \[[ASK-279](https://github.com/snapfix/docs/blob/main/ASK.md#ask-279-does-staging-still-use-the-production-database-and-services)]. The staging database that these docs read is described in [the database docs](https://docs.snapfix.com/engineering-reference/db.md).
* **Development.** The same guide names `a4.s6eur.com` as a Laravel development server (`AUTOMATED_SETUP.md:17`); no app build points at it.
* **QA** is a site inside production, not an environment ([AGENTS.md](https://github.com/snapfix/docs/blob/main/AGENTS.md)).
* **Production also has** `api.snapfix.com`, the public API host, which is a separate server from `z4` \[[ASK-12](https://github.com/snapfix/docs/blob/main/ASK.md#ask-12-which-settings-do-the-production-api-servers-use)].

### Other web builds

| Repo                  | What it is                                                                                                              | Runs at                                                                                                                                                                                                | Production hosts in its environment file                                                                                                                                                                         | Staging file                                               |
| --------------------- | ----------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------- |
| `qr_forms`            | [QR form](https://docs.snapfix.com/how-the-apps-work/screens/qr/form.md)                                                | `qr.snapfix.com`, which runs a branch newer than `master` \[[ASK-226](https://github.com/snapfix/docs/blob/main/ASK.md#ask-226-should-master-and-syncyml-follow-the-branch-that-runs-on-qrsnapfixcom)] | `z1` to `z3.s6eur.com`, `z4.snapfix.com`; links to `web.snapfix.com`                                                                                                                                             | `b1` to `b4.s6eur.com`, the test web host                  |
| `web_payments`        | [Payment page](https://docs.snapfix.com/how-the-apps-work/screens/billing/payment-page.md)                              | `package.snapfix.com`                                                                                                                                                                                  | `z1` to `z3.s6eur.com`; links to `web.snapfix.com`                                                                                                                                                               | `b1` to `b3.s6eur.com`, the test web host                  |
| `web_onboarding_form` | [Setup form](https://docs.snapfix.com/how-the-apps-work/screens/onboarding/setup-form.md)                               | `setup.snapfix.com`                                                                                                                                                                                    | `z4.snapfix.com`                                                                                                                                                                                                 | `y4.s6eur.com`; development and default files use `b4`     |
| `web_tasks`           | [Shared task page](https://docs.snapfix.com/how-the-apps-work/screens/tasks/shared-task.md)                             | `task.snapfix.com`                                                                                                                                                                                     | `z2.s6eur.com`; links to `web.snapfix.com`                                                                                                                                                                       | `b2.s6eur.com`, the test web host                          |
| `webadmin_angular`    | [Staff admin app](https://docs.snapfix.com/how-the-apps-work/screens/staff.md)                                          | Not in any repo                                                                                                                                                                                        | `z1` to `z4.snapfix.com`; opens the package, QR and setup apps                                                                                                                                                   | `b1` to `b4.s6eur.com` and test copies of those three apps |
| `dynamic-link`        | [Deep link page](https://docs.snapfix.com/how-the-apps-work/screens/account/deep-link.md)                               | `dl.snapfix.com`                                                                                                                                                                                       | `web.snapfix.com` unless the link's `env` picks the test or staging host \[[ASK-264](https://github.com/snapfix/docs/blob/main/ASK.md#ask-264-should-a-deep-link-be-able-to-choose-the-test-or-staging-web-app)] | Same file                                                  |
| `ops_dashboard_fe`    | [Ops dashboard](https://docs.snapfix.com/how-the-apps-work/screens/reports/ops-dashboard.md), in a frame of the web app | `dashboard-{id}.snapfix.com`, named in web\_app\_v2's environment files                                                                                                                                | API at `dashboardapp.snapfix.com`, also named there                                                                                                                                                              | `-staging` variants of both                                |

The hosts where the apps run come from the links that the services and other apps build, such as authpy's shared-task links (authpy @ 5d5758661c, `model/feature_qrform.py:573-576`) and the deep links (`model/feature_token_ops.py:3742`).

### iOS and Android

* **iOS** has three configurations with an `.xcconfig` each (ios @ aa31967ac8, `Configuration/`), the schemes `SnapFix`, `SnapFix-Staging` and `SnapFix-Test` (plus `NotificationService`), and a Firebase config per environment under `SnapFix/Firebase/`. The three host sets are in `ApiEndpointManager.swift` (cited above). Lines 1495-1500 of that file are S3 bucket URLs for the login files, not API hosts.
* **Android** has the flavors `qa`, `staging` and `prod`, each setting `APP_MODE` and a Datadog sample rate (android @ 86068bfeea, `app/build.gradle:83-107`). Hosts are set per endpoint in `app/src/main/java/gmail/com/snapfixapp/utils/APIEndPointUtils.java`, as a production (`z`), staging (`y`) and test (`b`) URL each. The `BuildConfig` base URLs are only a fallback and are not in tracked files. The token refresh picks `b3`, `y3` or `z3` by mode (`app/src/main/java/gmail/com/snapfixapp/tasks/RefreshTokensTask.java:105-109`). One test URL uses a misspelled domain. The per-site host override is in [Services and hosts](https://docs.snapfix.com/engineering-reference/api.md#services-and-hosts).

## Services

One line per API and service repo. No repo has a job that deploys it (see [Release](#release)).

| Repo                    | Does                                                                                                                                                                               | Runs                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 | Deployed                                                                                                                                                                                                                                                                                                                                                 | Calls                                                                                                                                                                                                                                                          |
| ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `api_php_live_v2`       | Laravel API (`*4`): the web app's main API and the newer features                                                                                                                  | Ubuntu 22.04 with nginx, PHP 8.2 FPM, Redis, Supervisor running Horizon, and a cron line that runs `schedule:run` every minute (api\_php\_live\_v2 @ ef3c4319f6, `README.md:21`, `:35`, `:74`, `:361`, `:389-390`). Laravel Sail (`docker-compose.yml`) is for local work only.                                                                                                                                                                                                                                      | By hand with `git clone`, from the README (`:242-247`) or `project_setup.sh`, which clones with a GitHub token in the URL (`:143`, `:148`), sets up Horizon and cron (`:216-250`) and checks `/health` (`:293-315`). Each deploy ends with `horizon:terminate`, `horizon:purge` and `queue:restart` (`SUPERVISOR.md:119-123`). No pull or rollback step. | MySQL, Redis, S3, Firebase, Stripe, HubSpot, D3X, Twilio and SNS, mail, OpenAI or Gemini, the PMS services, `aitask_pyserver`, and the org mapping service for GoCardless, Xero and HubSpot deals (`config/app.php:331`)                                       |
| `php-apis`              | Oldest PHP API (`*1`): one dispatcher for the apps, one for the web                                                                                                                | Apache on EC2 (php-apis @ 238ca4414e, `README.md:6`, `:16`, `:37`), with local Redis (`htmlphp/api/snapfix/class/read-caching.php:8`) and MongoDB (`README.md:52`). The README starts Redis on all interfaces with no password (`:246-247`). Both dispatchers raise `memory_limit` to 3G and `max_execution_time` to 600 s (`html/api/snapfix/index.php:11-12`, `html/api/snapfix/web/index.php:11-12`).                                                                                                             | By hand: `git pull origin master` (`README.md:62`), then an Apache restart (`:156`, `:161`)                                                                                                                                                                                                                                                              | MySQL, MongoDB, Redis, S3, Stripe, HubSpot, Twilio, Firebase, OpenAI, BigQuery, an IP lookup, the voice AI service `apiai.snapfix.com`, the PMS host, authpy, apipy and Laravel                                                                                |
| `apipy`                 | Python API (`*2`, Flask 3): tasks, schedules, reminders, push, communication logs                                                                                                  | gunicorn with 9 workers on `0.0.0.0:5000` (apipy @ 0e83c85e5a, `README.md:273`) behind nginx, whose sample proxies to port 8000 (`:237`) \[[ASK-259](https://github.com/snapfix/docs/blob/main/ASK.md#ask-259-which-hosts-run-each-service-in-production-and-how-many-instances)]. A Celery worker under Supervisor with local Redis (`:67-115`).                                                                                                                                                                    | By hand: `git clone --branch test` (`:21`), then `supervisorctl restart celery` (`:137`)                                                                                                                                                                                                                                                                 | MySQL, Redis, MongoDB logs, S3, FCM, the messaging service `msg.s6eur.com` for email and SMS (`ses.py:67`, `sns.py:93`), CloudWatch Logs, SQS and Twilio for the communication log, an IP lookup, Stripe. Its HubSpot and Xero routes read synced tables only. |
| `authpy`                | Auth API (`*3`, Flask 3): sign-in, tokens, QR form submissions, the Looker proxy                                                                                                   | gunicorn with 9 workers on `0.0.0.0:5000` (authpy @ 5d5758661c, `README.md:199`) behind nginx proxying to port 8000 (`:164`)                                                                                                                                                                                                                                                                                                                                                                                         | By hand: `git clone` into `/home/ubuntu/pyapp` (`:21`)                                                                                                                                                                                                                                                                                                   | MySQL, S3, reCAPTCHA, Google sign-in, Twilio and the messaging service (`ses.py:67`, `sns.py:183`), Firebase App Check keys (`model/utils.py:145-147`), php-apis (Looker routes) and Laravel (guest routes)                                                    |
| `snapfix_ai_agent`      | Snapfix AI ("Simon", FastAPI): [AI API](https://docs.snapfix.com/engineering-reference/api/ai.md)                                                                                  | Image: Red Hat hardened Python 3.14, user `simon`, port 8085 (snapfix\_ai\_agent @ e5e18caef5, `Dockerfile:1`, `:22`, `:43-44`). Production Compose file: one host with nginx on port 80, MySQL 8.4, Redis, Qdrant and Phoenix (`docker-compose.prod.yaml:6-91`). A Helm chart for Kubernetes with 1 to 3 pods at 80% CPU (`chart/values.yaml:9-14`). Which one runs, and which branch, is \[[ASK-13](https://github.com/snapfix/docs/blob/main/ASK.md#ask-13-which-services-and-scheduled-jobs-run-in-production)]. | CI pushes an image to ECR (`.github/workflows/ci.yml:81-105`); no deploy job                                                                                                                                                                                                                                                                             | OpenAI, Qdrant, MySQL, Redis, Phoenix, and the Laravel and apipy test hosts in the chart's defaults (`chart/values.yaml:24`, `:30`) \[[ASK-13](https://github.com/snapfix/docs/blob/main/ASK.md#ask-13-which-services-and-scheduled-jobs-run-in-production)]   |
| `ops_dashboard_be`      | Ops dashboard API                                                                                                                                                                  | Image: Red Hat Python 3.13, gunicorn on port 5001 (ops\_dashboard\_be @ 0baced9cbf, `Dockerfile:1`, `:17`, `:29-30`). Compose: 4 workers, 300 s timeout, nginx on port 80 (`docker-compose.prod.yaml:13-21`).                                                                                                                                                                                                                                                                                                        | Compose builds the image on the host (`docker-compose.prod.yaml:6-8`); no deploy job                                                                                                                                                                                                                                                                     | MySQL read replica (`DB_HOST_RO`). Called by `ops_dashboard_fe` and the web app.                                                                                                                                                                               |
| `aitask_pyserver`       | AI suggestions while creating a task, plus experiment routes ([AI API](https://docs.snapfix.com/engineering-reference/api/ai.md))                                                  | uvicorn with 2 workers on `127.0.0.1:8000` under Supervisor, behind nginx, on Ubuntu EC2 (aitask\_pyserver @ 877304ec49, `ReadMe.md:21`, `:154`, `:200-212`)                                                                                                                                                                                                                                                                                                                                                         | By hand, `git clone` or a CI artifact into `/opt/snapfix-ai` (`:49-52`); a cron or systemd timer refreshes it (`:122`)                                                                                                                                                                                                                                   | OpenAI, Anthropic, Google, Hugging Face, MySQL, Redis or ElastiCache (`:30`, `:83`), Qdrant for the legacy routes only (`:17`). Called by Laravel.                                                                                                             |
| `py_scheduler`          | Cron jobs that turn schedules into tasks and reminders \[[ASK-50](https://github.com/snapfix/docs/blob/main/ASK.md#ask-50-which-job_create_mode-does-production-py_scheduler-use)] | Python scripts run by a crontab that is in no repo \[[ASK-13](https://github.com/snapfix/docs/blob/main/ASK.md#ask-13-which-services-and-scheduled-jobs-run-in-production)]. Creates jobs with apipy's code in `/home/ubuntu/pyapp` by default, or through apipy's API (py\_scheduler @ c8b1344036, `config/constant.py:138-140`)                                                                                                                                                                                    | Not in the repo                                                                                                                                                                                                                                                                                                                                          | MySQL, apipy                                                                                                                                                                                                                                                   |
| `cloudbeds_py_server`   | Cloudbeds PMS integration                                                                                                                                                          | A PMS service (see [PMS services](#pms-services)); `start.py` and `run_background_tasks.py`, with a Docker example in the README                                                                                                                                                                                                                                                                                                                                                                                     | By hand                                                                                                                                                                                                                                                                                                                                                  | Cloudbeds, MySQL, Redis, Laravel internal routes                                                                                                                                                                                                               |
| `clock_py_server`       | Clock PMS integration                                                                                                                                                              | A PMS service                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        | By hand; deployed at all? \[[ASK-13](https://github.com/snapfix/docs/blob/main/ASK.md#ask-13-which-services-and-scheduled-jobs-run-in-production)]                                                                                                                                                                                                       | Clock, MySQL, Redis. Called by Laravel only, not php-apis.                                                                                                                                                                                                     |
| `comtrol_py_server`     | Comtrol room status integration                                                                                                                                                    | Docker Compose on its own host: image `snapfix/comtrol-pyserver:latest` and Traefik v2.11 on ports 80 and 443 with Let's Encrypt, at `comtrol.snapfix.com` (comtrol\_py\_server @ 70129b5d33, `docker-compose.yml:3`, `:32-55`). The container runs as root and Traefik mounts the Docker socket. The Traefik dashboard route has no login.                                                                                                                                                                          | By hand with Compose                                                                                                                                                                                                                                                                                                                                     | Comtrol                                                                                                                                                                                                                                                        |
| `deputy_py_server`      | Deputy rosters proxy, a prototype with no Snapfix caller                                                                                                                           | `run.py` starts uvicorn with `reload=True` (deputy\_py\_server @ 6ee7e87f1a, `run.py:12`); no README                                                                                                                                                                                                                                                                                                                                                                                                                 | By hand                                                                                                                                                                                                                                                                                                                                                  | Deputy (token kept in a file), MySQL                                                                                                                                                                                                                           |
| `guestline_py_server`   | Guestline PMS integration                                                                                                                                                          | uvicorn on `127.0.0.1:8001` under Supervisor, routed by Traefik (guestline\_py\_server @ 6aa8239243, `README.md:47-107`)                                                                                                                                                                                                                                                                                                                                                                                             | By hand, by the README                                                                                                                                                                                                                                                                                                                                   | Guestline, MySQL, Redis;                                                                                                                                                                                                                                       |
| `hotsoft_py_server`     | Hotsoft PMS integration                                                                                                                                                            | A PMS service                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        | By hand; branch \[[ASK-13](https://github.com/snapfix/docs/blob/main/ASK.md#ask-13-which-services-and-scheduled-jobs-run-in-production)]                                                                                                                                                                                                                 | Hotsoft, MySQL, Redis;                                                                                                                                                                                                                                         |
| `jonaschorum_py_server` | Jonas Chorum PMS integration, with a SOAP listener                                                                                                                                 | A PMS service; `start.py` and `run_background_tasks.py`                                                                                                                                                                                                                                                                                                                                                                                                                                                              | By hand                                                                                                                                                                                                                                                                                                                                                  | Jonas Chorum, MySQL, Redis, Laravel internal routes                                                                                                                                                                                                            |
| `opera_py_server`       | Oracle OPERA PMS integration                                                                                                                                                       | A PMS service; `start.py` and `run_background_tasks.py`, with a Docker example in the README                                                                                                                                                                                                                                                                                                                                                                                                                         | By hand; branch \[[ASK-13](https://github.com/snapfix/docs/blob/main/ASK.md#ask-13-which-services-and-scheduled-jobs-run-in-production)]                                                                                                                                                                                                                 | OPERA, MySQL, Redis                                                                                                                                                                                                                                            |
| `protel_py_server`      | Protel PMS integration                                                                                                                                                             | A PMS service                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        | By hand; deployed at all? \[[ASK-13](https://github.com/snapfix/docs/blob/main/ASK.md#ask-13-which-services-and-scheduled-jobs-run-in-production)]                                                                                                                                                                                                       | Protel, MySQL, Redis. Called by Laravel only.                                                                                                                                                                                                                  |
| `stayntouch_py_server`  | Stayntouch PMS integration; receives webhooks                                                                                                                                      | A PMS service                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        | By hand                                                                                                                                                                                                                                                                                                                                                  | Stayntouch, MySQL, Redis; webhook checks                                                                                                                                                                                                                       |

### PMS services

Nine PMS integrations connect hotel systems. Eight share one design: a Python app with Redis, served under its own path of `pms-integration.snapfix.com` behind Traefik and Supervisor, writing its own tables in the main MySQL database. Comtrol is the exception, with Docker on its own host. Deputy is the rosters proxy above, not a PMS. php-apis names the PMS host for seven of them, Comtrol included, but not Clock or Protel (php-apis @ 238ca4414e, `htmlphp/api/snapfix/class/class.functions.php:45468-45562`); Laravel's room status job covers all nine (api\_php\_live\_v2 @ ef3c4319f6, `app/Enums/Pms.php:7-15`). Guestline's README is the only written setup. The repos do not say how many machines serve the PMS host \[[ASK-259](https://github.com/snapfix/docs/blob/main/ASK.md#ask-259-which-hosts-run-each-service-in-production-and-how-many-instances)]. Product view: [PMS integrations](https://docs.snapfix.com/product/features/integrations/pms-integrations.md); endpoints: [Integrations](https://docs.snapfix.com/engineering-reference/api/integrations.md).

### Background jobs

| Job                   | Where                                                                             | What it does                                                                                                                                                                                                                                                                                   |
| --------------------- | --------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Laravel scheduler     | `api_php_live_v2`, cron every minute                                              | Runs `php artisan schedule:run`                                                                                                                                                                                                                                                                |
| Laravel queue workers | `api_php_live_v2`, Horizon under Supervisor                                       | Runs queued jobs; restarted after each deploy                                                                                                                                                                                                                                                  |
| Celery worker         | `apipy`, Supervisor (`README.md:110-137`)                                         | Runs Celery tasks; the broker is local Redis                                                                                                                                                                                                                                                   |
| Mute cache            | `apipy`, `test.sh:3` runs `update-cache.py`                                       | Copies group mutes into Redis; how often is \[[ASK-13](https://github.com/snapfix/docs/blob/main/ASK.md#ask-13-which-services-and-scheduled-jobs-run-in-production)]                                                                                                                           |
| Communication log     | `apipy`, `communication-log.sh:3`                                                 | Copies email and SMS delivery records from CloudWatch Logs, SQS and Twilio (`communication_log/`)                                                                                                                                                                                              |
| Schedules             | `py_scheduler`, every 5 and 10 minutes (`config/constant.py:128`, `:145`, `:150`) | Creates tasks and reminders from schedules \[[ASK-50](https://github.com/snapfix/docs/blob/main/ASK.md#ask-50-which-job_create_mode-does-production-py_scheduler-use), [ASK-55](https://github.com/snapfix/docs/blob/main/ASK.md#ask-55-do-the-scheduler-and-api-servers-run-on-utc)]          |
| Document indexer      | `snapfix_ai_agent`                                                                | The README gives an hourly cron only as an example (`README.md:170-171`), and the document source is a stub \[[ASK-180](https://github.com/snapfix/docs/blob/main/ASK.md#ask-180-which-service-indexes-and-serves-the-brand-standards-documents-and-does-it-check-the-callers-site-and-group)] |
| Cache cleanup         | `ops_dashboard_be`, a thread every 300 s (`analytics/api.py:2116-2126`)           | Removes old cache files                                                                                                                                                                                                                                                                        |

## Third parties

Which service talks to each provider. Secret names are in [Secrets](#secrets-names-only).

| Provider                                    | Used for                                                                                                              | Who talks to it                                                                                                                                                                                                               | Notes                                                                                                                                                                                                                                                                                     |
| ------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Stripe                                      | Subscriptions, card and package payments                                                                              | Laravel, php-apis (`PROD_STRIPE_SK`, `SB_STRIPE_SK`), apipy, authpy; web builds set the mode                                                                                                                                  | \[[ASK-225](https://github.com/snapfix/docs/blob/main/ASK.md#ask-225-which-stripe-customer-should-a-signed-in-buyer-of-a-package-with-its-own-customer-be-charged-on)]                                                                                                                    |
| GoCardless, Xero                            | Direct debit; accounting contacts                                                                                     | Laravel, through the org mapping service `orgmapping.snapfix.com` (api\_php\_live\_v2 @ ef3c4319f6, `config/app.php:331`)                                                                                                     |                                                                                                                                                                                                                                                                                           |
| HubSpot                                     | Company, contact and deal sync                                                                                        | Laravel (api\_php\_live\_v2 @ ef3c4319f6, `config/helphub.php`), php-apis (php-apis @ 238ca4414e, `htmlphp/api/snapfix/class/hubspot.functions.php`); apipy serves the synced tables (apipy @ 0e83c85e5a, `app.py:2280-2568`) | Callback page: \[[ASK-196](https://github.com/snapfix/docs/blob/main/ASK.md#ask-196-is-the-hubspot-callback-page-still-hubspots-oauth-redirect)]                                                                                                                                          |
| Apple App Store                             | In-app purchases                                                                                                      | iOS, then the API                                                                                                                                                                                                             | [In-app purchase](https://docs.snapfix.com/product/features/billing/in-app-purchase.md), \[[ASK-143](https://github.com/snapfix/docs/blob/main/ASK.md#ask-143-how-does-an-app-store-purchase-reach-a-sites-plan)]                                                                         |
| Sign-in providers                           | Microsoft (MSAL, web and iOS), Google (iOS pod, authpy token exchange), Apple                                         | Apps and authpy                                                                                                                                                                                                               | [Auth API](https://docs.snapfix.com/engineering-reference/api/auth.md), \[[ASK-64](https://github.com/snapfix/docs/blob/main/ASK.md#ask-64-does-the-ios-sign-in-screen-show-google-apple-and-microsoft)]                                                                                  |
| Google reCAPTCHA                            | Bot checks                                                                                                            | authpy, php-apis, qr\_forms                                                                                                                                                                                                   |                                                                                                                                                                                                                                                                                           |
| IP lookup (`extreme-ip-lookup.com`)         | Locating the caller                                                                                                   | web\_app\_v2, web\_payments, php-apis, apipy                                                                                                                                                                                  |                                                                                                                                                                                                                                                                                           |
| Twilio                                      | SMS, WhatsApp, verification codes, delivery logs                                                                      | Laravel, php-apis (`sms.php`), apipy, authpy                                                                                                                                                                                  |                                                                                                                                                                                                                                                                                           |
| AWS SES, SNS, SQS, CloudWatch Logs          | Email and SMS through the messaging service; delivery records                                                         | Laravel, apipy, authpy                                                                                                                                                                                                        |                                                                                                                                                                                                                                                                                           |
| Email                                       | SMTP by default; Mailgun, SES or the internal service when `MAIL_MAILER` says so; Postmark has settings but no sender | Laravel (api\_php\_live\_v2 @ ef3c4319f6, `app/Jobs/SendEmail.php:34`, `.env.example:60`)                                                                                                                                     | \[[ASK-12](https://github.com/snapfix/docs/blob/main/ASK.md#ask-12-which-settings-do-the-production-api-servers-use)]                                                                                                                                                                     |
| Firebase                                    | Push (FCM), chat (Firestore), Realtime Database, Remote Config, Analytics, Crashlytics, App Check, Dynamic Links      | Both apps; web\_app\_v2, qr\_forms (Analytics) and ops\_dashboard\_fe on project `snapfix-ireland`; apipy and Laravel (push); php-apis and Laravel (Dynamic Links); authpy (App Check)                                        | [Push notifications](https://docs.snapfix.com/product/features/notifications/push-notifications.md), \[[ASK-43](https://github.com/snapfix/docs/blob/main/ASK.md#ask-43-where-are-the-firebase-rules-that-guard-chat-data)]                                                               |
| Pusher, Reverb, Ably                        | Realtime broadcasts                                                                                                   | Laravel; the code default is `null` and `.env.example` sets `BROADCAST_DRIVER` twice, `log` and `reverb` (`.env.example:46`, `:208`)                                                                                          | Unused by clients: only the five inbox events broadcast (`app/Events/Inbox/`), and web\_app\_v2, ios, android and ops\_dashboard\_fe have no Echo, Pusher or Reverb client                                                                                                                |
| D3X                                         | Guest inbox webhook                                                                                                   | Laravel (`config/d3x.php`)                                                                                                                                                                                                    | \[[ASK-157](https://github.com/snapfix/docs/blob/main/ASK.md#ask-157-is-the-d3x-inbox-live-and-should-its-webhook-accept-only-connected-sites)]                                                                                                                                           |
| Survicate                                   | In-app surveys                                                                                                        | Android, iOS (package), web\_app\_v2                                                                                                                                                                                          |                                                                                                                                                                                                                                                                                           |
| OpenAI                                      | Language models and embeddings                                                                                        | Snapfix AI, aitask\_pyserver, Laravel (default provider; Gemini optional, `config/ai.php:14`), php-apis                                                                                                                       | \[[ASK-91](https://github.com/snapfix/docs/blob/main/ASK.md#ask-91-which-auto-assign-provider-runs-in-production-and-may-it-send-data-to-an-ai-service), [ASK-176](https://github.com/snapfix/docs/blob/main/ASK.md#ask-176-which-ai-suggestion-settings-and-logins-does-production-use)] |
| Anthropic, Google, Hugging Face             | AI experiments                                                                                                        | aitask\_pyserver                                                                                                                                                                                                              |                                                                                                                                                                                                                                                                                           |
| Qdrant, Phoenix                             | Vector search; AI tracing                                                                                             | Snapfix AI and aitask\_pyserver; Snapfix AI                                                                                                                                                                                   | Self-hosted                                                                                                                                                                                                                                                                               |
| Voice AI service                            | Voice tasks                                                                                                           | php-apis                                                                                                                                                                                                                      |                                                                                                                                                                                                                                                                                           |
| Datadog (EU)                                | APM, logs, browser and app monitoring                                                                                 | Laravel, web\_app\_v2, ops\_dashboard\_fe, Android, iOS                                                                                                                                                                       | [Monitoring](#monitoring)                                                                                                                                                                                                                                                                 |
| Papertrail, Slack, Oh Dear                  | Log copies, log and health alerts                                                                                     | Laravel (`config/logging.php:76`, `:85`; `config/health.php`)                                                                                                                                                                 | \[[ASK-260](https://github.com/snapfix/docs/blob/main/ASK.md#ask-260-which-alerts-and-monitors-exist-and-who-receives-them)]                                                                                                                                                              |
| Google Analytics 4, Looker Studio, BigQuery | Dashboard analytics; company metrics                                                                                  | ops\_dashboard\_fe; authpy `/looker/*` reading php-apis; php-apis                                                                                                                                                             |                                                                                                                                                                                                                                                                                           |
| Amazon Cognito, Google Maps, Google Fonts   | Legacy class in php-apis; admin app maps; dashboard fonts                                                             | php-apis; webadmin\_angular; ops\_dashboard\_fe                                                                                                                                                                               |                                                                                                                                                                                                                                                                                           |
| PMS vendors                                 | Cloudbeds, Clock, Comtrol, Deputy, Guestline, Hotsoft, Jonas Chorum, OPERA, Protel, Stayntouch                        | The PMS services                                                                                                                                                                                                              | \[[ASK-154](https://github.com/snapfix/docs/blob/main/ASK.md#ask-154-which-vendor-systems-call-the-pms-services-poll-post-and-redirect-routes), [ASK-155](https://github.com/snapfix/docs/blob/main/ASK.md#ask-155-which-settings-do-the-pms-services-use-in-production)]                 |
| Telegram, GitHub                            | Web build notices; code and CI                                                                                        | web\_app\_v2 CI; all repos                                                                                                                                                                                                    |                                                                                                                                                                                                                                                                                           |

iOS lists AppsFlyer and Storyteller in its `Podfile`, but both pods and their imports are commented out (ios @ aa31967ac8, `Podfile:55`, `:67`). The iOS Firebase pods are commented out too (`Podfile:79-89`): the app gets Firebase, Crashlytics, Datadog and Survicate through Swift packages instead.

## Data

| Store                                 | Holds                                                                                                                                                                                                                                                  | Used by                                                                                                                                                                                                              | Notes                                                                                                                                                                                                                                                               |
| ------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| MySQL, read-write and read-only hosts | Customer data ([schema](https://docs.snapfix.com/engineering-reference/db.md))                                                                                                                                                                         | Laravel (`DB_HOST_RW`, `DB_HOST_RO`, `README.md:319-320`), php-apis, apipy, authpy, py\_scheduler, the PMS services (own tables in the main schema), ops\_dashboard\_be (read replica)                               | Staging is Aurora MySQL 3 ([database docs](https://docs.snapfix.com/engineering-reference/db.md)). Backups: \[[ASK-261](https://github.com/snapfix/docs/blob/main/ASK.md#ask-261-which-data-stores-are-backed-up-for-how-long-and-when-was-a-restore-last-tested)]. |
| MySQL, metrics and API log databases  | Metrics; API request logs                                                                                                                                                                                                                              | Laravel (`config/database.php:46`, `:277`), php-apis, apipy, authpy                                                                                                                                                  |                                                                                                                                                                                                                                                                     |
| MySQL for Snapfix AI                  | Chats and usage                                                                                                                                                                                                                                        | snapfix\_ai\_agent                                                                                                                                                                                                   | \[[ASK-179](https://github.com/snapfix/docs/blob/main/ASK.md#ask-179-which-database-does-snapfix-ai-use-in-production-and-are-the-ai_agent_-tables-still-used)]                                                                                                     |
| MongoDB                               | Old request logs only. php-apis's log call returns before writing (php-apis @ 238ca4414e, `htmlphp/api/snapfix/class/mongo.functions.php:128-129`), and apipy writes only from its test route `/mongo-log-test` (apipy @ 0e83c85e5a, `app.py:205-248`) | Old log page in php-apis; two test actions                                                                                                                                                                           |                                                                                                                                                                                                                                                                     |
| Redis                                 | Caches, queues, Horizon, Celery broker, mute cache                                                                                                                                                                                                     | Laravel (`.env.example` sets cache and queue to `redis`; the code defaults are `file` and `sync`), apipy, aitask\_pyserver, the PMS services, Snapfix AI; a separate translation Redis                               | \[[ASK-12](https://github.com/snapfix/docs/blob/main/ASK.md#ask-12-which-settings-do-the-production-api-servers-use)]. Laravel also has settings for Memcached, DynamoDB and SQS.                                                                                   |
| S3                                    | Images, documents, reports, cache, logs, contact files, back-office files                                                                                                                                                                              | php-apis (php-apis @ 238ca4414e, `htmlphp/api/snapfix/config/constant_dev.php:170-176`), Laravel (disks `s3-bo` and `s3-log`, api\_php\_live\_v2 @ ef3c4319f6, `config/filesystems.php:49`, `:63`), apipy and authpy | See [Public files](#public-files)                                                                                                                                                                                                                                   |
| Firestore and Realtime Database       | Chat (`chat-live`, `chat-test`); realtime data (`snapfix-ireland`)                                                                                                                                                                                     | Apps, web\_app\_v2, ops\_dashboard\_fe                                                                                                                                                                               | \[[ASK-43](https://github.com/snapfix/docs/blob/main/ASK.md#ask-43-where-are-the-firebase-rules-that-guard-chat-data)]                                                                                                                                              |
| Qdrant                                | Vector index                                                                                                                                                                                                                                           | snapfix\_ai\_agent (`127.0.0.1:6333`, snapshots volume, no schedule), aitask\_pyserver                                                                                                                               |                                                                                                                                                                                                                                                                     |
| Local disk                            | Ops dashboard cache files; php-apis report files; py\_scheduler run logs; Deputy token and rosters                                                                                                                                                     | ops\_dashboard\_be, php-apis, py\_scheduler, deputy\_py\_server                                                                                                                                                      |                                                                                                                                                                                                                                                                     |

### Public files

php-apis stores every S3 upload with a `public-read` ACL except contact files (php-apis @ 238ca4414e, `html/api/snapfix/s3.php:134-442`, `:476`), and apipy and authpy do the same, into the test bucket `test.images.snapfix.io` in every mode (apipy @ 0e83c85e5a, `s3helper.py:24`, `:30`; authpy @ 5d5758661c, `s3helper.py`) \[[ASK-173](https://github.com/snapfix/docs/blob/main/ASK.md#ask-173-should-qr-photos-keep-going-to-the-bucket-named-testimagessnapfixio)]. Affected: reports, voice recordings, user log exports, email and QR attachments, QR photos. Whether the buckets allow public ACLs is not in any repo \[[ASK-115](https://github.com/snapfix/docs/blob/main/ASK.md#ask-115-can-compliance-documents-report-files-and-the-comply-report-be-opened-from-their-link-without-signing-in)]. Compliance documents and report links: \[[ASK-115](https://github.com/snapfix/docs/blob/main/ASK.md#ask-115-can-compliance-documents-report-files-and-the-comply-report-be-opened-from-their-link-without-signing-in)]; report retention: \[[ASK-120](https://github.com/snapfix/docs/blob/main/ASK.md#ask-120-should-the-report-pages-say-how-long-reports-stay)].

## Release

No repo has a job that puts a build in front of users, and no repo says who releases or how to roll back \[[ASK-258](https://github.com/snapfix/docs/blob/main/ASK.md#ask-258-how-does-each-release-reach-users-who-signs-it-and-how-is-it-rolled-back)]. The docs side cannot see CI results \[[ASK-5](https://github.com/snapfix/docs/blob/main/ASK.md#ask-5-let-agents-see-ci-results)].

| Build                                                                  | Built by                                                                                                                                                                                                                                                                                                                    | Reaches users through                                                                                                                                                                      |
| ---------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `web_app_v2`                                                           | GitHub Actions "Build & Notify", started by hand with `test`, `staging` or `prod`, which select the configurations `staging`, `staging-live` and `production` (web\_app\_v2 @ 0989b8e685, `.github/workflows/build-and-notify.yml:4-14`, `:36-54`)                                                                          | A zip sent to Telegram, or only a message when the zip is over 50 MB (`:64-109`). The upload to the host is not in the repo.                                                               |
| `qr_forms`, `web_payments`                                             | CI on push and pull request to `master`: tests on Node 16 and 18, then a build (`.github/workflows/node.js.yml`)                                                                                                                                                                                                            | No deploy step                                                                                                                                                                             |
| `web_onboarding_form`, `web_tasks`, `webadmin_angular`, `dynamic-link` | No CI                                                                                                                                                                                                                                                                                                                       | Not in the repos                                                                                                                                                                           |
| `ops_dashboard_fe`                                                     | No build step: static files, version 1.16.0 (`VERSION.txt`)                                                                                                                                                                                                                                                                 | An S3 bucket per deployment, which also gets the Datadog token (`datadog.js:5-8`)                                                                                                          |
| `ios`                                                                  | Version 6.10.82, build 3 (`Configuration/Version.xcconfig:2-3`). CI on pushes to `CICD_SEPT_2022` whose first commit message has "Ready to test iOS": a simulator build, copied to a repository outside the org (`.github/workflows/swift.yml:4-72`). The file does not parse as YAML.                                      | App Store; the upload is not in the repo                                                                                                                                                   |
| `android`                                                              | Version 6.10.81, code 351 (`app/build.gradle:31-32`). Only a debug signing config; no release signing \[[ASK-258](https://github.com/snapfix/docs/blob/main/ASK.md#ask-258-how-does-each-release-reach-users-who-signs-it-and-how-is-it-rolled-back)]. Release builds upload the R8 mapping to Datadog (`:153-209`). No CI. | Google Play; the upload is not in the repo                                                                                                                                                 |
| The four APIs, `aitask_pyserver`, `py_scheduler`, the PMS services     | Not built in CI                                                                                                                                                                                                                                                                                                             | By hand on the server, see [Services](#services)                                                                                                                                           |
| `snapfix_ai_agent`                                                     | CI on `main`, tags `v*` and pull requests: lint, type checks and tests with MySQL, Redis and Qdrant, then a multi-arch image tagged with the git tag or `latest` and the `git describe` version, pushed to ECR with a GitHub role (`ci.yml:3-105`)                                                                          | Compose or the Helm chart, which pins `latest` with `IfNotPresent` (`chart/values.yaml:1-4`); the External Secrets run in an Argo CD sync wave (`chart/templates/externalsecrets.yaml:11`) |
| `ops_dashboard_be`, `comtrol_py_server`                                | Images built by Compose on the host; Comtrol uses `latest`                                                                                                                                                                                                                                                                  | By hand                                                                                                                                                                                    |

## Monitoring

| Signal         | Where                                                                                                                                                                                                                             | Notes                                                                                                                                    |
| -------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
| Laravel logs   | Daily files under `/var/log/laravel/`, shipped by the Datadog agent with APM on `datadoghq.eu` (api\_php\_live\_v2 @ ef3c4319f6, `DATADOG.md:24-77`); optional Papertrail and Slack channels                                      | Log viewer; Horizon dashboard                                                                                                            |
| Request logs   | Daily `apilog_YYYY_MM_DD` tables in the API log databases, written by Laravel, php-apis, apipy and authpy ([Logging](https://docs.snapfix.com/engineering-reference/api.md#blocking-and-rate-limits))                             |                                                                                                                                          |
| Python logs    | Files on the servers, such as `/var/log/celery.out.log`, `/var/log/pyapp/cronlog.txt` and `/var/log/pyapp/cronlog-communication.txt`                                                                                              |                                                                                                                                          |
| php-apis files | Seven runtime `.log` files are tracked in git                                                                                                                                                                                     |                                                                                                                                          |
| Web monitoring | Datadog RUM in web\_app\_v2 (service `snapfix-web-app`, production and staging builds, tagged by environment; no session replay by default, inputs masked; web\_app\_v2 @ 0989b8e685, `src/main.ts:10-30`) and ops\_dashboard\_fe | Replay for one customer: \[[ASK-9](https://github.com/snapfix/docs/blob/main/ASK.md#ask-9-does-staycity-know-its-sessions-are-recorded)] |
| App monitoring | Datadog EU on Android (`app/build.gradle:146-148`) and iOS (`Managers/DatadogManager.swift:35`); Crashlytics on both, on Android in release builds only (`app/build.gradle:55-56`, `:66-67`)                                      | Android monitors are a hand-off list, not created from the repo (`docs/datadog-performance-android.md`)                                  |
| AI tracing     | Phoenix on `127.0.0.1:6006` in Snapfix AI's Compose file; the chart's tracing endpoint is empty                                                                                                                                   |                                                                                                                                          |
| Health checks  | `/health` in Laravel, apipy, authpy, Snapfix AI (probes) and the PMS services                                                                                                                                                     |                                                                                                                                          |
| Build notices  | Telegram per web build                                                                                                                                                                                                            |                                                                                                                                          |
| Alerts         | Slack and Oh Dear settings in Laravel; no alert rules or uptime checks in any repo                                                                                                                                                | \[[ASK-260](https://github.com/snapfix/docs/blob/main/ASK.md#ask-260-which-alerts-and-monitors-exist-and-who-receives-them)]             |

## Diagram

Clients, services and data stores. Third parties are in the tables above.

```mermaid
flowchart LR
  subgraph clients["Clients"]
    web["Web apps"]
    mobile["iOS and Android"]
    opsfe["ops_dashboard_fe"]
  end
  subgraph services["Services"]
    laravel["api_php_live_v2 (z4)"]
    php["php-apis (z1)"]
    apipy["apipy (z2)"]
    authpy["authpy (z3)"]
    simon["snapfix_ai_agent"]
    aitask["aitask_pyserver"]
    opsbe["ops_dashboard_be"]
    sched["py_scheduler"]
    pms["PMS services"]
  end
  subgraph data["Data stores"]
    mysql[("MySQL")]
    mongo[("MongoDB")]
    redis[("Redis")]
    firebase[("Firebase")]
    s3[("S3")]
    qdrant[("Qdrant")]
  end
  web --> laravel
  web --> php
  web --> apipy
  web --> authpy
  web --> simon
  mobile --> laravel
  mobile --> php
  mobile --> apipy
  mobile --> authpy
  mobile --> simon
  web --> firebase
  mobile --> firebase
  opsfe --> opsbe
  web --> opsfe
  laravel --> pms
  laravel --> aitask
  php --> pms
  php --> authpy
  php --> apipy
  php --> laravel
  authpy --> php
  authpy --> laravel
  sched --> apipy
  laravel --> mysql
  php --> mysql
  apipy --> mysql
  authpy --> mysql
  sched --> mysql
  pms --> mysql
  opsbe --> mysql
  simon --> mysql
  php -.-> mongo
  laravel --> redis
  apipy --> redis
  pms --> redis
  simon --> redis
  aitask --> redis
  php --> s3
  laravel --> s3
  apipy --> s3
  authpy --> s3
  simon --> qdrant
  aitask --> qdrant
```

## Secrets (names only)

No value appears in these docs.

| Where                                  | Secret variables                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| -------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `api_php_live_v2` `.env.example`       | `APP_KEY`, `DB_PASSWORD`, `METRICS_DB_PASSWORD`, `REDIS_PASSWORD`, `TRANSLATION_REDIS_PASSWORD`, `MAIL_PASSWORD`, `MASSAGING_INTERNAL_PASSWORD`, `AWS_SECRET_ACCESS_KEY`, `TWILIO_AUTH_TOKEN`, `STRIPE_SECRET`, `PUSHER_APP_SECRET`, `REVERB_APP_SECRET`, `FIREBASE_CREDENTIALS`, `FIREBASE_API_KEY`, `APP_JWT_SECRET`, `PAYMENT_JWT_SECRET`, `QR_JWT_SECRET`, `ADMIN_JWT_SECRET`, `ORG_MAPPING_PASSWORD`, `AI_SUGGESTION_PASSWORD`, `D3X_WEBHOOK_SECRET`, and the `AUTH_PASS_*` logins for internal, public, vendor, script, guest and each PMS caller                            |
| `api_php_live_v2` config only          | `LOG_SLACK_WEBHOOK_URL`, the Papertrail and Oh Dear settings, `OPENAI_API_KEY`, `GEMINI_API_KEY`, Mailgun, Postmark and Ably keys                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `php-apis` `config/.env.example`       | `AUTH_PASSWORD`, `GL_AUTH_PASSWORD`, `JWT_SECRET`, `AWS_SECRET_KEY`, `AWS_CLIENT_SECRET`, `AUTH_PY_BA_PASSWORD`, `DB_PASSWORD`, `PROD_STRIPE_SK`, `SB_STRIPE_SK`, `RECAPTCHA_SK`                                                                                                                                                                                                                                                                                                                                                                                                   |
| `php-apis` code                        | Metrics database password, voice AI key, Firebase key and others, Twilio login in `html/api/snapfix/sms.php:143-146`                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| `apipy`, `authpy`                      | The server file `/etc/pyapp/security.json` (`config/constant.py:23`); authpy holds a Google client secret in code and Twilio settings                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `py_scheduler`                         | The server file `/etc/snapfix/config.json` (`config/constant.py:20`)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| PMS services                           | All: `BASIC_AUTH_PASSWORD`, `DATABASE_PASSWORD`, `REDIS_PASSWORD`. Cloudbeds and Jonas Chorum: `LARAVEL_BASIC_AUTH_PASSWORD`; Jonas Chorum: `CHORUM_PARTNER_TOKEN`; Clock: `CLOCK_API_PASSWORD`; Guestline: `GL_CRYPT_KEY`; Hotsoft: `HOTSOFT_APP_BASIC_AUTH_PASSWORD`; OPERA: `OPERA_APP_KEY`; Stayntouch: `INTERNAL_SYSTEM_BASIC_AUTH_PASSWORD`, `STAYNTOUCH_WEBHOOK_SECRET`; Deputy: `DEPUTY_CLIENT_SECRET`, `MYSQL_PASSWORD`, `STAYCITY_BASIC_AUTH_PASSWORD`; Comtrol (code only): `DB_PASSWORD`, `ROOM_STATUS_PASSWORD`. The example files ship working-looking Basic logins. |
| `aitask_pyserver`                      | `OPENAI_API_KEY`, `ANTHROPIC_API_KEY`, `GOOGLE_API_KEY`, `HUGGINGFACE_API_TOKEN`, `QDRANT_API_KEY`, `MYSQL_PASSWORD`, `AI_TASK_BASIC_AUTH_PASSWORD`, `DOCS_BASIC_AUTH_PASSWORD`                                                                                                                                                                                                                                                                                                                                                                                                    |
| `snapfix_ai_agent`                     | `.env`: `SIMON_OPENAI_API_KEY`, `SIMON_QDRANT_API_KEY`, `SIMON_MYSQL_URL`, `SIMON_REDIS_URL`, `QDRANT_API_KEY`, `MYSQL_PASSWORD`, `MYSQL_ROOT_PASSWORD`. Chart: `SIMON_OPENAI_API_KEY`, `SIMON_QDRANT_API_KEY`, `MYSQL_PASSWORD`, `REDIS_PASSWORD` from AWS Secrets Manager entry `snapfix-poc/platform` (`chart/values.yaml:81-98`)                                                                                                                                                                                                                                               |
| `ops_dashboard_be`, `ops_dashboard_fe` | `DB_PASSWORD`, `JWT_SECRET`; the front end's Firebase config and `DATADOG_CLIENT_TOKEN` are meant for browsers                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| Web builds                             | Laravel guest logins in web\_app\_v2's and qr\_forms' environment files, shared logins in `src/app/shared/config.ts`, a Stripe publishable key in web\_app\_v2 and web\_payments                                                                                                                                                                                                                                                                                                                                                                                                   |
| iOS, Android                           | iOS code passwords, CocoaPods keys; Android `TOTP_SECRET` in `secrets.properties`, keystores and a password file in git                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| GitHub                                 | iOS CI: `BUILD_CERTIFICATE_BASE64`, `BUILD_PROVISION_PROFILE_BASE64`, `P12_PASSWORD`, `KEYCHAIN_PASSWORD`, `GIT_TOKEN`. Web CI: `TELEGRAM_BOT_TOKEN`, `TELEGRAM_CHAT_ID`. Snapfix AI CI: no stored keys, only `vars.AWS_ROLE_ARN`, `vars.AWS_REGION`, `vars.ECR_REGISTRY`.                                                                                                                                                                                                                                                                                                         |

Where the production values live is not in the repos \[[ASK-262](https://github.com/snapfix/docs/blob/main/ASK.md#ask-262-where-are-production-secrets-kept-for-each-service-and-how-are-they-rotated)].

## Risky setups

* Each stack runs on one server with no failover: Laravel with its Redis and Horizon, apipy with its broker, the Snapfix AI Compose host, the ops dashboard, the PMS host.
* Every backend is deployed by hand, with no approval, staging step or rollback.
* Snapfix AI's chart and Comtrol's Compose file run the `latest` image tag.
* The Laravel setup script puts a GitHub token in the clone URL.
* The php-apis README starts Redis on all interfaces with no password \[[ASK-263](https://github.com/snapfix/docs/blob/main/ASK.md#ask-263-are-redis-and-the-port-80-front-ends-reachable-from-the-internet-without-protection)].
* Comtrol runs as root and mounts the Docker socket.
* Comtrol keeps its Let's Encrypt store `traefik/acme.json` in the repo, not ignored.
* Several front ends listen on port 80; where TLS ends is not in the repos \[[ASK-263](https://github.com/snapfix/docs/blob/main/ASK.md#ask-263-are-redis-and-the-port-80-front-ends-reachable-from-the-internet-without-protection)].
* Android keystores and a password file are in git.
* Twilio and Google secrets are in code.
* The iOS workflow does not parse and copies builds outside the org.
* php-apis tracks runtime logs.
* Uploads are public-read ([Public files](#public-files)).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.snapfix.com/engineering-reference/infra.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
