Architecture
Technical description of the Ledger Wallet monorepo folder structure, import rules, and platform-specific file conventions.
Root Folder Structure
The monorepo is organized into the following areas:
| Folder | Purpose |
|---|---|
apps/ | Platform-specific cross-cutting concerns |
features/ | Feature modules with high cohesion and low coupling |
libs/ | Legacy shared libraries β being progressively migrated into features |
ββ apps/
β ββ ledger-live-desktop/
β β ββ state-manager/
β β β ββ configureStore.ts
β β ββ router/
β β ββ router.ts
β ββ ledger-live-mobile/
β ββ state-manager/
β β ββ configureStore.ts
β ββ router/
β ββ router.ts
ββ features/
β ββ {featureName}/
ββ libs/ // Legacy - being migrated into featuresApps Folder
The apps/ folder contains platform-specific cross-cutting concerns:
- Observability β Logging, monitoring, error tracking
- Routing β Platform-specific navigation (imports routes from features)
- Analytics β Platform-specific analytics utilities
- State Manager β Store configuration
Apps should not contain business logic. They wire together features and provide platform infrastructure.
Features Folder
Features are self-contained modules with high cohesion and low coupling.
Feature Structure
features/
ββ posts/
ββ components/
β ββ post.web.ts
β ββ post.native.ts
β ββ post.test.ts
ββ screens/
β ββ components/
β ββ posts.web.ts
β ββ posts.native.ts
β ββ posts.test.ts
ββ data-layer/
β ββ entities/
β ββ post/
β ββ postSchema.ts
β ββ postSchema.test.ts
β ββ postSelectors.ts
β ββ postSelectors.test.ts
β ββ postActions.ts
β ββ postActions.test.ts
β ββ postSlice.ts
β ββ postSlice.test.ts
ββ routes/
β ββ route.ts
ββ hooks/
ββ utils/Feature Subfolders
| Subfolder | Purpose |
|---|---|
components/ | Reusable UI components within the feature |
screens/ | Screen-level components (can have their own components/ subfolder) |
data-layer/ | State management: entities, slices, selectors, actions, API |
routes/ | Platform-agnostic routing abstraction |
hooks/ | Feature-specific custom hooks |
utils/ | Feature-specific utilities |
Platform-Specific Files
Use file extensions to target specific platforms:
| Extension | Platform |
|---|---|
.web.ts | Web and Desktop (Electron) |
.native.ts | React Native (iOS + Android) |
.ios.ts | iOS only |
.android.ts | Android only |
| No extension | Shared across all platforms |
Example
components/
ββ userInfo.ts // Shared logic
ββ userInfo.web.ts // Web/Desktop UI
ββ userInfo.native.ts // Mobile UI
ββ userInfo.test.ts // TestsTest files (*.test.ts) should always be colocated with their source files.
Import Rules
Strict import boundaries enforce the architectural layers.
Forbidden Imports
These import directions are not allowed:
features/**βapps/**
Allowed Imports
These import directions are allowed:
apps/**βfeatures/**(apps wire features together)features/{feature}/**βfeatures/{feature}/**(within the same feature)
Import Flow Diagram
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β apps/ β
β (can import from features) β
βββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββ
β features/ β
βββββββββββββββββββSee also
- How to Structure a Feature β Step-by-step guide for creating features
- Component Patterns β Doβs and Donβts for naming and folder organization
- Architecture Decisions β Why we adopted this folder structure
Last updated on