aido-onyx/README.md
NaeemDosh bbd9835558 Fix remaining branding leaks: error-page logo/links + notification bell
Follow-up to client testing on the flattened (sparse-checkout) structure.

- icons.tsx: swap inline OnyxLogoTypeIcon SVG (error/health pages, craft) for
  the AIDO wordmark asset, via a new template + anchored, idempotent patch.
- Notification bell content is backend-generated (official image, not rebuilt),
  so rebrand it at render time: generate lib/branding-runtime.ts from config and
  route the notifications hook through it — sanitize 'Onyx'->brand and suppress
  upstream/EE product notices (permissions-migration announcement, license/trial).
- Repoint hardcoded Onyx links/emails: Discord, support@onyx.app, '@onyx.app
  administrators' (WebResultIcon hostname logic intentionally left untouched).
- .gitignore: ignore generated /web/, /data/, .onyx-sparse-tmp/ so 'make setup'
  output can't be committed accidentally.
- README + verify updated for the new touchpoints.

Verified in the flattened layout: branded web image builds, 0 stray 'Onyx',
and bundle greps confirm all leaks gone.
2026-06-29 22:57:50 +05:00

200 lines
9.5 KiB
Markdown

# AIDO — Onyx Community Edition White-Label (Livtec AG)
A clean, upgrade-friendly white-label of [Onyx](https://github.com/onyx-dot-app/onyx)
**Community Edition**. The logo, product name (**AIDO**), favicon, documentation
links and every user-visible "Onyx" reference are rebranded — while every backend
and infrastructure service still runs the **official** Onyx Docker images.
> **Community Edition only.** This rebrands at the open-source default level. It does
> **not** enable or depend on Onyx's Enterprise white-label feature (the
> `enterprise-settings` / `ee` code paths). No commercial features are used.
---
## How it works (the approach)
Onyx bakes its branding into the **web frontend build** — the name is a hardcoded
`|| "Onyx"` fallback, the logo is an inline SVG React component, and ~180 UI strings
are compiled into the JS bundle. Pure runtime injection (env vars / volume mounts)
therefore can't fully rebrand it. So we use a **thin-overlay** model:
```
┌─────────────────────────────────────────────────────────────────────┐
│ branding/branding.config.json ← single source of truth (you edit) │
│ │ │
│ ▼ node branding/apply-branding.mjs │
│ onyx/web ← branding baked in (logo, favicon, name, links) │
│ │ │
│ ▼ docker compose build web_server │
│ livtec/aido-web:local ← the ONLY image we build │
└─────────────────────────────────────────────────────────────────────┘
backend · model-server · code-interpreter · postgres · redis ·
opensearch · minio · nginx → ALL pulled from official images
```
Because everything except the web image comes straight from upstream, taking a new
Onyx release is a re-checkout + re-run, not a fork to maintain (see
[Upgrading Onyx](#upgrading-onyx)).
---
## Layout
| Path | Purpose |
|------|---------|
| `branding/branding.config.json` | **Single source of truth** — name, assets, links, emails, rename rules. |
| `branding/apply-branding.mjs` | Applies the overlay into `onyx/web` (fetch assets, swap logos, repoint favicon, codemod strings). |
| `branding/templates/` | Logo React components (filled from the config at apply time). |
| `branding/assets/` | Offline fallback copies of the fetched brand images. |
| `docker-compose.branding.yml` | Thin override: build **only** `web_server` from `./onyx/web`, pull the rest. |
| `Makefile` | `make rebrand` / `apply` / `build` / `up` / `down` / `verify`. |
| `.env.example`, `.env.nginx.example` | Deployment env templates (Onyx's standard vars — **not** branding). |
| `onyx/` | Upstream Onyx checkout (pinned — see `branding.config.json → upstream`). |
---
## Quick start
```bash
# 0a. one-time: fetch the upstream Onyx checkout at the pinned commit
make setup
# 0b. one-time: copy the env templates and set real secrets
cp .env.example .env
cp .env.nginx.example .env.nginx
# edit .env → set MINIO_ROOT_PASSWORD / S3_AWS_SECRET_ACCESS_KEY, AUTH_TYPE, WEB_DOMAIN
# (for the no-letsencrypt profile, also place TLS certs — see .env.nginx.example)
# 1. apply branding, build the branded web image, start the whole stack
make rebrand
# …or step by step:
make apply # bake branding into ./onyx/web
make build # build livtec/aido-web:local
make up # start the stack (web branded, everything else official)
make logs # follow the web container
make verify # assert no stray "Onyx" remains in the shipping source
make down # stop
```
Requires Docker + Docker Compose v2 and Node ≥ 18 (for the apply script). The app is
served via nginx on ports 80/443.
---
## Updating the branding
Everything is driven by **`branding/branding.config.json`** — you never hand-edit
files under `onyx/`.
| To change… | Edit in `branding.config.json` |
|------------|--------------------------------|
| Product name | `brand.name` |
| Logo / wordmark / favicon | `assets.*.url` (remote) — fetched on next `apply`. Or drop files in `branding/assets/` and run with `--no-fetch`. |
| Documentation / help / legal links | `links.*` and `rename.literals` |
| A specific phrase swap | `rename.literals` (exact string) |
| The global name swap | `rename.word` (whole-word, case-sensitive) |
Then:
```bash
make apply && make build && make restart
```
The codemod is **surgical**: it replaces whole-word, capitalised `Onyx` only — it
never touches code identifiers (`OnyxDocument`, `SvgOnyxLogo`, `OnyxBot`), lowercase
package refs (`@onyx/…`, `onyx.app`, `onyx.ico`), tests or stories. `make verify`
confirms the result.
### Swapping assets without network access
The apply script fetches the asset URLs and also caches them into `branding/assets/`.
If you're offline, run `node branding/apply-branding.mjs --no-fetch` and it uses those
cached files. To use brand-new files, drop them into `branding/assets/` (matching the
`dest` basenames: `mark.png`, `wordmark.png`, `favicon.png`) and run `--no-fetch`.
> The AIDO wordmark already contains the symbol, so the composed "logo + wordmark"
> component renders the wordmark **only** to avoid a duplicated mark. If you supply a
> text-less wordmark later, restore the upstream composition in
> `branding/templates/onyx-logo-typed.tsx`.
---
## Upgrading Onyx
Because we don't fork, upgrading is mechanical:
```bash
# 1. check out the new upstream release into ./onyx
cd onyx
git fetch --all --tags
git checkout <new-tag-or-commit> # e.g. a tagged release
cd ..
# 2. bump the pin in branding/branding.config.json → upstream.pinnedCommit
# 3. re-apply + rebuild
make apply && make build && make restart
# 4. sanity check
make verify
```
Pin **`IMAGE_TAG`** in `.env` to the **same** release so the official backend/model
images match the web build you're compiling. Two things to watch after an upgrade:
1. **Logo component paths** — if upstream moves the logo files, `make apply` prints a
`logo target missing` warning. Update the paths in `apply-branding.mjs → logoInstalls`.
2. **New unbranded strings** — if upstream adds new "Onyx" copy, the global word rule
catches it automatically; review `make verify` output and the apply summary.
---
## What gets rebranded (touchpoints)
- **Product name** — the `|| "Onyx"` resolution fallbacks (`settings/hooks.ts`,
`settings/lib.ts`) → `AIDO`; this also drives the browser tab title.
- **All UI strings** — ~180 user-visible "Onyx" references across ~96 files
(chat, onboarding, admin panels, modals, auth screen, error pages…).
- **Logo** — the in-app symbol + wordmark components (incl. the inline
`OnyxLogoTypeIcon` used on the error/health pages) render the AIDO assets.
- **Favicon** — `public/onyx.ico` replaced and `DynamicMetadata` repointed to
`/branding/favicon.png`.
- **Documentation & community links** — `DOCS_BASE_URL` / `docs.onyx.app`, the Onyx
Discord URL, `www.onyx.app` links and `support@onyx.app` → Livtec destinations
(see `rename.literals`).
- **Notification bell** — its text is generated by the **backend** (the official
image we don't rebuild), so it's rebranded at render time in the web image:
any "Onyx" in a notification is rewritten to the brand name, and upstream/EE
product notifications (permissions-migration announcement, license/trial warnings)
are suppressed. See [Notifications](#notifications) below.
### Notifications
Driven by `branding.config.json → notifications`:
| Key | Effect |
|-----|--------|
| `sanitize: true` | Rewrites "Onyx" → brand name in any notification title/description at render time. |
| `suppressTypes: [...]` | Hides whole categories (`feature_announcement`, `release_notes`, `license_expiry_warning`, `two_day_trial_ending`). Empty the list to show everything (still sanitized). |
Operational notifications (reindex, approvals, connector errors, scheduled tasks)
are always kept. The apply script generates `web/src/lib/branding-runtime.ts` from
these values and routes the notifications hook through it.
> Minor note: suppression hides items from the **panel**; the bell's unread *count*
> comes from a separate backend summary endpoint, so a suppressed-but-unread item can
> still nudge the counter. If you'd rather keep perfect counts, set `suppressTypes: []`
> — sanitization alone removes the "Onyx" wording with no count impact.
### Known limitations / notes
- **Deep doc paths** (e.g. `/admins`, `/deployment/...`) consolidate onto the single
Livtec help URL you provided; sub-pages won't exist there unless you publish them.
- **Theme colors** from the old Lobe config are **not** applied (they were outside the
agreed logo/name/favicon/links scope and Onyx's theming differs). The AIDO logo
already carries the brand colors. Color theming can be added as a follow-up.
- **Tests / stories** intentionally keep the literal "Onyx" (they assert the upstream
default). They are excluded from the production Docker build, so this is harmless.
- **Backend/API** identifiers, cookies (`onyx_tid`) and internal names are unchanged —
they are not user-visible and renaming them would risk breaking the official images.