> ## Documentation Index
> Fetch the complete documentation index at: https://mint-tsdocs.saulo.engineer/llms.txt
> Use this file to discover all available pages before exploring further.

# Monorepo Examples

> OpenDocs for multi-language monorepos

export const FileTree = ({structure, item, title, level = 0, maxDepth = 10, showIcons = true}) => {
  const getFileIcon = (fileName, hasChildren) => {
    if (hasChildren) {
      return 'folder-open';
    }
    return 'file';
  };
  if (structure !== undefined) {
    return <div data-component="tsdocs-filetree" className="code-block mt-5 mb-8 not-prose rounded-2xl relative group
                   text-gray-950 bg-gray-50 dark:bg-white/5 dark:text-gray-50
                   border border-gray-950/10 dark:border-white/10
                   p-0.5">
        {title && <div className="flex text-gray-400 text-xs rounded-t-[14px] leading-6 font-medium pl-4 pr-2.5 py-1">
            <div className="flex-none flex items-center gap-1.5 text-gray-700 dark:text-gray-300">
              {title}
            </div>
          </div>}
        <div className={`prose prose-sm dark:prose-invert w-0 min-w-full max-w-full py-3.5 px-4 bg-white dark:bg-codeblock overflow-x-auto scrollbar-thin scrollbar-thumb-rounded scrollbar-thumb-black/15 hover:scrollbar-thumb-black/20 dark:scrollbar-thumb-white/20 dark:hover:scrollbar-thumb-white/25 rounded-xt`} style={{
      fontFamily: 'ui-monospace, SFMono-Regular, monospace',
      fontSize: '0.875rem'
    }}>
          {structure.map((fileItem, index) => {
      if (!fileItem || !fileItem.name) return null;
      return <FileTree key={index} item={fileItem} level={0} maxDepth={maxDepth} showIcons={showIcons} />;
    })}
        </div>
      </div>;
  }
  if (!item) {
    return null;
  }
  if (level >= maxDepth) {
    return <div style={{
      paddingLeft: `${level * 20}px`,
      paddingTop: '4px',
      paddingBottom: '4px',
      color: '#6b7280',
      fontStyle: 'italic'
    }}>
        {showIcons && <Icon icon="AlertTriangle" />} (max depth reached)
      </div>;
  }
  const hasChildren = item.children != null && item.children.length > 0;
  const indent = level * 20;
  if (hasChildren) {
    return <div style={{
      position: 'relative',
      paddingLeft: `${indent}px`
    }}>
        {}
        {level > 0 && <div style={{
      position: 'absolute',
      left: `${indent - 12}px`,
      top: '20px',
      bottom: '0',
      width: '1px',
      backgroundColor: 'rgba(156, 163, 175, 0.2)',
      borderLeft: '1px solid rgba(156, 163, 175, 0.1)'
    }} />}
        <div style={{
      display: 'flex',
      alignItems: 'center',
      gap: '8px',
      paddingTop: '4px',
      paddingBottom: '4px'
    }}>
          {showIcons && <Icon icon={getFileIcon(item.name, true)} />}
          <span style={{
      fontWeight: 500
    }}>
            {item.name}
          </span>
          {item.description && <span style={{
      fontSize: '0.75rem',
      color: '#94a3b8',
      marginLeft: '8px'
    }}>
              {item.description}
            </span>}
          {item.badge && <Badge color={item.badge.color || 'blue'}>
              {item.badge.text}
            </Badge>}
        </div>
        {}
        {item.children && item.children.map((child, i) => {
      const key = child.name ? `${child.name}-${i}` : `child-${i}`;
      return <FileTree key={key} item={child} level={level + 1} maxDepth={maxDepth} showIcons={showIcons} />;
    })}
      </div>;
  }
  return <div style={{
    position: 'relative',
    paddingLeft: `${indent}px`,
    display: 'flex',
    alignItems: 'center',
    gap: '8px',
    paddingTop: '4px',
    paddingBottom: '4px'
  }}>
      {}
      {level > 0 && <div style={{
    position: 'absolute',
    left: `${indent - 12}px`,
    top: '0',
    bottom: '0',
    width: '1px',
    backgroundColor: 'rgba(156, 163, 175, 0.2)',
    borderLeft: '1px solid rgba(156, 163, 175, 0.1)'
  }} />}
      {showIcons && <Icon icon={getFileIcon(item.name, false)} />}
      <span>
        {item.name}
      </span>
      {item.description && <span style={{
    fontSize: '0.75rem',
    color: '#94a3b8',
    marginLeft: '8px'
  }}>
          {item.description}
        </span>}
      {item.badge && <Badge color={item.badge.color || 'blue'}>
          {item.badge.text}
        </Badge>}
    </div>;
};

