Overview
Trezor Suite uses a multi-stage build process. You must build core libraries before running applications. The build system uses Webpack for bundling and Nx for task orchestration.Quick Start
After cloning the repository and installing dependencies:Build Commands
Essential Builds
Build only the core libraries required for development:@trezor/suite-data- Data layer and configuration@trezor/transport-bridge- Device transport layer- Message system signed configuration
Build time: 3-5 minutesThis is a parallel build that runs multiple tasks simultaneously.
Full Library Build
Build all libraries in the monorepo:build:lib target.
Incremental Builds with Nx
Build only libraries affected by your changes:- Git diff against the base branch
- Dependency graph analysis
- Build cache status
Nx caching can significantly speed up rebuilds. The cache is stored in
.nx/cache.Application Builds
Web Application
Development Build
Run a development server with hot module replacement:
- Runs on
http://localhost:8000 - Includes source maps
- Hot module replacement enabled
- Development mode React DevTools
Production Build
Create an optimized production build:Output:
packages/suite-web/build/Build time: 5-10 minutesThe production build is minified, optimized, and includes hashed filenames for caching.
Desktop Application
Development Build
Run the Electron app in development mode:Features:
- Hot reload for renderer process
- React DevTools available (press Cmd/Ctrl+R to reload)
- Source maps enabled
- Development console access
To use React DevTools, open DevTools first, then reload the renderer process (Cmd/Ctrl+R).
Mobile Application
Mobile builds require additional platform setup for iOS and Android.
Prebuild Native Projects
Generate native iOS and Android projects:Clean prebuild (removes existing native projects):
Build Configuration
Webpack Configuration
Webpack configs are located in thepackages/suite-build package:
Environment Variables
Optional environment configuration using.env.local:
Experimental Builds
Vite Development Build
- Faster hot module replacement
- Instant server start
- Lightning-fast updates
- May not match production behavior exactly
- Use
yarn suite:devfor production-like development
Build Optimization
TypeScript Compilation
Type-check all packages:Type-checking is separate from builds. The build process uses Babel or esbuild for transpilation, not
tsc.Project References
Update TypeScript project references for optimal incremental builds:- Creating new packages
- Changing package dependencies
- Modifying tsconfig.json files
Caching
Nx Cache
Nx caches build outputs and test results:TypeScript Cache
ESLint and TypeScript use caching for faster runs:Build Troubleshooting
Common Issues
Dependency Issues
Check for dependency problems:Clean Slate
Start completely fresh:Build Performance Tips
Incremental Builds
- Use Nx affected commands - Only rebuild what changed
- Skip unnecessary builds - Use
build:essentialinstead ofbuild:libs - Keep Nx cache - Don’t delete
.nx/cacheunless necessary - Update incrementally - Run
yarnfrequently to avoid large dependency updates
Development Workflow
Resource Usage
System Requirements for Building:
- RAM: 8GB minimum, 16GB recommended
- CPU: Multi-core processor (builds use parallel processing)
- Disk: 10GB free space (including node_modules)
Build Scripts Reference
Library Scripts
| Command | Description | Time |
|---|---|---|
yarn build:libs | Build all libraries | 10-15 min |
yarn build:essential | Build core libraries only | 3-5 min |
yarn nx:build:libs | Build affected libraries | Varies |
Application Scripts
| Command | Description |
|---|---|
yarn suite:dev | Web dev server |
yarn suite:dev:desktop | Desktop dev server |
yarn suite:dev:vite | Vite dev server (experimental) |
yarn suite:build:web | Production web build |
yarn suite:build:web:preview | Build and preview production |
Mobile Scripts
| Command | Description |
|---|---|
yarn native:prebuild | Generate native projects |
yarn native:android | Build for Android |
yarn native:ios | Build for iOS |
yarn native:adhoc | Ad-hoc distribution build |
Utility Scripts
| Command | Description |
|---|---|
yarn update-project-references | Update TypeScript references |
yarn verify-project-references | Check TypeScript references |
yarn type-check | Type-check all packages |
yarn type-check:force | Type-check with cache purge |
Next Steps
- Learn how to Run Development Servers
- Read about Testing
- Review Code Style Guidelines