High-Level Architecture
Tuist follows a layered architecture that separates concerns and enables extensibility:Core Components
Core Components
Tuist is organized into distinct modules, each with specific responsibilities:
- CLI Layer - Command parsing and execution (entry point)
- Manifest Layer - Project description types and DSL
- Loader Layer - Manifest loading and validation
- Graph Layer - Dependency resolution and graph modeling
- Generator Layer - Xcode project generation
- Integration Layer - Server, cache, and external services
Module Structure
Tuist’s codebase is divided into focused modules undercli/Sources/:
Core Modules
ProjectDescription
Public manifest DSL types (
Project, Target, Scheme)TuistCore
Domain models, analytics, and shared abstractions
TuistLoader
Manifest loading, evaluation, and caching
XcodeGraph
Graph models for dependencies and targets
Feature Modules
- Generation
- Caching
- Server Integration
- Dependencies
TuistGenerator transforms manifests into Xcode projects:
- Loads
Project.swiftmanifests - Builds dependency graph
- Generates Xcode project files
- Creates schemes and build phases
Data Flow
Here’s how data flows through Tuist when you runtuist generate:
Discover Manifests
Tuist traverses the directory tree to find
Project.swift, Workspace.swift, and Tuist.swift files.Load & Parse
The
TuistLoader module:- Compiles manifest files as Swift code
- Executes them in a sandboxed environment
- Decodes JSON output into
ProjectDescriptiontypes
Build Graph
XcodeGraph creates a complete dependency graph:- Resolves target dependencies
- Validates circular dependencies
- Links external packages
- Determines build order
Key Design Principles
Manifest as Code
Manifest as Code
Manifests are written in Swift, providing:
- Type safety and compile-time validation
- Code reuse through helpers and functions
- IDE autocomplete and refactoring support
- Version control friendly
Generated Projects
Generated Projects
Xcode projects are generated, not manually maintained:
- Single source of truth (manifests)
- Reproducible builds across teams
- Eliminates merge conflicts in
.pbxproj - Easy to regenerate or clean
Module Boundaries
Module Boundaries
Clear separation of concerns:
ProjectDescriptionhas no dependencies (manifest DSL)TuistLoaderbridges manifests to modelsTuistCoreprovides shared domain logic- Feature modules depend on core, not each other
Content Addressable Storage
Content Addressable Storage
Caching uses content hashing:
- Deterministic fingerprints for targets
- Cache invalidation based on content changes
- Shared caches across teams
- Supports selective testing
Extension Points
Tuist provides several extension mechanisms:Plugins
Target Scripts
Custom build phases can be added to targets:Resource Synthesizers
Automatic code generation for resources:Server Architecture
While the CLI is written in Swift, the Tuist Server is built with Elixir/Phoenix to handle web services, caching, and analytics at scale.
- CLI Architecture
- Server Architecture
Swift-based command-line tool:
- Fast local execution
- Direct Xcode integration
- File system operations
- Build orchestration
Integration Flow
When using Tuist Cloud features:Next Steps
Generated Projects
Learn how Tuist generates Xcode projects
Manifests
Understand Project.swift and other manifest files
Workspaces
Explore workspace organization
API Reference
Complete manifest API documentation