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

# Optional Integrations for Your OneRep Self-Hosted App

> Enable AI coaching, email, Google sign-in, OIDC, and analytics by setting backend environment variables. Every integration stays off without its variables.

Every integration in OneRep is strictly opt-in. Features stay quiet without their variables — a fresh install with no extras configured is a fully usable fitness app. When you are ready to add a capability, set the relevant variables on your Convex backend from the repository root:

```sh theme={null}
bunx convex env set NAME VALUE
```

None of these variables are ever exposed to the client bundle. They live server-side in your Convex deployment.

<Accordion title="AI Coach & Photo Logging">
  The AI Coach handles text, image, and voice input; generates personalized briefings and recipes; makes reversible changes to workouts and nutrition; and drives the photo food-logging flow that detects food in an image and matches detections to database records before logging anything.

  Without an API key, the Coach is absent from the UI. Users can also supply their own OpenRouter key in Settings, which bypasses the deployment's key entirely — they pay for their own inference and are not subject to any cap.

  **Variables to set:**

  | Variable             | Purpose                                                                                                       |
  | -------------------- | ------------------------------------------------------------------------------------------------------------- |
  | `OPENROUTER_API_KEY` | Your OpenRouter API key. Export it before running `./install.sh` and the installer wires it up automatically. |
  | `OPENROUTER_MODEL`   | The model identifier to use for Coach inference (e.g. a model slug from OpenRouter's catalog).                |

  ```sh theme={null}
  bunx convex env set OPENROUTER_API_KEY sk-or-...
  bunx convex env set OPENROUTER_MODEL openai/gpt-4o
  ```

  <Tip>
    Exporting `OPENROUTER_API_KEY` in your shell before running `./install.sh` is the easiest path — the installer reads it and sets the backend variable for you.
  </Tip>
</Accordion>

<Accordion title="Food Search & Barcodes">
  Food search and barcode scanning are powered by the self-hosted datasource container that the installer brings up. The two variables that connect Convex to the datasource are set automatically by the installer — you do not need to configure these manually.

  | Variable               | Purpose                                                         |
  | ---------------------- | --------------------------------------------------------------- |
  | `DATASOURCE_URL`       | Internal URL of the datasource container. Set by the installer. |
  | `DATASOURCE_API_TOKEN` | Authentication token for the datasource. Set by the installer.  |

  Which catalogs respond to searches and barcode lookups depends entirely on what you have imported. See the [Food Database](/selfhost/food-database) guide to load USDA, Open Food Facts, and the wger exercise catalog.
</Accordion>

<Accordion title="Email & Verification">
  By default, accounts work with no mail provider configured: email/password sign-up succeeds without sending a verification email and without requiring one. Enabling email adds delivery for verification messages and password resets. Without it, users who forget their password have no recovery path.

  **Variables to set:**

  | Variable                      | Purpose                                                                                    |
  | ----------------------------- | ------------------------------------------------------------------------------------------ |
  | `RESEND_API_KEY`              | API key from [Resend](https://resend.com). Required to send any email.                     |
  | `AUTH_EMAIL_FROM`             | The `From` address for outgoing email (e.g. `OneRep <noreply@your-domain.tld>`).           |
  | `EMAIL_VERIFICATION_REQUIRED` | Set to `true` to require email verification before an account can be used. Off by default. |

  ```sh theme={null}
  bunx convex env set RESEND_API_KEY re_...
  bunx convex env set AUTH_EMAIL_FROM "OneRep <noreply@your-domain.tld>"
  bunx convex env set EMAIL_VERIFICATION_REQUIRED true
  ```

  <Note>
    A mail-less install is fully functional — it is simply one where nobody can reset a forgotten password. Enable email before users rely on the install for anything important.
  </Note>
</Accordion>

<Accordion title="Google Sign-In">
  Adds a **Sign in with Google** button to the sign-in and sign-up screens. The button only renders once both variables are set.

  **Variables to set:**

  | Variable               | Purpose                                            |
  | ---------------------- | -------------------------------------------------- |
  | `GOOGLE_CLIENT_ID`     | OAuth 2.0 client ID from Google Cloud Console.     |
  | `GOOGLE_CLIENT_SECRET` | OAuth 2.0 client secret from Google Cloud Console. |

  ```sh theme={null}
  bunx convex env set GOOGLE_CLIENT_ID 123456789-....apps.googleusercontent.com
  bunx convex env set GOOGLE_CLIENT_SECRET GOCSPX-...
  ```

  When creating the OAuth client in Google Cloud Console, add the following as an authorised redirect URI — replacing the origin with your actual site origin:

  ```
  http://127.0.0.1:3211/api/auth/callback/google
  ```

  For a production install this will be your `CONVEX_SITE_ORIGIN` plus `/api/auth/callback/google`.
</Accordion>

<Accordion title="OpenID Connect Sign-In">
  Adds a single-sign-on button for any OIDC provider that supports standard discovery — Authentik, Keycloak, Pocket ID, and others all work.

  **Variables to set:**

  | Variable             | Purpose                                                                                        |
  | -------------------- | ---------------------------------------------------------------------------------------------- |
  | `OIDC_ISSUER`        | Issuer URL of your OIDC provider (must expose a `/.well-known/openid-configuration` endpoint). |
  | `OIDC_CLIENT_ID`     | Client ID registered with your OIDC provider.                                                  |
  | `OIDC_CLIENT_SECRET` | Client secret registered with your OIDC provider.                                              |
  | `OIDC_PROVIDER_NAME` | Label shown on the sign-in button. Defaults to `SSO` if not set.                               |

  ```sh theme={null}
  bunx convex env set OIDC_ISSUER https://auth.your-domain.tld/application/o/onerep/
  bunx convex env set OIDC_CLIENT_ID your-client-id
  bunx convex env set OIDC_CLIENT_SECRET your-client-secret
  bunx convex env set OIDC_PROVIDER_NAME "Sign in with Authentik"
  ```

  Register the following redirect URI with your OIDC provider — your site origin plus `/api/auth/oauth2/callback/oidc`:

  ```
  http://127.0.0.1:3211/api/auth/oauth2/callback/oidc
  ```
</Accordion>

<Accordion title="Telemetry & Analytics">
  The installer asks about telemetry once during setup. Choosing **no** means no analytics script is included in the built app — there is nothing to block or opt out of. Choosing **yes** (the default) enables Umami-based analytics.

  You can point analytics at your own self-hosted Umami instance rather than the project's by setting the Umami pair after installation.

  **Variables to set:**

  | Variable           | Purpose                                                                      |
  | ------------------ | ---------------------------------------------------------------------------- |
  | `ONEREP_TELEMETRY` | Master telemetry switch. Set by the installer based on your answer at setup. |
  | `UMAMI_SCRIPT_URL` | URL of the Umami tracking script on your own Umami instance.                 |
  | `UMAMI_WEBSITE_ID` | The website ID from your Umami dashboard.                                    |

  ```sh theme={null}
  bunx convex env set UMAMI_SCRIPT_URL https://umami.your-domain.tld/script.js
  bunx convex env set UMAMI_WEBSITE_ID xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
  ```

  <Note>
    Analytics are opt-in and off by default in the production app too. Users can verify their install's analytics status on the Settings page.
  </Note>
</Accordion>
