The horizon-api Pusher publisher, the lazily-loaded server client, and the best-effort degradation model.
Components
Component
Path
Lazy client + channel helpers
lib/integration/pusher/pusher.client.ts
Publisher (single trigger)
lib/integration/pusher/pusher.publisher.ts
Event contract types
lib/integration/pusher/pusher.types.ts
Private-channel authorizer
app/api/v3/realtime/pusher/auth/route.ts
Shared React hook
@bbrandslab/ui → hooks/use-pusher-channel.ts
Lazy server client
The pusher server SDK is imported lazily inside getPusherClient(). The
dependency stays out of the bundle until the four required environment
variables are present, so requests that never touch realtime remain
lightweight. The client is memoised per process.
const client = await getPusherClient();if (!client) { // No credentials → log-only no-op. The business flow continues. return;}await client.trigger(channels, event, data);
getPusherClient() returns null unless INTEGRATION_PUSHER_APP_ID,
INTEGRATION_PUSHER_KEY, INTEGRATION_PUSHER_SECRET and
INTEGRATION_PUSHER_CLUSTER are all set.
Best-effort publisher
publishContractEvent() is the single point that calls trigger. It swallows
its own failures with structured logging: a failed publish never breaks the
worker, webhook or admin action that produced it.A single event is fanned out to both the contract channel and the account
channel, so account-scoped and contract-scoped listeners receive the same
message.
Health accounting
Only a 5xx or a network error counts against Pusher’s health verdict. A
4xx means our request was malformed (our bug), not that Pusher is down, so it
never flips the integration state. See Operations for
the health probe.
Was this page helpful?
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"B Brands Docs","colors":{"primary":"#0D5993","light":"#0789C9","dark":"#0D5993"},"logo":{"light":"https://mintcdn.com/bbrands/1xnT5Vb9hIIJ3k79/logo/bbrands-lab-light.svg?fit=max\u0026auto=format\u0026n=1xnT5Vb9hIIJ3k79\u0026q=85\u0026s=88608895ccbfda54985581ee6e49b55f","dark":"https://mintcdn.com/bbrands/1xnT5Vb9hIIJ3k79/logo/bbrands-lab-dark.svg?fit=max\u0026auto=format\u0026n=1xnT5Vb9hIIJ3k79\u0026q=85\u0026s=2ec709f45e98d62d6cc6a8e23a735c5d"},"favicon":"https://mintcdn.com/bbrands/SChHqGy4T8DLbxhI/favicon.svg?fit=max\u0026auto=format\u0026n=SChHqGy4T8DLbxhI\u0026q=85\u0026s=3364f2bbd048ffc2d9ba3f4ec3de1d4f","api":{"openapi":["api-reference/maihue/lead/openapi.yaml","api-reference/auth/auth/register-migration-openapi.yaml","api-reference/auth/auth/verify-email-openapi.yaml","api-reference/webhook/openapi.yaml","api-reference/permission/api-key/openapi.yaml","api-reference/notification/notification/openapi.yaml","api-reference/notification/notification/read-openapi.yaml","api-reference/notification/inbox/openapi.yaml","api-reference/notification/onesignal-webhook/openapi.yaml","api-reference/maihue/onboarding/openapi.yaml","api-reference/maihue/onboarding/portal-openapi.yaml","api-reference/maihue/form/openapi.yaml","api-reference/maihue/form-answer/openapi.yaml","api-reference/maihue/form-question/openapi.yaml","api-reference/maihue/form-workflow/openapi.yaml","api-reference/maihue/form-workflow-step/openapi.yaml","api-reference/maihue/lead-answer/openapi.yaml","api-reference/permission/api-key-permission/openapi.yaml","api-reference/notification/preference/openapi.yaml","api-reference/notification/platform/openapi.yaml","api-reference/notification/platform/metric-openapi.yaml","api-reference/notification/template-version/openapi.yaml"]},"navbar":{"links":[{"href":"mailto:developers@bbrands.io","label":"Support"}],"primary":{"type":"button","label":"B Brands Lab","href":"https://www.bbrands.io"}},"footer":{"socials":{"github":"https://github.com/bbrandslab","website":"https://www.bbrands.io"}},"styling":{"latex":false},"navigation":{"languages":[{"language":"en","default":true,"href":"introduction"},{"language":"es","href":"es/introduction"}]}},"deployment":{"deploymentMetadataValue":{"subdomain":"bbrands","hasAudioNarration":false,"actualSubdomain":"bbrands","customDomains":["docs.bbrands.io"],"gitSource":{"type":"github","owner":"bbrandslab","repo":"bbrands-monorepo","deployBranch":"develop","contentDirectory":"backend/horizon-docs","isPrivate":true,"mountPath":"","label":""},"feedback":{"issues":false,"thumbs":true},"entitlements":{},"buildId":"6b08c32dc560574c778c9718","clientVersion":"0.0.4340","searchFilterCounts":[{"language":"default","tag":"Schemas","count":482},{"language":"default","tag":"API Reference","count":274},{"language":"en","tag":"Horizon Enterprise","count":185},{"language":"es","tag":"Horizon Enterprise","count":185},{"language":"en","tag":"Notifications","count":156},{"language":"es","tag":"Notificaciones","count":156},{"language":"default","tag":"General","count":101},{"language":"default","tag":"Maihue","count":97},{"language":"en","tag":"Events","count":95},{"language":"es","tag":"Eventos","count":95},{"language":"en","tag":"Notification","count":73},{"language":"default","tag":"Account","count":63},{"language":"en","tag":"API Reference","count":61},{"language":"en","tag":"Documentation","count":55},{"language":"es","tag":"Documentación","count":55},{"language":"default","tag":"Product","count":54},{"language":"default","tag":"Webhook","count":49},{"language":"default","tag":"MaihueStreet","count":48},{"language":"en","tag":"Customer portal","count":47},{"language":"es","tag":"Portal de clientes","count":47},{"language":"default","tag":"Code","count":43},{"language":"default","tag":"Permission","count":32},{"language":"es","tag":"Acceso","count":26},{"language":"es","tag":"Primeros pasos","count":21},{"language":"en","tag":"Catalog and templates","count":20},{"language":"es","tag":"Catálogo y plantillas","count":20},{"language":"en","tag":"BBrands Lab","count":19},{"language":"en","tag":"MaihueGo","count":19},{"language":"es","tag":"BBrands Lab","count":19},{"language":"es","tag":"MaihueGo","count":19}]},"assistantConfig":{},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-rbac-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"site-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"starter-pricing","enabled":true,"variant":{"name":"control","enabled":true,"payload":{"type":"string","value":"control"},"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"wildcard-email-auth","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"starterQuestions":[],"googleFontsInlined":false},"customCss":[{"filePath":"style.css","content":"#navbar a img{height:3rem!important}.wave-status{align-items:baseline;border:1px solid;border-radius:0.75rem;display:flex;flex-wrap:wrap;font-size:0.875rem;gap:0.25rem 0.5rem;line-height:1.5;margin:0.75rem 0;padding:0.5rem 0.75rem}.wave-status a{border-bottom:0;color:inherit;font-weight:600;text-decoration:none}.wave-status a:hover{text-decoration:underline}.wave-status--active{background:#ecfdf5;border-color:rgb(16 185 129 / 0.35);color:#064e3b}.wave-status--planned{background:#fffbeb;border-color:rgb(245 158 11 / 0.35);color:#78350f}.dark .wave-status--active{background:rgb(16 185 129 / 0.1);color:#a7f3d0}.dark .wave-status--planned{background:rgb(245 158 11 / 0.1);color:#fde68a}"}]}
{"page":{"pagePath":"realtime/architecture","slug":"/realtime/architecture","pageMetadata":{"title":"Architecture","description":"The horizon-api Pusher publisher, the lazily-loaded server client, and the best-effort degradation model.","href":"/realtime/architecture"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"The horizon-api Pusher publisher, the lazily-loaded server client, and the best-effort degradation model.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,tbody:`tbody`,td:`td`,th:`th`,thead:`thead`,tr:`tr`,..._provideComponents(),...props.components},{CodeBlock,Heading,Mermaid,Note,Table}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Mermaid)_missingMdxReference(`Mermaid`,true);if(!Note)_missingMdxReference(`Note`,true);if(!Table)_missingMdxReference(`Table`,true);return _jsxs(_Fragment,{children:[_jsx(Heading,{level:`2`,id:`components`,children:`Components`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Component`}),_jsx(_components.th,{children:`Path`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Lazy client + channel helpers`}),_jsx(_components.td,{children:_jsx(_components.code,{children:`lib/integration/pusher/pusher.client.ts`})})]}),_jsxs(_components.tr,{children:[_jsxs(_components.td,{children:[`Publisher (single `,_jsx(_components.code,{children:`trigger`}),`)`]}),_jsx(_components.td,{children:_jsx(_components.code,{children:`lib/integration/pusher/pusher.publisher.ts`})})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Event contract types`}),_jsx(_components.td,{children:_jsx(_components.code,{children:`lib/integration/pusher/pusher.types.ts`})})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Private-channel authorizer`}),_jsx(_components.td,{children:_jsx(_components.code,{children:`app/api/v3/realtime/pusher/auth/route.ts`})})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Shared React hook`}),_jsxs(_components.td,{children:[_jsx(_components.code,{children:`@bbrandslab/ui`}),` → `,_jsx(_components.code,{children:`hooks/use-pusher-channel.ts`})]})]})]})]}),`\n`,_jsx(Heading,{level:`2`,id:`lazy-server-client`,children:`Lazy server client`}),`\n`,_jsxs(_components.p,{children:[`The `,_jsx(_components.code,{children:`pusher`}),` server SDK is imported `,_jsx(_components.strong,{children:`lazily`}),` inside `,_jsx(_components.code,{children:`getPusherClient()`}),`. The\ndependency stays out of the bundle until the four required environment\nvariables are present, so requests that never touch realtime remain\nlightweight. The client is memoised per process.`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`6`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`6`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` client`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` getPusherClient`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`();`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`!`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`client`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) {`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // No credentials → log-only no-op. The business flow continues.`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` client`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`trigger`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`channels`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`event`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`data`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`]})})}),`\n`,_jsx(Note,{children:_jsxs(_components.p,{children:[_jsx(_components.code,{children:`getPusherClient()`}),` returns `,_jsx(_components.code,{children:`null`}),` unless `,_jsx(_components.code,{children:`INTEGRATION_PUSHER_APP_ID`}),`,\n`,_jsx(_components.code,{children:`INTEGRATION_PUSHER_KEY`}),`, `,_jsx(_components.code,{children:`INTEGRATION_PUSHER_SECRET`}),` and\n`,_jsx(_components.code,{children:`INTEGRATION_PUSHER_CLUSTER`}),` are all set.`]})}),`\n`,_jsx(Heading,{level:`2`,id:`best-effort-publisher`,children:`Best-effort publisher`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`publishContractEvent()`}),` is the single point that calls `,_jsx(_components.code,{children:`trigger`}),`. It swallows\nits own failures with structured logging: a failed publish never breaks the\nworker, webhook or admin action that produced it.`]}),`\n`,_jsx(Mermaid,{chart:`flowchart TD\n call[\"publishContractEvent(payload)\"] --> get{\"getPusherClient()\"}\n get -- null --> noop[\"Log info + return (no-op)\"]\n get -- client --> trigger[\"client.trigger([contract, account], event, data)\"]\n trigger -- ok --> health_ok[\"recordIntegrationOutcome('pusher', true)\"]\n trigger -- throws --> classify{\"5xx / network?\"}\n classify -- yes --> health_down[\"recordIntegrationOutcome('pusher', false)\"]\n classify -- no (4xx) --> health_ok2[\"recordIntegrationOutcome('pusher', true)\"]\n trigger -. warn log .-> log[\"Structured warn (non-fatal)\"]`}),`\n`,_jsxs(_components.p,{children:[`A single event is fanned out to `,_jsx(_components.strong,{children:`both`}),` the contract channel and the account\nchannel, so account-scoped and contract-scoped listeners receive the same\nmessage.`]}),`\n`,_jsx(Heading,{level:`2`,id:`health-accounting`,children:`Health accounting`}),`\n`,_jsxs(_components.p,{children:[`Only a `,_jsx(_components.strong,{children:`5xx or a network error`}),` counts against Pusher’s health verdict. A\n`,_jsx(_components.code,{children:`4xx`}),` means our request was malformed (our bug), not that Pusher is down, so it\nnever flips the integration state. See `,_jsx(_components.a,{href:`/realtime/operations`,children:`Operations`}),` for\nthe health probe.`]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Architecture","description":"The horizon-api Pusher publisher, the lazily-loaded server client, and the best-effort degradation model.","href":"/realtime/architecture"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Components","slug":"components","depth":2,"children":[]},{"title":"Lazy server client","slug":"lazy-server-client","depth":2,"children":[]},{"title":"Best-effort publisher","slug":"best-effort-publisher","depth":2,"children":[]},{"title":"Health accounting","slug":"health-accounting","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"subdomain":"bbrands","siteName":"B Brands Docs","title":"Architecture - B Brands Docs","contextualStarterQuestions":[],"navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{"en":{"href":"/realtime/architecture","matchLevel":0},"es":{"href":"/es/realtime/architecture","matchLevel":1}}},"lastModified":"2026-11-12T15:19:03.160Z","originalFileLocation":"realtime/architecture.mdx","locale":"en"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"The horizon-api Pusher publisher, the lazily-loaded server client, and the best-effort degradation model.\">\u003cmeta data-mint-head name=\"application-name\" content=\"B Brands Docs\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/bbrands/goeZ5nRzsRLDEX7Z/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/bbrands/goeZ5nRzsRLDEX7Z/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/bbrands/goeZ5nRzsRLDEX7Z/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/bbrands/goeZ5nRzsRLDEX7Z/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/bbrands/goeZ5nRzsRLDEX7Z/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/bbrands/goeZ5nRzsRLDEX7Z/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/bbrands/goeZ5nRzsRLDEX7Z/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/bbrands/goeZ5nRzsRLDEX7Z/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/bbrands/goeZ5nRzsRLDEX7Z/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Architecture - B Brands Docs\">\u003cmeta data-mint-head property=\"og:description\" content=\"The horizon-api Pusher publisher, the lazily-loaded server client, and the best-effort degradation model.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"B Brands Docs\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.bbrands.io/realtime/architecture\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://bbrands.mintlify.site/_mintlify/api/og/v2?division=Realtime+%28Pusher%29\u0026amp;title=Architecture\u0026amp;description=The+horizon-api+Pusher+publisher%2C+the+lazily-loaded+server+client%2C+and+the+best-effort+degradation+model.\u0026amp;theme=ca80d8eeacb4ae4ba51dbf1e\u0026amp;signature=ce87d0cff943ea3821eea01930212ba25d49cc9fe91ae04f751543ad8b7f0e68\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Architecture - B Brands Docs\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"The horizon-api Pusher publisher, the lazily-loaded server client, and the best-effort degradation model.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://bbrands.mintlify.site/_mintlify/api/og/v2?division=Realtime+%28Pusher%29\u0026amp;title=Architecture\u0026amp;description=The+horizon-api+Pusher+publisher%2C+the+lazily-loaded+server+client%2C+and+the+best-effort+degradation+model.\u0026amp;theme=ca80d8eeacb4ae4ba51dbf1e\u0026amp;signature=ce87d0cff943ea3821eea01930212ba25d49cc9fe91ae04f751543ad8b7f0e68\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/bbrands/goeZ5nRzsRLDEX7Z/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"B Brands Docs\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#0D5993\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.bbrands.io/realtime/architecture\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/realtime/architecture.md\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"en\" href=\"https://docs.bbrands.io/realtime/architecture\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"es\" href=\"https://docs.bbrands.io/es/realtime/architecture\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"x-default\" href=\"https://docs.bbrands.io/realtime/architecture\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.bbrands.io/#organization\",\"name\":\"B Brands Docs\",\"url\":\"https://docs.bbrands.io\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/bbrands/1xnT5Vb9hIIJ3k79/logo/bbrands-lab-light.svg?fit=max\u0026auto=format\u0026n=1xnT5Vb9hIIJ3k79\u0026q=85\u0026s=88608895ccbfda54985581ee6e49b55f\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.bbrands.io#website\",\"name\":\"B Brands Docs\",\"url\":\"https://docs.bbrands.io\",\"publisher\":{\"@id\":\"https://docs.bbrands.io/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.bbrands.io/realtime/architecture#webpage\",\"url\":\"https://docs.bbrands.io/realtime/architecture\",\"name\":\"Architecture\",\"description\":\"The horizon-api Pusher publisher, the lazily-loaded server client, and the best-effort degradation model.\",\"dateModified\":\"2026-11-12T15:19:03.160Z\",\"isPartOf\":{\"@id\":\"https://docs.bbrands.io#website\"},\"breadcrumb\":{\"@id\":\"https://docs.bbrands.io/realtime/architecture#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.bbrands.io/realtime/architecture#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Realtime (Pusher)\",\"item\":\"https://docs.bbrands.io/realtime/introduction\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Architecture\",\"item\":\"https://docs.bbrands.io/realtime/architecture\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.bbrands.io/realtime/architecture#article\",\"headline\":\"Architecture\",\"name\":\"Architecture\",\"description\":\"The horizon-api Pusher publisher, the lazily-loaded server client, and the best-effort degradation model.\",\"url\":\"https://docs.bbrands.io/realtime/architecture\",\"mainEntityOfPage\":{\"@id\":\"https://docs.bbrands.io/realtime/architecture#webpage\"},\"dateModified\":\"2026-11-12T15:19:03.160Z\",\"publisher\":{\"@id\":\"https://docs.bbrands.io/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.bbrands.io#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"B Brands Docs\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"B Brands Docs\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/realtime/architecture.md","siteName":"B Brands Docs","nav":{"global":null,"languages":[{"language":"en","default":true,"tabs":[{"tab":"Documentation","groups":[{"group":"Get Started","pages":[{"title":"Introduction","href":"/introduction"},{"title":"Quickstart","href":"/quickstart"},{"title":"Development","href":"/development"}]},{"group":"API Documentation","pages":[{"title":"Introduction","href":"/documentation/introduction"},{"title":"Headers and body","href":"/documentation/headers"},{"title":"Response codes","href":"/documentation/response-codes"},{"title":"Catalog of errors","href":"/documentation/errors"}]},{"group":"OAuth \u0026 Identity (IdP)","pages":[{"title":"OAuth \u0026 Identity (IdP)","href":"/oauth/introduction"},{"title":"Architecture","href":"/oauth/architecture"},{"title":"Flows","href":"/oauth/flows"},{"title":"OAuth / OIDC Endpoints","href":"/oauth/endpoints"},{"title":"Token Exchange","href":"/oauth/token-exchange"},{"title":"Data Model \u0026 Lifecycle","href":"/oauth/data-model"},{"title":"Security \u0026 Governance","href":"/oauth/security"},{"title":"Client Integration","href":"/oauth/client-integration"},{"title":"Social Login \u0026 Internal SSO","href":"/oauth/social-login"}]},{"group":"Monitoring \u0026 Infrastructure","pages":[{"title":"Monitoring \u0026 Status Pages","href":"/monitoring/introduction"},{"title":"Health Architecture","href":"/monitoring/architecture"},{"title":"Infrastructure as Code (Terraform)","href":"/monitoring/terraform"},{"title":"CI/CD for Monitoring","href":"/monitoring/github-actions"},{"title":"Operations Runbook","href":"/monitoring/runbook"}]},{"group":"Realtime (Pusher)","pages":[{"title":"Realtime (Pusher)","description":"How B Brands delivers realtime events over Pusher Channels: best-effort domain events published by horizon-api and consumed by the frontends through a single shared hook.","href":"/realtime/introduction"},{"title":"Architecture","href":"/realtime/architecture"},{"title":"Channels \u0026 Events","description":"Pusher channel naming, the contract event contract, the channel authorization endpoint and presence webhooks.","href":"/realtime/channels-and-events"},{"title":"Client Integration","href":"/realtime/client-integration"},{"title":"Operations","href":"/realtime/operations"}]},{"group":"Webhooks (Outbound)","pages":[{"title":"Outbound webhooks","href":"/webhooks/introduction"},{"title":"Architecture","href":"/webhooks/architecture"},{"title":"Event catalogue","href":"/webhooks/event-catalogue"},{"title":"Subscriptions","href":"/webhooks/subscriptions"},{"title":"Delivery and signature","href":"/webhooks/delivery-and-signature"},{"title":"Retries and failures","href":"/webhooks/retries-and-failures"},{"title":"Operations","href":"/webhooks/operations"}]},{"group":"Digital contracting","pages":[{"title":"Digital contracting","href":"/digital-contracting/introduction"},{"title":"Architecture","href":"/digital-contracting/architecture"},{"title":"Flows","href":"/digital-contracting/flows"},{"title":"Session and access","href":"/digital-contracting/session-and-access"},{"title":"Identity","href":"/digital-contracting/identity"},{"title":"Payment method","href":"/digital-contracting/payment"},{"title":"Signing","href":"/digital-contracting/signing"},{"title":"Client integration","href":"/digital-contracting/client-integration"},{"title":"Endpoints","href":"/digital-contracting/endpoints"},{"title":"Data model","href":"/digital-contracting/data-model"},{"title":"Operations","href":"/digital-contracting/operations"},{"title":"Security","href":"/digital-contracting/security"}]},{"group":"Signature engine (MaihueSigner)","pages":[{"title":"Signature engine (MaihueSigner)","href":"/signature-engine/introduction"},{"title":"Architecture","href":"/signature-engine/architecture"},{"title":"History","href":"/signature-engine/history"},{"title":"Workflows","href":"/signature-engine/workflows"},{"title":"Signing flow","href":"/signature-engine/signing-flow"},{"title":"Evidence and sealing","href":"/signature-engine/evidence-and-sealing"},{"title":"Consumer integration","href":"/signature-engine/consumer-integration"},{"title":"Operations","href":"/signature-engine/operations"}]},{"group":"Integrations","pages":[{"title":"Odoo: customer onboarding","href":"/integrations/odoo-onboarding"},{"title":"LibreDTE routes: migration to the mirror API","href":"/integrations/libredte-migration"}]}]},{"tab":"Horizon Enterprise","pages":[{"title":"Horizon Enterprise","href":"/enterprise/getting-started/introduction"}]},{"tab":"BBrands Lab","pages":[{"title":"BBrands Lab","href":"/bbrands-lab/introduction"}]},{"tab":"API Reference","pages":[{"title":"API Reference","href":"/api-reference/account/account/find-all"}]},{"tab":"Schemas","pages":[{"title":"Schemas","href":"/schemas/account/account"}]},{"tab":"Changelog","pages":[{"title":"Changelog","href":"/changelog/outbound-webhooks"}]},{"tab":"MaihueGo","pages":[{"title":"MaihueGo","href":"/maihuego/introduction"}]},{"tab":"Customer portal","pages":[{"title":"Customer portal","href":"/portal-customer/introduction"}]}]},{"language":"es","pages":[{"title":"es","href":"/es/realtime/architecture"}]}]},"basePath":"","title":"Architecture - B Brands Docs","deploymentId":"dpl_EtLmMeZHkKGqAjV1DiX4ZXCriDj3","buildId":"dpl_EtLmMeZHkKGqAjV1DiX4ZXCriDj3","dynamics":[],"chunks":[]}