This document outlines the codebase structure for the Mirascope monorepo, which contains the Python and TypeScript SDKs, website, and unified documentation.
Note: This document is intended to be a live, self-updating reference. When making structural changes to the codebase (adding/removing directories, changing organization, updating tooling), please update this file accordingly. This ensures it remains an accurate source of truth for the codebase structure.
mirascope/ # Version 2
├── python/ # Python SDK implementation
├── typescript/ # TypeScript SDK implementation
├── website/ # Marketing website (docs, blog, landing page)
├── docs/ # Unified cross-language documentation and website
└── [config files] # Monorepo-level configuration
Mirascope uses a monorepo structure to manage multiple packages and applications in a single repository. This provides several key benefits:
-
Unified Development: All packages share the same repository, enabling coordinated development across Python, TypeScript, and the website.
-
Simplified Script Orchestration: The root
package.jsonprovides convenient passthrough commands to run scripts in any workspace (e.g.,bun run test:python,bun run typecheck:typescript,bun run website:dev). -
Shared Documentation: Unified documentation site (
docs/) provides cross-language documentation for both Python and TypeScript implementations. -
Consistent Tooling: Shared linting, formatting, and CI/CD configuration across all packages.
-
Language-Specific Tooling: Python uses
uvfor package management, TypeScript/Website/Docs usebun, each optimized for their respective ecosystems.
python/
├── mirascope/ # Main Python package
│ ├── __init__.py # Package exports
│ ├── llm/ # "LLM abstractions that aren't obstructions"
│ │ ├── __init__.py # LLM module exports
│ │ ├── agents/ # Agent functionality (currently not publicly exported)
│ │ ├── calls/ # Call decorator and call management
│ │ ├── providers/ # Provider-specific implementations
│ │ ├── content/ # Content types (text, image, audio, etc.)
│ │ ├── context/ # Context management
│ │ ├── formatting/ # Response formatting
│ │ ├── mcp/ # Model Context Protocol support
│ │ ├── messages/ # Message types
│ │ ├── models/ # Model abstraction
│ │ ├── prompts/ # Prompt decorator and templates
│ │ ├── responses/ # Response and streaming response types
│ │ ├── tools/ # Tool decorator and types and toolkits
│ │ └── types/ # Type definitions
│ └── ops/ # Operational helpers (tracing, versioning)
├── examples/ # Example code
├── tests/ # Test suite
├── typechecking/ # Type checking utilities
├── scripts/ # Build and utility scripts
├── pyproject.toml # Python package configuration
├── uv.lock # Dependency lock file
└── README.md # Python SDK README
Tooling Choices:
- uv: Fast Python package manager and resolver
- pytest: Test framework with comprehensive e2e testing
- ruff: Fast Python linter and formatter
- pyright: Type checker for Python (waiting for
tyto become stable) - pydantic: Data validation and settings management
The TypeScript SDK's development is currently paused. We plan to resume development once we further finalize the Python llm interfaces.
The marketing website built with React, TanStack Router, and Vite. Serves docs, blog, landing page, and pricing.
Note: React component files use shadcn-style kebab-case (e.g. home-page.tsx), exports use PascalCase (e.g. HomePage).
website/
├── app/ # Frontend React application
│ ├── components/ # React components
│ │ ├── blocks/ # Components composed of other components
│ │ │ ├── code-block/ # Code block component
│ │ │ ├── navigation/ # Header, desktop/mobile navigation
│ │ │ └── [other files] # copy-button.tsx, etc.
│ │ ├── error/ # Error components
│ │ ├── ui/ # UI component library (shadcn-ui)
│ │ ├── home-page.tsx
│ │ └── [other files] # pricing-page.tsx, etc.
│ ├── hooks/ # Custom React hooks
│ ├── lib/ # Shared utilities
│ │ ├── content/ # Content loading utilities
│ │ ├── search/ # Search functionality
│ │ ├── seo/ # SEO utilities
│ │ └── mdx/ # MDX processing
│ ├── routes/ # TanStack Router pages
│ │ ├── __root.tsx # Root layout
│ │ ├── index.tsx # Home page
│ │ ├── docs.tsx # Documentation layout
│ │ ├── blog.tsx # Blog layout
│ │ ├── pricing.tsx # Pricing page
│ │ └── [other files] # privacy.tsx, terms.tsx, etc.
│ └── styles/ # CSS and styling
├── public/ # Static assets
├── vite-plugins/ # Custom Vite plugins
├── package.json
├── tsconfig.json
├── vite.config.ts
└── wrangler.jsonc # Cloudflare Pages deployment config
Tooling Choices:
- React 19: Modern React features and performance improvements
- TanStack Router: File-based routing with type-safe navigation
- Vite: Fast build tool and dev server
- Tailwind CSS v4: Utility-first CSS
- Vitest: Fast test runner
Unified cross-language documentation site built with custom MDX-based system.
docs/
├── content/ # Documentation content
│ ├── _meta.ts # Navigation metadata
│ ├── index.mdx # Home page
├── config/ # Build configuration
│ └── [build output] # Generated build files
├── scripts/ # Documentation build scripts
│ ├── cli.py # CLI utilities
│ ├── merge-api-meta.ts # API metadata merging
│ └── sync-website.ts # Website synchronization
├── package.json # Dependencies and scripts
├── tsconfig.json # TypeScript configuration
├── wrangler.jsonc # Cloudflare Pages deployment config
└── dist/ # Built documentation site
Tooling Choices:
- MDX: Markdown with JSX components
- TanStack Router: File-based routing for documentation
- Custom Build System: Tailored documentation generation
- Cloudflare Pages: Documentation hosting
package.json: Root package configuration with passthrough scripts for all workspaces.prettierrc: Code formatting configuration (applies to all workspaces).gitignore: Git ignore patterns (applies to entire monorepo)pyrightconfig.json: Python type checking configuration
build/: Generated build snippets and artifactsdist/: Distribution filessite/: Built documentation site (legacy)htmlcov/: HTML coverage reports
-
Monorepo Structure: Using a monorepo to manage Python SDK, TypeScript SDK, website, and documentation in a single repository enables coordinated development and shared tooling.
-
Language-Specific Tooling: Python uses
uvfor fast package management, while TypeScript/JavaScript usesbunfor optimal performance in their respective ecosystems. -
Unified Documentation: Single documentation site (
docs/) provides cross-language documentation, ensuring consistency between Python and TypeScript implementations. -
Provider-Agnostic Design: The
llmmodule in both Python and TypeScript provides unified interfaces that abstract over provider-specific differences, enabling code portability across LLM providers. -
Decorator-Based API: The Python implementation provides a decorator approach (
@llm.call,@llm.prompt,@llm.tool) while also exposing lower-level model APIs. TypeScript doesn't support decorators the same way, so it has a more functional approach. -
Type Safety: Strong type safety in both Python (via Pydantic and type hints) and TypeScript (via TypeScript's type system) ensures compile-time error detection.
-
Passthrough Scripts: Root
package.jsonprovides convenient commands that delegate to workspace-specific scripts, enabling unified CI/CD and developer workflows. -
Test Organization: Tests are co-located with their respective packages (
python/tests/,website/tests), with root-leveltests/for legacy code only.
This structure enables independent development of each package while maintaining deployment simplicity and unified tooling through the monorepo setup.