Monorepo Structure
Trezor Suite is organized as a monorepo using Yarn workspaces, containing multiple applications and shared packages. This structure enables code sharing, consistent tooling, and unified development workflows.Overview
The repository contains three main projects:Trezor Connect
Developer API for integrating Trezor into third-party applications
Trezor Suite
Desktop and web application for managing Trezor hardware wallets
Suite Mobile
Native mobile application for iOS and Android
Workspace Configuration
The monorepo uses Yarn 4.12.0 with workspace configuration defined inpackage.json:
Node.js version 24 is required, managed via NVM. See the
.nvmrc file in the repository root.Directory Structure
High-Level Layout
Packages Directory
Thepackages/ directory contains core libraries, Trezor Connect, and reusable components.
Key Packages
- Connect Packages
- Suite Packages
- Other Packages
@trezor/connect
@trezor/connect
Main Connect API
- Entry point for all Trezor Connect functionality
- Version 9 (rewritten for Suite monorepo)
- Used by both Suite and third-party integrations
packages/connect/Documentation@trezor/connect-web
@trezor/connect-web
Web-specific Connect implementation
- Browser-compatible version
- Uses WebUSB for device communication
- Loaded as JavaScript module in Suite Web
packages/connect-web/@trezor/connect-mobile
@trezor/connect-mobile
Mobile Connect implementation
- React Native compatible
- Uses native USB/Bluetooth transports
- Optimized for mobile platforms
packages/connect-mobile/@trezor/connect-explorer
@trezor/connect-explorer
Interactive API explorer
- Test Connect methods in browser
- Example implementations
- Development tool
packages/connect-explorer/Suite Directory
Thesuite/ directory contains packages specific to the desktop and web applications.
These packages are specific to Suite Desktop and Suite Web, and are not used in Suite Mobile.
Suite Native Directory
Thesuite-native/ directory contains the mobile application and its modules.
Structure
Key Mobile Packages
@suite-native/app
Main mobile application entry point
@suite-native/atoms
UI primitives and design system
@suite-native/navigation
Navigation structure and routing
@suite-native/state
Redux store configuration
Module Organization
Module Organization
Mobile features are organized as self-contained modules with the
module-* prefix:module-home/- Home screenmodule-accounts-management/- Account managementmodule-send/- Send functionalitymodule-settings/- Settings screensmodule-device-onboarding/- Device setup flowsmodule-trading/- Exchange features- etc.
- React components
- Navigation screens
- Business logic
- Tests
Suite Native is built with React Native 0.81.5 and Expo SDK 54.
Suite Common Directory
Thesuite-common/ directory contains code shared between Suite (Desktop/Web) and Suite Native.
Shared Packages
Key principle: Code in
suite-common/ must work on both React (web/desktop) and React Native (mobile).wallet-core
Redux slices, selectors, and wallet business logic
wallet-types
TypeScript definitions for wallet operations
suite-types
Application-wide TypeScript types
suite-constants
Shared constants and enums
Build System
Package Manager
Yarn 4.12.0 (Berry) with:- Workspace protocol for internal dependencies
- Plug’n’Play (PnP) for faster installs
- Constraints and policies for consistency
Build Tools
- TypeScript
- Bundlers
- Testing
- Nx
TypeScript 5.8.3 used throughout:
- Project references for incremental builds
- Strict type checking
- Path aliases via
tsconfig.base.json
Dependency Management
Workspace Dependencies
Internal dependencies use theworkspace:* protocol:
Version Resolutions
Critical packages are pinned in the rootpackage.json:
Development Workflow
Initial Setup
Common Commands
Architecture Patterns
Code Organization Principles
Feature-Based Organization
Feature-Based Organization
Packages are organized by feature/domain rather than technical layer:✅ Good:❌ Bad:
Dependency Direction
Dependency Direction
Clear dependency hierarchy:Lower-level packages never depend on higher-level ones.
Platform Separation
Platform Separation
Platform-specific code is isolated:
suite/*- Desktop/Web onlysuite-native/*- Mobile onlysuite-common/*- Shared across platformspackages/*- Platform-agnostic when possible
Naming Conventions
Naming Conventions
Consistent package naming:
@trezor/*- Core libraries, Connect, Suite Web/Desktop@suite-native/*- Mobile-specific packages@suite-common/*- Shared platform-agnostic code@suite/*- Desktop/Web-specific utilities
Performance Considerations
Build Caching
Nx caches build outputs for faster rebuilds
Incremental Builds
TypeScript project references enable incremental compilation
Code Splitting
Webpack splits bundles for optimal loading
Tree Shaking
Unused code is eliminated in production builds
Initial setup takes 15-20 minutes. Incremental builds are much faster thanks to caching.
Next Steps
Explore specific architectures:Suite Desktop
Electron-based desktop architecture
Suite Web
Browser-based web architecture
Suite Mobile
React Native mobile architecture