Navigate and understand the Leather monorepo structure. Use when adding new code, finding existing implementations, or understanding package relationships...
This is a Turborepo monorepo with 3 apps and packages organized in a CLEAN architecture.
Presentation ā apps/, @leather.io/ui, @leather.io/features, @leather.io/provider
Application ā @leather.io/queries, @leather.io/services, @leather.io/rpc, @leather.io/sdk, @leather.io/cms
Domain ā @leather.io/models, @leather.io/bitcoin, @leather.io/stacks
State ā @leather.io/state (Redux Toolkit)
Foundation ā @leather.io/utils, @leather.io/constants, @leather.io/tokens, @leather.io/crypto, @leather.io/analytics
| App | Path | Purpose |
|---|---|---|
| extension | apps/extension/ |
Chrome/Firefox browser extension |
| mobile | apps/mobile/ |
React Native iOS/Android app (Expo) |
| web | apps/web/ |
React Router web app at app.leather.io |
| Package | Path | Scope |
|---|---|---|
@leather.io/models |
packages/models/ |
Domain types and interfaces |
@leather.io/bitcoin |
packages/bitcoin/ |
Bitcoin protocol utilities, address handling, PSBTs |
@leather.io/stacks |
packages/stacks/ |
Stacks protocol utilities, transactions |
Import rules for domain peers:
bitcoin/stacks should NOT import logic from models (only types)| Package | Path | Scope |
|---|---|---|
@leather.io/services |
packages/services/ |
Orchestration only ā API calls, DI, caching, multi-service coordination |
@leather.io/queries |
packages/queries/ |
React Query configurations |
@leather.io/query |
packages/query/ |
Legacy query package (migrate to @leather.io/queries) |
@leather.io/rpc |
packages/rpc/ |
RPC client abstraction |
@leather.io/sdk |
packages/sdk/ |
SDK utilities |
@leather.io/cms |
packages/cms/ |
CMS integration |
Services should NOT contain:
models, bitcoin, or stacks)utils)| Package | Path | Scope |
|---|---|---|
@leather.io/state |
packages/state/ |
Shared Redux Toolkit slices (wallet, keychains) |
App-specific state:
apps/extension/src/app/store/ ā {feature}.slice.ts conventionapps/mobile/src/store/ ā {feature}.write.ts (slice + actions) and {feature}.read.ts (selectors + hooks)| Package | Path | Scope |
|---|---|---|
@leather.io/utils |
packages/utils/ |
Generic utilities (money, formatting, guards) |
@leather.io/constants |
packages/constants/ |
Shared constants, currency decimals |
@leather.io/crypto |
packages/crypto/ |
Cryptographic primitives, key derivation |
@leather.io/tokens |
packages/tokens/ |
Token metadata |
@leather.io/analytics |
packages/analytics/ |
Mixpanel analytics |
| Package | Path | Scope |
|---|---|---|
@leather.io/ui |
packages/ui/ |
Shared UI components (React) |
@leather.io/features |
packages/features/ |
View models, UI transforms |
@leather.io/provider |
packages/provider/ |
App provider utilities |
Is it PURE business logic (no I/O, no async, no side effects)?
āā Yes ā Is it chain-specific protocol code?
ā āā Bitcoin protocol ā packages/bitcoin/src/
ā āā Stacks protocol ā packages/stacks/src/
ā āā No ā packages/models/src/
ā
Is it orchestration (API calls, DI, caching, coordination)?
āā Yes ā packages/services/src/{domain}/
ā
Is it a domain type/interface?
āā Yes ā packages/models/src/
ā
Is it a generic utility (not domain-specific)?
āā Yes ā packages/utils/src/
ā
Is it a UI component?
āā Yes ā packages/ui/src/components/
ā
Is it React Query configuration?
āā Yes ā packages/queries/src/
ā
Is it app-specific?
āā Yes ā apps/{app}/src/
src/index.ts exporting public API@leather.io/{package} not relative paths across packages{file}.spec.ts next to source filebitcoin-address.ts not bitcoinAddress.ts.web.tsx, .native.tsx, .shared.ts for cross-platform codepackages/bitcoin/src/utils/{feature-name}.ts
packages/bitcoin/src/utils/{feature-name}.spec.ts
Export from packages/bitcoin/src/utils/index.ts
packages/models/src/{area}.model.ts
packages/services/src/{domain}/{domain}.service.ts
Should only contain: API calls, DI, caching, multi-service coordination
packages/ui/src/components/{component-name}/
āā {component-name}.tsx
āā {component-name}.web.tsx (if platform-specific)
āā index.ts