# Monorepo Examples

<Warning>
  **RFC Status**: This section contains proposed examples for the OpenDocs Specification RFC.

  These examples are provided to illustrate how the specification could be implemented.
  [Provide feedback](https://github.com/svallory/mintlify-tsdocs/issues) to help refine these examples.
</Warning>

## Multi-Language Monorepo

This example demonstrates how to document a complex monorepo containing multiple programming languages and shared dependencies.

### Project Structure

<FileTree
  structure={[
{
  name: "frontend/",
  children: [
    { name: "react-app/" },
    { name: "vue-components/" }
  ]
},
{
  name: "backend/",
  children: [
    { name: "go-api/" },
    { name: "rust-service/" }
  ]
},
{
  name: "shared/",
  children: [
    { name: "typescript-types/" },
    { name: "protobuf-definitions/" }
  ]
},
{ name: "docs/" }
]}
/>

### opendocs.json Configuration

```json theme={null}
{
  "documentationSet": {
    "id": "acme-monorepo-docs",
    "name": "Acme Monorepo Documentation",
    "description": "Multi-language monorepo for Acme Corp",
    "version": "2.0.0",
    "created": "2024-01-01T00:00:00Z"
  },
  "projects": [
    {
      "id": "react-app",
      "name": "React App",
      "language": "typescript",
      "version": "1.5.0",
      "location": {
        "type": "file",
        "path": "projects/react-app.json",
        "format": "json"
      }
    },
    {
      "id": "vue-components",
      "name": "Vue Components",
      "language": "typescript",
      "version": "1.2.0",
      "location": {
        "type": "file",
        "path": "projects/vue-components.json",
        "format": "json"
      }
    },
    {
      "id": "go-api",
      "name": "Go API",
      "language": "go",
      "version": "1.8.3",
      "location": {
        "type": "file",
        "path": "projects/go-api.json",
        "format": "json"
      }
    },
    {
      "id": "rust-service",
      "name": "Rust Service",
      "language": "rust",
      "version": "0.9.1",
      "location": {
        "type": "file",
        "path": "projects/rust-service.json",
        "format": "json"
      }
    },
    {
      "id": "shared-types",
      "name": "Shared Types",
      "language": "typescript",
      "version": "1.0.0",
      "location": {
        "type": "file",
        "path": "projects/shared-types.json",
        "format": "json"
      },
      "dependencies": []
    }
  ],
  "navigation": {
    "title": "Platform Documentation",
    "groups": [
      {
        "name": "Frontend",
        "projects": ["react-app", "vue-components"]
      },
      {
        "name": "Backend",
        "projects": ["go-api", "rust-service"]
      },
      {
        "name": "Shared",
        "projects": ["shared-types"]
      }
    ]
  }
}
```

## Go API Project

### Project Manifest

```json theme={null}
{
  "project": {
    "id": "go-api",
    "name": "Go REST API",
    "language": "go",
    "items": {
      "format": "json-ref",
      "file": "go-api-items",
      "count": 89
    },
    "metadata": {
      "goVersion": "1.21",
      "modulePath": "github.com/acme/go-api",
      "dependencies": [
        { "project": "shared-types", "ref": "../shared-types/shared-types.json" }
      ]
    }
  }
}
```

### Sample Go DocItems

```json theme={null}
{"id": "go-api#handlers#UserHandler", "name": "UserHandler", "kind": "struct", "language": "go", "docBlock": {"description": "HTTP handler for user-related endpoints"}, "metadata": {"package": "handlers", "methods": ["GetUser", "CreateUser", "UpdateUser"]}}
{"id": "go-api#handlers#UserHandler#GetUser", "name": "GetUser", "kind": "method", "language": "go", "container": {"id": "go-api#handlers#UserHandler", "relationship": "struct"}, "docBlock": {"description": "Retrieves a user by ID", "tags": {"param": [{"name": "param", "content": "HTTP request context", "parameters": {"name": "ctx", "type": "context.Context"}}], "returns": ["User data if found, error otherwise"]}}}
{"id": "go-api#models#User", "name": "User", "kind": "struct", "language": "go", "docBlock": {"description": "User model representing a system user"}, "metadata": {"fields": [{"name": "ID", "type": "string"}, {"name": "Name", "type": "string"}, {"name": "Email", "type": "string"}]}}
```

## Rust Service Project

### Project Manifest

```json theme={null}
{
  "project": {
    "id": "rust-service",
    "name": "Rust Background Service",
    "language": "rust",
    "items": {
      "format": "json-ref",
      "file": "rust-service-items",
      "count": 156
    },
    "metadata": {
      "rustEdition": "2021",
      "crateName": "acme-rust-service",
      "dependencies": [
        { "project": "shared-types", "ref": "../shared-types/shared-types.json" }
      ]
    }
  }
}
```

### Sample Rust DocItems

```json theme={null}
{"id": "rust-service#engine#ProcessingEngine", "name": "ProcessingEngine", "kind": "trait", "language": "rust", "docBlock": {"description": "Core trait for data processing engines"}, "metadata": {"associatedTypes": ["Input", "Output"], "supertraits": ["Send + Sync"]}}
{"id": "rust-service#engine#ProcessingEngine#process", "name": "process", "kind": "trait-method", "language": "rust", "container": {"id": "rust-service#engine#ProcessingEngine", "relationship": "trait"}, "docBlock": {"description": "Processes input data and returns output", "tags": {"param": [{"name": "param", "content": "Input data to process", "parameters": {"name": "input", "type": "Self::Input"}}], "returns": ["Processed output data"]}}}
{"id": "rust-service#workers#DataWorker", "name": "DataWorker", "kind": "struct", "language": "rust", "docBlock": {"description": "Worker responsible for processing data chunks"}, "metadata": {"visibility": "public", "fields": [{"name": "id", "type": "u64"}, {"name": "engine", "type": "Box<dyn ProcessingEngine>"}]}}
```

## Key Features

* **Multi-Language Support**: Documents TypeScript, Go, and Rust in a single documentation set
* **Shared Dependencies**: Projects can reference shared type definitions
* **Organized Navigation**: Groups projects by functional area (Frontend, Backend, Shared)
* **JSON \$ref Format**: Efficient external file references for larger projects
* **Version Tracking**: Each project maintains independent versioning

## Best Practices

1. **Use JSONL for Larger Projects**: When a project has 100+ documented items, JSONL provides better streaming performance
2. **Group Logically**: Organize navigation by functional areas rather than programming language
3. **Share Common Types**: Create a shared types project that other projects can reference
4. **Version Independently**: Each project should have its own version tracking

## See Also

* [Simple Project Examples](/opendocs/examples/simple-projects) - Basic single-language examples
* [Microservices Examples](/opendocs/examples/microservices) - Service-oriented architectures
* [Examples Overview](/opendocs/examples/index) - Back to all examples

***

*This example is part of the OpenDocs Specification RFC. [Provide feedback](https://github.com/svallory/mintlify-tsdocs/issues) to help improve it.*
