# Templates

Source: https://dbmcp.haymon.ai/templates/

Ready-made privacy rules for popular applications, to paste into your config

> **Warning:** Templates are built from each application's schema files at pinned releases, not yet checked against a running instance. Compare the keys with `objects` output before relying on one ([Checking the keys](#checking-the-keys)).

One customer's e-mail address, name, and address sit in many tables: accounts, addresses, carts, orders, admin grids, newsletter lists, reviews. A forgotten table comes back unredacted, and a mistyped key matches nothing without warning ([Column keys](/privacy/rules#column-keys)). Each page below lists them for one application.

## Using a template

1. Copy the page's template into your config; on pages with a version selector, pick your version first. If the config already has a `privacy:` section, paste the rules under its `rules:`.
2. Delete what you do not want: columns under a `# … (optional)` comment for modules or data you do not need ruled (keeping them is harmless), and the `mixed-content` rule if the assistant needs those columns readable. Keep `mixed-content-secrets` ([Mixed-content columns](#mixed-content-columns)).
3. Set [`database.name`](/features/database) on MySQL, MariaDB, and PostgreSQL: short `table.column` keys need it (on SQLite they expand to `main.main`). Pinning a name removes the `database` parameter and `objects` `kind: "database"`.
4. If your installation prefixes its tables, prepend the prefix to every table in the keys ([Table prefixes](#table-prefixes)).
5. Set [`privacy.key`](/privacy/redaction#hash-key) so `hash` tokens stay stable across restarts and replicas.

```yaml
database:
  backend: mysql
  name: shop
privacy:
  mode: rules        # or full
  rules:
    # pasted template
    emails:
      columns:
        - customer.email
        - order_customer.email
      entity: EMAIL_ADDRESS
      operator: hash
    # your own rules
    loyalty-cards:
      columns:
        - loyalty_member.card_number
      entity: CREDIT_CARD
      operator: redact
```

Templates are docs, not files for `--config-file`: the last config file that sets `privacy.rules` replaces it whole, so a template file could not sit under your own rules.

## Page layout

Every page has the same sections:

- **Coverage:** versions, engines, whether the application prefixes its tables, and forks where they differ.
- **Template:** one complete template, or one per version behind a version selector. Optional columns sit under a `# <module or data> (optional)` comment; the `mixed-content` and `mixed-content-secrets` rules come last. Then **Choices**: what the template decides beyond the conventions below, and what the optional parts hold.
- **Trade-offs:** indexed ruled columns, lookups that stop working, unruled join keys.
- **Not covered:** personal data the template leaves out, and why.
- **Sources:** the schema files, pinned.

A template may list keys for columns your version or modules lack: they match nothing and are accepted at startup. Where a page records when a key appeared, a YAML comment says so (`# 5.7+`, `# 9.1 only`).

## Conventions

Every rule states its operator, so a template does not depend on `privacy.operator`. A `hash` entity is hashed in every column of a template, so a value gets the same token in every column that holds it, and the assistant can match a customer's rows across tables without seeing the value. Re-copying a `hash` rule whose entity changed changes its tokens ([How values are rewritten](/privacy/rules#how-values-are-rewritten)). Rules are named after the data they hold:

| Data | Rule | Entity | Operator |
|---|---|---|---|
| E-mail addresses | `emails` | `EMAIL_ADDRESS` | `hash` |
| Names, usernames, logins | `names` | `PERSON` | `hash` |
| Phone numbers | `phones` | `PHONE_NUMBER` | `hash` |
| IP addresses | `ip-addresses` | `IP_ADDRESS` | `hash` |
| Street and city, postcodes, companies | `addresses`, `postcodes`, `companies` | `LOCATION`, `POSTCODE`, `ORGANIZATION` | `hash` |
| Provider, visitor, tracking, and device ids; employee and student numbers | `user-ids` | `USER_ID` | `hash` |
| User agents | `user-agents` | `USER_AGENT` | `hash` |
| IBANs | `ibans` | `IBAN_CODE` | `hash` |
| Other bank account numbers | `bank-accounts` | `BANK_ACCOUNT` | `hash` |
| BICs; sort, branch, and bank codes | `bics`; `bank-codes` | `BIC_CODE`; `BANK_CODE` | `hash` |
| VAT numbers | `vat-numbers` | `VAT_NUMBER` | `hash` |
| Other tax ids; German tax numbers | `tax-ids`; `tax-numbers` | `TAX_ID`; `TAX_NUMBER_DE` | `hash` |
| Registry numbers | `registry-numbers` | `COMMERCIAL_REGISTER_DE` or `COMMERCIAL_REGISTER` (one per page) | `hash` |
| National ids, passports, residence permits, licence plates | `id-cards`, `passports`, `residence-permits`, `license-plates` | `NATIONAL_ID`, `PASSPORT`, `RESIDENCE_PERMIT`, `LICENSE_PLATE` | `replace` |
| Social security and insurance numbers | `social-security-numbers` | `SOCIAL_SECURITY` | `replace` |
| Birth dates, URLs | `birth-dates`, `urls` | `DATE_OF_BIRTH`, `URL` | `replace` |
| Free text (notes, messages, comments) | `text` | `FREE_TEXT` | `replace` |
| JSON, serialized, and other mixed-content columns | `mixed-content` | `MIXED_CONTENT` | `replace` |
| Card numbers, CVVs, eCheck routing numbers | `cards`, `card-codes`, `routing-numbers` | `CREDIT_CARD`, `CVV`, `ROUTING_NUMBER_US` | `redact` |
| Password hashes | `passwords` | `PASSWORD_HASH` | `redact` |
| Plaintext passwords, PINs, enrolment keys | `plaintext-passwords` | `PASSWORD` | `redact` |
| Session, remember-me, reset, invite, and share tokens; opt-in, voucher, and gift card codes | `tokens` | `AUTH_TOKEN` | `redact` |
| TOTP seeds, backup and one-time codes | `otp-secrets` | `OTP_SECRET` | `redact` |
| API keys, OAuth tokens, client and webhook secrets, ciphertext, salts | `secrets` | `API_KEY` | `redact` |
| Payment provider references | `payment-tokens` | `PAYMENT_TOKEN` | `redact` |
| Push endpoints | `push-endpoints` | `URL` | `redact` |
| Private keys | `private-keys` | `PRIVATE_KEY` | `redact` |
| Mixed-content columns that hold credentials (settings, sessions, headers) | `mixed-content-secrets` | `MIXED_CONTENT` | `redact` |

A login that is always an e-mail address goes in `emails`, so it gets the same token as the address elsewhere. Entities only label: a ruled column is rewritten whatever its values look like, and a query that combines columns of different entities in one output column is refused. Data no recognizer detects gets a [rule-only](/privacy/data-types#rule-only) entity, so it never shares a token with a detected type. Titles, gender, country and region codes, locale, and timestamps stay unruled.

Rule names are generic, so a template's rules clash with your own rules of the same name, and with another template's: merge their `columns` lists instead of pasting a second `emails:`. Two templates for one database can also rule the same column, which stops startup as a repeat: Mastodon is built on Devise, so its template already holds the Devise columns of `users`; paste only one of them.

### Table prefixes

Templates use the table names of an unprefixed installation. Keys take no wildcards, so if your installation prefixes its tables (WordPress `wp_`, Moodle `mdl_`, PrestaShop `ps_`), prepend the prefix to every table: `users.user_email` becomes `wp_users.user_email`. Each page says whether and where the application sets one.

### Schemas and names

Short keys name the `public` schema on PostgreSQL and `main` on SQLite; for another schema, write `<schema>.<table>.<column>`. Keys compare case-insensitively and need no quotes, but the assistant's SQL must quote reserved table names (`"user"`, `` `order` ``) and, on MySQL on Linux, use the stored case. A query through a view gets its base columns' rules.

## Trade-offs

- **No lookups by ruled values.** A ruled column cannot appear in `WHERE`, `JOIN`, `GROUP BY`, or `ORDER BY` ([Where a ruled column may appear](/privacy/rules#where-a-ruled-column-may-appear)), so "find the customer with this e-mail" stops working. Find rows by id and join on the keys each page lists as unruled.
- **Indexed columns.** Without `ORDER BY`, rows may come back in the order of an index on a ruled column, the [row-order](/privacy/rules#residual-risks) residual risk. Each page names the indexed columns it rules.
- **Writes.** `hash`-ruled columns refuse most writes ([Writes](/privacy/rules#writes)). Templates are meant for read-only use.

## Mixed-content columns

JSON, serialized, EAV, and `meta_value` columns mix personal data with everything else. A rule covers a column whole, so ruling one hides its harmless content too. Templates rule them in the `mixed-content` rule at the end, under an `# Optional: mixed-content columns` comment; delete it to keep the columns readable. Settings, session, and configuration columns that hold passwords and API keys sit in `mixed-content-secrets` (`redact`) beside it: keep that one, or its secrets come back readable. Under the `full` [mode](/privacy#modes), global detection still scans unruled columns for e-mail addresses, IBANs, and other patterns.

## Checking the keys

After pasting, compare every key with `objects` output (`detail: "full"` lists the columns). Startup catches repeats, a missing `database.name`, and a wrong catalog segment, but not a column that does not exist.

## Applications

- [Chatwoot](/templates/chatwoot)
- [Devise (Rails)](/templates/devise)
- [Discourse](/templates/discourse)
- [Django](/templates/django)
- [Drupal](/templates/drupal)
- [Ghost](/templates/ghost)
- [Gitea / Forgejo](/templates/gitea)
- [JTL-Shop](/templates/jtl-shop)
- [Keycloak](/templates/keycloak)
- [Magento](/templates/magento)
- [Mastodon](/templates/mastodon)
- [Matomo](/templates/matomo)
- [Mattermost](/templates/mattermost)
- [Mautic](/templates/mautic)
- [Moodle](/templates/moodle)
- [Odoo](/templates/odoo)
- [OpenCart](/templates/opencart)
- [OroCommerce](/templates/orocommerce)
- [OXID eShop](/templates/oxid)
- [PrestaShop](/templates/prestashop)
- [Saleor](/templates/saleor)
- [Shopware](/templates/shopware)
- [Spryker](/templates/spryker)
- [Supabase Auth](/templates/supabase-auth)
- [Sylius](/templates/sylius)
- [TYPO3](/templates/typo3)
- [WooCommerce](/templates/woocommerce)