XeoContext is a modern "System Design" visualization tool. It is designed to be a lightweight, self-contained viewer for:
- System Design documents: Markdown files with Mermaid diagram support.
- OpenAPI definitions: visualized using Swagger UI.
- AsyncAPI definitions: visualized using AsyncAPI React component.
XeoContext is designed to be deployed as a Docker container with a read-only volume mounted to provide the content.
- Features
- AI Integration
- Usage with Live-reload
- Production Usage (without Live-reload)
- Deployment on Vercel
- Development (Contributing)
- Content Configuration
- Extra Tips
- System Design Viewer:
- Renders Markdown documents with GitHub Flavored Markdown (GFM).
- Mermaid Diagrams: Native support for Flowcharts, Sequence diagrams, C4 diagrams, classes, and more.
- Smart Navigation: Recursive sidebar navigation with support for nested items.
- SEO Optimized: dynamic document title and description updates based on frontmatter.
- OpenAPI Viewer:
- Interactive REST API documentation using a custom implementation of Swagger UI.
- Dark Mode Support: Fully customized theme that adapts to the application's dark mode.
- Server-Side Dereferencing: Resolves all
$refpointers (internal and external) to ensure stability.
- AsyncAPI Viewer:
- Event-Driven Architecture visualization using the AsyncAPI React component.
- Supports dereferencing of AsyncAPI schemas from external URLs.
- Theme Support: Seamless switching between Light, Dark, and System modes.
- Dynamic Content: Content is decoupled from code. Loads configuration and documentation from local files or Git repositories.
- Docker Ready:
- Production-optimized image (
xeost/xeocontext:latest). - Live-reload image for development (
xeost/xeocontext-live-reload:latest).
- Production-optimized image (
- Customizable Deployment: Built-in scripts (
setup-content) to easily deploy your own instance to Vercel or other platforms, syncing content from your own repository. - Modern Stack: Built with Next.js 16 (App Router) and Turbopack.
This repository is designed to be the "Source of Truth" for system design. The content directory is intended to be read by AI Coding Agents (via MCP Servers or direct access) to scaffold and maintain other repositories based on the designs defined here. But from a clean system design content repository, see examples/markdown-openapi-asyncapi for a quickstart.
For a quick start with a pre-configured environment, you can use the XeoContext Template.
-
Clone the template:
git clone https://github.com/xeost/xeocontext-template my-system-design cd my-system-design -
Run with Docker Compose: The template includes a
docker-compose.ymlconfigured to use thexeost/xeocontext-live-reload:latestimage.docker compose up -d
-
Edit Content: Modify the files in the
contentdirectory. The viewer will automatically reload to reflect your changes. See Content Configuration for more details.
AI Support:
The template includes .agent/rules/content.md, which provides instructions for LLMs on how to structure the design content (DDD, OpenAPI, AsyncAPI).
Note: The template provides a minimal starting point. For comprehensive examples of directory structures and configurations, please refer to the
examplesdirectory in this repository.
If your content is static and will not be edited, you can switch to the production-optimized image for better performance.
-
Follow the steps in the Usage with Live-reload section to set up your repository.
-
Edit the
docker-compose.ymlfile and change the image name:services: xeocontext: image: xeost/xeocontext:latest # Change from xeocontext-live-reload # ... rest of the configuration
This workflow allows you to deploy a customized version of XeoContext (with your embedded content) to Vercel.
-
Clone the XeoContext Viewer: Start by cloning the base viewer repository.
git clone https://github.com/xeost/xeocontext.git my-viewer cd my-viewer pnpm install -
Check Available Versions: See which versions of XeoContext are available to pin your deployment to.
pnpm list-releases
-
Create Deployment Repository: Create a new empty repository on GitHub (e.g.,
github-user/system-design-example) where your customized viewer will live. -
Configure Environment: Copy
.env.exampleto.envand set the following variables:cp .env.example .env
XEOCONTEXT_CONTENT_TYPE: Set to'local'(if content is on your machine) or'git'(if content is in a remote repo).XEOCONTEXT_CONTENT_SOURCE: Path to local directory (relative or absolute) or Git URL of your content repository.XEOCONTEXT_TAG: The XeoContext version tag you want to use (e.g.,v0.1.0).XEOCONTEXT_DEPLOY_REPO: The URL of the GitHub repository you created in step 3.
-
Sync & Setup: Run the setup script. This will reset the code to the specified tag, copy your content into the
contentdirectory, and configure the git remotes (upstreamfor updates,originfor your deployment).pnpm setup-content
-
Push to GitHub: Commit the changes and push to your deployment repository.
git add . git commit -m "Initial deployment" git push -u origin main
Note: Connect this repository to Vercel for automatic deployments.
Updating XeoContext Version: If a new version of XeoContext is released:
- Update
XEOCONTEXT_TAGin your.envfile. - Run
pnpm setup-content. - Commit and push.
Updating Content: If you change your design content (in your local folder or external content repo):
- Run
pnpm setup-content. - Commit and push.
-
Install dependencies:
pnpm install
-
Configure Environment: Copy
.env.exampleto.envand configureXEOCONTEXT_CONTENT_DIRto point to a sample content directory.cp .env.example .env
Open
.envand uncomment/set:XEOCONTEXT_CONTENT_DIR=./examples/markdown-openapi-asyncapi
-
Run development server:
pnpm dev
-
Open Application: Navigate to http://localhost:12051.
The application reads from the /content directory (or the value of XEOCONTEXT_CONTENT_DIR in the environment).
Organizing your design content by Domain (e.g., identity, payments) rather than by file type is crucial for effective AI-assisted development. This approach creates clear Context Boundaries, allowing you to feed an AI agent the complete "truth" about a specific domain—its business logic (Markdown), API contracts (OpenAPI), and events (AsyncAPI)—without distracting noise.
For a deeper dive into this philosophy, read Harmonizing AI Code Generation with Centralized System Design.
The content directory follows a strict separation between Global Architecture and Bounded Contexts (Domains).
1. Root Configuration
xeocontext.config.json: [MANDATORY] The central navigation and metadata map for the viewer.
2. The "Global" Directory (/global)
Defines the laws of the system and cross-cutting concerns.
- Gateway (
/global/gateway): Contains the Master Root files (openapi.yaml,asyncapi.yaml). These files aggregate endpoints and channels from all domains to provide a unified "System View". - ADRs (
/global/adrs): Architecture Decision Records explaining why decisions were made. - Standards (
/global/standards): Naming conventions, error handling, etc.
3. Domain Modules (/domains)
Each folder represents a specific business capability (e.g., identity, payments).
- Co-location: Markdown, OpenAPI, and AsyncAPI specs reside together.
- Fragmented Architecture: Actual definitions (Schemas, Paths) should live in
components/subfolders and be aggregated by the domain's rootopenapi.yaml.
/content
├── xeocontext.config.json # [MANDATORY] Main configuration
├── global/ # [MANDATORY] Cross-cutting architecture
│ ├── gateway/ # Unified System API (Master Roots)
│ │ ├── openapi.yaml # Imports from all domains
│ │ └── asyncapi.yaml
│ ├── adrs/ # Architecture Decision Records
│ └── standards/ # Global Standards
└── domains/ # [MANDATORY] Business Logic
├── {domain-name}/ # e.g., identity, payments
│ ├── readme.md # Domain overview
│ ├── openapi.yaml # Domain-specific API Root
│ ├── asyncapi.yaml # Domain-specific Event Root
│ └── components/ # Reusable schemas & paths
│ ├── schemas/
│ └── paths/
This file controls the global settings and navigation sidebar of the application.
projectName: Displayed in the header.projectDomain: Optional domain name.navigation: An array of sections that defines the System Design sidebar.title: Section header.items: Link items. Supports up to 3 nested levels.title: Link text.href: Path to the Markdown file (relative tocontent, without.mdextension). Important: The application maps the URL path/content/some/pathto the file/content/some/path.mdOR/content/some/path/readme.md.items: (Optional) Sub-items for creating nested menus.
openapi: Path to the main OpenAPI definition file. If present, an "OpenAPI" tab will appear in the UI.asyncapi: Path to the main AsyncAPI definition file. If present, an "AsyncAPI" tab will appear in the UI.
{
"projectName": "ExampleApp",
"projectDomain": "exampleapp.com",
"navigation": [
{
"title": "System Architecture",
"items": [
{ "title": "Overview", "href": "/" },
{ "title": "Infrastructure & HA", "href": "/global/infrastructure" },
{ "title": "Security", "href": "/global/security" },
{ "title": "Database Schema", "href": "/global/database" },
{ "title": "Workflows", "href": "/global/workflows" }
]
},
{
"title": "Standards & ADRs",
"items": [
{ "title": "API Standards", "href": "/global/standards/api-design" },
{ "title": "Error Handling", "href": "/global/standards/error-handling" },
{ "title": "Code Conventions", "href": "/global/standards/code-conventions" },
{ "title": "ADR 001 - DDD", "href": "/global/adrs/001-domain-driven-design" },
{ "title": "ADR 002 - Local First", "href": "/global/adrs/002-local-first-sync" },
{ "title": "ADR 003 - K8s", "href": "/global/adrs/003-k8s-infrastructure" }
]
},
{
"title": "Domains",
"items": [
{ "title": "Identity", "href": "/domains/identity" },
{ "title": "Todos", "href": "/domains/todos" },
{ "title": "Notes", "href": "/domains/notes" },
{ "title": "Library (Sync)", "href": "/domains/library" }
]
}
],
"openapi": "/global/gateway/openapi.yaml",
"asyncapi": "/global/gateway/asyncapi.yaml"
}This file contains crucial instructions for Large Language Models (LLMs) to understand how to structure and generate content within your user design repository (a repository containing only Markdown, OpenAPI, AsyncAPI, and a docker-compose.yml).
It defines the Domain-Driven Structure, naming conventions, and best practices for creating cohesive system designs.
Compatibility:
- Local AI Agents: This file is automatically detected by agents following the
.agentconvention. - Windsurf / Cursor: You can easily adapt these rules for popular AI code editors by copying the content to their respective rule configuration locations (e.g.,
.windsurf/rules/content.mdor.cursor/rules/content.md).
It is recommended to validate your spec files before committing changes to ensure the viewer renders them correctly.
You can use Redocly CLI to lint and bundle your OpenAPI definitions.
# Lint the main gateway file (and all its references)
pnpm --package=@redocly/cli dlx redocly lint content/global/gateway/openapi.yaml
# Lint a specific domain file
pnpm --package=@redocly/cli dlx redocly lint content/domains/identity/components/paths/auth_login.yamlYou can use AsyncAPI CLI to validate your AsyncAPI definitions.
# Validate the main gateway file
pnpm dlx @asyncapi/cli validate content/global/gateway/asyncapi.yaml