One access-controlled platform for internal AI tools

Client system Published Sep 24, 2026 Reviewed Nov 21, 2026

Consolidating support operations, chargeback disputes, paid-social campaign tooling and assistant analytics into one role-gated dashboard shell and Go service kernel, built largely through AI coding agents under standard CI gates.

At a glance

Problem
Support, disputes, media buying and product teams all needed internal automation, and every new tool kept rebuilding login, roles, tables and admin screens or falling back to raw database scripts.
Constraint
Tools touched live customer records, ad spend and payment disputes, requiring centralized access control and gated production writes while still shipping rapidly.
System built
One dashboard shell backed by a shared role registry and UI packages, paired with small Go services built on a one-way kernel and validated service manifest.
Outcome
Every new internal product inherits auth, permissions, data views and deploys out of the box. Roughly 1,900 merges landed from AI coding-agent branches, most within a single month, all through identical verification gates.

Overview

Behind a consumer subscription company with multiple products sit operational teams that depend on automation every day: support operators supervising an AI agent, a disputes team filing chargeback evidence, media buyers assembling ad campaigns, and product owners reviewing in-app AI conversations. Giving those teams raw database consoles, ad-hoc scripts and scattered spreadsheets is an operational liability.

Without a shared platform, every new internal tool repeats the same boilerplate: sign-in, permissions, tables, filters, admin panels and deployment plumbing. As tools multiply, operational standards splinter with them. Treating every internal automation surface as a governed product inside one dashboard shell lets each new tool inherit the foundation instead of rebuilding it.

One access registry for every product

Every internal product is declared once in a central role table specifying a viewer pool and an optional admin pool. Read-only products omit the admin pool; when an admin pool exists, a test enforces that it is a strict subset of viewers. Server API procedures are generated straight from this table, making it impossible to expose a product endpoint without an access rule.

// lib/auth/product-roles.ts: pure data, safe to import from the browser
disputes: {
  displayName: "Disputes",
  viewer: ["ADMIN", "DISPUTES_ADMIN", "DISPUTES_USER"],
  admin: ["ADMIN", "DISPUTES_ADMIN"],
},

// server/auth/products.ts: server-only procedure builders and page guards
export const disputesProcedure = createProductProcedure({
  product: "disputes",
  tier: "viewer",
});

Asking for a tier a product does not define throws when the module loads

All authorization policy lives in those two files. Originally they were combined until client navigation imported the role table and pulled server environment variables into the browser bundle, breaking at runtime. Splitting pure role data from server-only procedure builders turned that class of bug into a compile-time failure.

Sidebar navigation, mobile navigation and the home grid all render from one catalog driven by the same role check. Restricted products appear as locked tiles, preventing navigation from ever drifting out of sync with permissions. One guard module also gates every direct production database connection: connecting requires an explicit flag, and writing requires a second flag plus operation-specific confirmation.

Shared views and products on the shell

A shared UI package supplies core primitives, while a views package gives every product identical board, table and list layouts with filters, sorting and view state persisted in the URL. Custom lint rules keep structure uniform: every API router exports a symbol matching its filename, every workspace package carries standard tooling config, and every UI primitive matches its file name.

The shell hosts five operational products:

  • Support operations, the largest workspace: tickets, orders, ingestion and enrichment health, cancellations and metrics for the customer-support AI agent.
  • Disputes, tracking chargebacks across payment providers and brands, powered by a dedicated Go service.
  • Media buying, turning a fragile spreadsheet-and-script workflow for paid-social campaigns into a pure rule engine over typed objects, verified against an end-to-end golden scenario matching legacy output and enriched with spend, sales and CPA from BigQuery.
  • Assistant analytics, surfacing conversations, errors and quality trends for the in-app AI assistant.
  • Video library search, finding marketing footage across embeddings, captions and metadata.

A shared kanban board also began inside this repository before moving into its own repo, and the customer-support agent later graduated to dedicated repositories once it outgrew the shell.

Go services on a one-way kernel

The Go services share a lean kernel for bootstrapping, configuration, HTTP servers, logging, migrations, connection pools, metrics and health probes. A test parses every Go source file in the kernel tree and fails if any file imports a service package, keeping dependencies strictly one-way.

A validated service manifest records each service's owner, local verification command, container image, deployment mode and health/version endpoints. Every deployed service serves its exact commit SHA at a version endpoint, which acts as the sole truth for what is live in production.

Keeping evidence PDFs inside provider upload limits

The disputes service renders chargeback evidence to PDF via headless Chrome and publishes business metrics such as resolution rate to Prometheus. Customer ticket attachments go into those packets, and CSS max-width only scales display size, not embedded bytes. One phone photo inflated a 16 KB HTML document into a 22.5 MB PDF (21.1 MB from that single photo).

Because payment providers cap uploads at 5 MB and tickets carry multiple attachments, per-image limits were not enough. The service now downloads each image, resamples and re-encodes it as JPEG, and inlines it against a document-wide byte budget with a 1,600 px dimension ceiling per image.

Small Go utility services (HTML-to-PDF, PDF merging, audio conversion) also power n8n workflows behind bearer tokens. Built to retire an older Python service, the cutover kept Python live until the Go endpoints ran cleanly for two business days, making rollback a single URL switch.

Built by agents, gated like people

The repository was structured from day one for AI coding agents. Agents develop on agent/* branches, include tests with every change, open a merge request, and merge only after the CI pipeline turns green. CI runs every offline gate: lint, typecheck, unit tests, manifest validation and Go tests. Integration and performance suites require a disposable database and run locally, so a green pipeline is explicitly documented as proving offline gates only.

The support console's local stack boots with one command and needs zero credentials or network access. Stateful stubs stand in for external APIs. The seed dataset is synthetic and deterministic, shaped from read-only production aggregates (cardinalities, enum ratios, null rates, text-length percentiles) while generating all names, addresses and messages cleanly. A coverage manifest lists every UI state the seed data must exercise, failing by name if any state goes unreachable.

Early agents repeatedly wrote throwaway shell loops to poll CI pipelines, and those loops failed on flaky CLI formatting. Durable waiter scripts replaced them, parsing structured output, absorbing transient errors and returning explicit exit codes. Their documentation also catalogs silent CI bugs, including a push of seven branches that triggered pipelines for only four.

Roughly 1,900 merges landed from agent branches, most inside a single month. Production safety remains a written contract binding humans and automation alike: schema changes, data edits and production writes require explicit human approval for the exact target and operation, and deploys run only when triggered by a person from a trusted machine.

Limitations

  • Sharing one repository couples release cadences across products; the largest product eventually required its own repositories.
  • Centralizing authorization in two files makes auditing trivial, yet turns those files into merge-conflict hotspots under heavy parallel agent traffic.
  • Fast offline CI gates leave integration and performance coverage dependent on local discipline.
  • Deterministic synthetic fixtures guarantee declared console states only; live production traffic still surfaces undeclared edge cases.
  • Platform-level business metrics (support and dispute resolution rates, launch speed for new products, shell adoption) are defined, with no published measurements available here.
  • High coding-agent throughput shifts the bottleneck squarely onto human review, deployment and product judgment.

Related case studies

Bring one real problem

One hour, €80. You leave with a written plan for what belongs in AI, what belongs in code, and what a first release takes, whether we work together or not.