This fictional billing example uses customer and internal as configured audience choices. They aren't built-in Shoalrun roles, and the labels don't grant permissions. Your project can declare other choices or select a different facet.
The example keeps shared instructions and additional sections in one source page, produces two website builds, and selects an in-app export separately. It illustrates one possible configuration rather than a required deployment model.
Before you begin
Start in a project containing Shoalrun. Copy the packaged example into a working directory:
cp -R node_modules/@shoalrun/cli/examples/dual-audience-serving ./audience-demo
cd audience-demo
The example contains synthetic billing instructions. Don't replace them with real privileged information until your deployment's authentication and publishing checks are ready.
Review the audience boundaries
In this example,
base.yamldeclares the customer and internal audience choices. The shared page hasaudiences: [customer, internal]. Shared paragraphs remain outside guards, while internal additions use a visible callout:Customer-facing instructions. <ForFacet audience="internal"> <Callout type="warning"> **Company Internal Content** Privileged operational instructions. </Callout> </ForFacet>This is an authored composition of existing components. ForFacet doesn't add a label, glow, or box automatically. Unguarded text on a selected page is included. A custom project audit can enforce your team's marking conventions; the serving adapter doesn't classify paragraphs.
Build both websites and MCP bundles
The customer config selects
audience: [customer]; the internal config selectsaudience: [internal]. Run:npx --no-install shoalrun build customer.config.yaml dist/customer-site npx --no-install shoalrun build internal.config.yaml dist/internal-site npx --no-install shoalrun mcp export dist/customer-site --out dist/customer-mcp npx --no-install shoalrun mcp export dist/internal-site --out dist/internal-mcpBoth builds use
production/current/en. Their audience selections and bundle revisions differ; audience isn't an extra publication coordinate. Don't combine them in a server registry keyed only by publication.Export customer in-app content
The example's
app-helpexport target explicitly selects customer content. Websitesite.contentFilterdoesn't select application exports:exports: app-help: formats: [html, markdown] contentFilter: { audience: [customer] } publicBase: /help/releases/demo/ resources: - { kind: page, documentId: guide.billing } - { kind: section, documentId: guide.billing, sectionId: refunds }Build that target separately:
npx --no-install shoalrun export customer.config.yaml --target app-help --out dist/app-helpThe page declares the refund section suitable for standalone use. Host the complete export at its
publicBase, including assets, or use the Content REST adapter. Your app can fetchguide.billingor itsrefundssection using the content client.Serve and compare the two editions
Run each command in a separate terminal:
npx --no-install shoalrun serve dist/customer-site --port 8771npx --no-install shoalrun serve dist/internal-site --port 8772Open
http://127.0.0.1:8771/andhttp://127.0.0.1:8772/. Only the internal page shows the Company Internal Content boxes. Their MCP endpoints are/mcpon the respective ports. For a host without Node, pass each discovery bundle to a separate Python adapter, and optionally supplydist/app-helpto the customer instance.
Check the result
Confirm INTERNAL_RETRY_QUEUE and INTERNAL_BILLING_REPLAY appear in the internal build and are absent from every customer website, discovery, and application-export file. Test MCP search for those markers and try reading known internal-only IDs. Check both inclusion and exclusion so a missing fixture can't produce a false pass.
If you adapt this example for restricted content, protect the relevant website, MCP, Markdown, content routes, and assets with your own authentication. The current mcp.access: public configuration supplies no authentication itself. Keep audience directories and handler instances separate, and include the bundle revision in cache identity. The Node Content REST adapter's public immutable cache policy must be overridden for privileged responses.
HTML, Markdown, and agents
The internal HTML page displays its authored callouts alongside shared instructions. Its Markdown and MCP reads retain the internal labels and text. The customer build omits each unmatched block before rendering, indexing, and dependency expansion. The customer in-app export applies its own filter and contains passive selected HTML or Markdown.