Open Source · Apache-2.0

Design System.

A self-hosted brand and design-asset library: a Next.js admin UI and a standalone Express REST API serving brand identities, design tokens, component specifications, page templates, and thousands of icons — to humans and to AI agents through MCP.

Install

Executed from a clean container against this repository:

git clone https://github.com/bulletproofsoftware-ai/bulletproof-design.git
cd bulletproof-design
npm ci --legacy-peer-deps     # legacy peer deps: eslint 9 vs plugin ranges
Design System architecture infographic
Architecture infographic — from bulletproof-design/docs/media/
Domain Design Infrastructure
Repository bulletproof-design
Language TypeScript · Next.js 15 · React 19
Interfaces Admin UI · REST API · MCP · public portal
License Apache-2.0

1Problem Statement

Brand assets, design tokens, component specifications, and icon sets typically live in different tools — a design file, a token repository, a component library, a shared drive. Nothing is queryable from one place, and the canonical value of a brand colour depends on who you ask.

AI agents make this worse. An agent asked to build a page in a company's style has no way to look up that style, so it guesses: approximate colours, invented spacing, components that do not exist. The output looks plausible and is subtly wrong in every dimension the brand actually specifies.

This system stores brands, tokens, components, templates, and icons as files on disk and serves them through four coordinated surfaces — an admin UI for editors, a public portal for stakeholders, a REST API for applications, and MCP tools for agents — so every consumer reads the same source of truth.

2Architecture

Two processes run under supervisord in a single container: the Next.js application on port 8095 and a standalone Express API on 8096. Both read the same on-disk registries, so neither is authoritative over the other.

Resource routers

src/api/server.ts mounts a router per resource — categories, templates, components, search, brands, import, assets, icons — plus a preview route and a /brand-assets static route deliberately mounted outside /api so CORS and auth gates do not apply to public assets.

Method-scoped auth

Writes (POST, PUT, DELETE, PATCH) require X-Api-Key checked against DESIGN_API_KEY through a constant-time safeCompare(). Reads pass through unauthenticated. Rate limits are 100 writes and 1000 reads per 15 minutes.

Environment-split CSP

middleware.ts emits a per-request 128-bit nonce with 'strict-dynamic' in production and no 'unsafe-inline' or 'unsafe-eval' on script-src; development retains both so HMR and the Monaco editor work.

Enforced component tiers

A four-tier architecture is enforced mechanically in eslint.config.mjs via no-restricted-imports: ui/ cannot import primitives, features, or effects; primitives/ cannot import features or effects; features/ cannot import effects or reach across features.

MCP server

src/mcp/design-system-server.ts registers ten tools against the same registries, letting an agent fetch a component, search icons, read brand guidelines, or retrieve design tokens directly.

Pipeline and Safety

3Requirements

Requirements describe the implemented capabilities across the four surfaces.

IDRequirement
REQ-DS-001Serve brands, tokens, components, templates, and icons from on-disk registries.
REQ-DS-002Expose an admin UI for editing brands and browsing component specifications.
REQ-DS-003Expose a public per-brand portal covering colour, typography, logo usage, and imagery.
REQ-DS-004Expose a REST API documented by an OpenAPI specification.
REQ-DS-005Expose ten MCP tools so agents can query the system directly.
REQ-DS-006Require an API key for all mutating requests and rate-limit reads and writes separately.
REQ-DS-007Emit a strict nonce-based Content Security Policy in production.
REQ-DS-008Enforce the four-tier component import hierarchy at lint time.
REQ-DS-009Compile design tokens and themes to CSS custom properties on every build.
REQ-DS-010Sanitize all SVG content on upload and on sync.
REQ-DS-011Extract component props from TSX sources for the specification browser.
REQ-DS-012Default the public portal to noindex unless explicitly enabled.

4Interfaces

Four surfaces over one store. The MCP tool set is what makes the system legible to agents.

InterfacePurpose
GET /api/brands · /api/brands/{slug}Brand CRUD and retrieval
GET /api/brands/{slug}/colors · /fonts · /css-variablesBrand token access
GET /api/components · /api/searchComponent registry and search
GET /api/templates/{category}/{name}Page template retrieval
GET /api/icons/searchIcon search across styles
GET /preview/{category}/{name}Rendered HTML preview
get_component · get_component_specMCP: component and prop specification
get_brand_identity · get_brand_guidelinesMCP: brand identity and written guidelines
get_tokens · get_composition_rulesMCP: design tokens and composition rules
search_icons · get_icon · get_asset · search_componentsMCP: asset and component discovery

5Integration Points

The system is designed to be consumed by other software as much as by people.

6Repository

The repository separates the admin application, the API, the MCP server, and the content registries.

PathPurpose
app/(admin)/Admin editing interface
app/portal/[slug]/Public per-brand portal
src/api/Express routers, middleware, and libraries
src/mcp/design-system-server.tsMCP server exposing ten tools
components/{ui,primitives,features,effects}The four enforced component tiers
design-tokens/DTCG tokens, themes, and Style Dictionary config
templates/Thirteen full-page templates
brands/Directory-based brand definitions
docs/Architecture, API, deployment, migration, SBOM, and review documents

View source on GitHub

7Implementation Notes

Configuration defaults and constraints that affect deployment.