This diagram shows the dependencies between features in the Bull Bitcoin Mobile application. It helps visualize the dependency graph and ensures there are no cyclic dependencies.
Diagram Type: This is a Package Dependency Diagram (also known as Module Dependency Graph or Component Dependency Diagram in UML).
graph TB
%% Core infrastructure
CORE[Core<br/>---<br/>Database, Secure Storage,<br/>API Clients, Tor HTTP Client, UI Kit,<br/>DI & Router setup,<br/>PIN encrypted storage,<br/>Domain Primitives/Value Objects]
PRIMITIVES[Primitives Package]
BULL_PAYJOIN[Bull Payjoin Package<br/>Public contract]
%% Feature modules
SETTINGS[Settings]
TOR[Tor]
PIN_CODE[Pin Code]
LABELS[Labels]
SECRETS[Secrets]
HW_WALLETS[Hardware Wallets]
BTC_PRICE[Bitcoin Price]
NETWORK[Network]
BIP85[BIP85]
FEES[Fees]
WALLETS[Wallets]
EXCHANGE[Exchange]
APP_STARTUP[App Startup]
UTXO_MGMT[UTXO Management]
ADDRESS_MGMT[Address Management]
RECIPIENTS[Recipients]
FUNDING[Funding]
BACKUPS[Backups]
SWAPS[Swaps]
WITHDRAWAL[Withdrawal]
STATUS[Status]
SEND[Send]
RECEIVE[Receive]
TRANSFER[Transfer]
TX_HISTORY[Transaction History]
BG_TASKS[Background Tasks]
AUTOSWAPS[AutoSwaps]
DCA[DCA]
SELL[Sell]
PAY[Pay]
BUY[Buy]
COINS[Coins / UTXOs]
ANNOUNCEMENTS[Announcements]
CONSOLIDATION[Consolidation]
%% Dependencies to Core (all features depend on Core, but showing it explicitly would clutter the diagram)
%% Instead, we note this in the documentation below
%% Extracted package dependencies
CORE --> PRIMITIVES
CORE --> BULL_PAYJOIN
BULL_PAYJOIN --> PRIMITIVES
%% Feature-to-feature dependencies (extracted from draw.io diagram)
ADDRESS_MGMT --> LABELS
ANNOUNCEMENTS --> SETTINGS
APP_STARTUP --> WALLETS
AUTOSWAPS --> TRANSFER
BIP85 --> SECRETS
BIP85 --> SETTINGS
BACKUPS --> BIP85
BACKUPS --> TOR
BACKUPS --> WALLETS
BTC_PRICE --> SETTINGS
BUY --> EXCHANGE
BUY --> RECEIVE
BUY --> BULL_PAYJOIN
COINS --> UTXO_MGMT
COINS --> LABELS
COINS --> WALLETS
DCA --> RECEIVE
EXCHANGE --> SETTINGS
FEES --> NETWORK
FUNDING --> EXCHANGE
HW_WALLETS --> CORE
LABELS --> CORE
PAY --> RECIPIENTS
PAY --> BULL_PAYJOIN
PIN_CODE --> CORE
RECEIVE --> BULL_PAYJOIN
RECEIVE --> SETTINGS
RECEIVE --> SWAPS
RECEIVE --> TX_HISTORY
RECIPIENTS --> EXCHANGE
SECRETS --> CORE
SELL --> EXCHANGE
SELL --> BULL_PAYJOIN
SEND --> CONSOLIDATION
SEND --> FEES
SEND --> NETWORK
SEND --> BULL_PAYJOIN
SEND --> SWAPS
SEND --> TX_HISTORY
SEND --> UTXO_MGMT
SEND --> WALLETS
SETTINGS --> CORE
SETTINGS --> BULL_PAYJOIN
STATUS --> BULL_PAYJOIN
SWAPS --> BULL_PAYJOIN
SWAPS --> LABELS
SWAPS --> UTXO_MGMT
TOR --> CORE
TRANSFER --> CONSOLIDATION
TRANSFER --> SEND
TRANSFER --> RECEIVE
TX_HISTORY --> BULL_PAYJOIN
TX_HISTORY --> SWAPS
TX_HISTORY --> WALLETS
UTXO_MGMT --> LABELS
UTXO_MGMT --> WALLETS
WALLETS --> BIP85
WALLETS --> CONSOLIDATION
WALLETS --> HW_WALLETS
WALLETS --> NETWORK
WALLETS --> SECRETS
WALLETS --> SETTINGS
WALLETS --> SWAPS
WITHDRAWAL --> RECIPIENTS
%% Styling
classDef coreStyle fill:#2d3748,stroke:#4a5568,stroke-width:3px,color:#fff
classDef packageStyle fill:#234e52,stroke:#319795,stroke-width:2px,color:#e6fffa
classDef featureStyle fill:#1a202c,stroke:#2d3748,stroke-width:2px,color:#e2e8f0
class CORE coreStyle
class PRIMITIVES,BULL_PAYJOIN packageStyle
class SETTINGS,TOR,PIN_CODE,LABELS,SECRETS,HW_WALLETS,BTC_PRICE,NETWORK,BIP85,FEES,WALLETS,EXCHANGE,APP_STARTUP,UTXO_MGMT,ADDRESS_MGMT,RECIPIENTS,FUNDING,BACKUPS,SWAPS,WITHDRAWAL,STATUS,SEND,RECEIVE,TRANSFER,TX_HISTORY,BG_TASKS,AUTOSWAPS,DCA,SELL,PAY,BUY,COINS,ANNOUNCEMENTS,CONSOLIDATION featureStyle
- Modules/Packages: Each box represents a self-contained feature/package
- Dependencies: Arrows show "depends on" relationships (A → B means "A depends on B")
- Direction: Dependencies flow from dependent to dependency (not data flow)
- Module Names: Clear identification of each package/feature
- Dependency Direction: Arrows indicating which module depends on which
- Optional Elements (can be added):
- Dependency type labels (e.g., "uses facade", "imports types")
- Stereotypes like
<<core>>,<<feature>>,<<infrastructure>> - Access modifiers (public/internal APIs)
- Dependency cardinality (required vs optional)
- No Cyclic Dependencies: Features must not create circular dependency chains
- Core Independence: Core must not depend on any feature
- Feature Isolation: Features should communicate through well-defined facades/interfaces
- Layered Dependencies: Dependencies flow one way —
shell → features → packagesacross modules, andui → presentation → domain → datawithin a feature. Under the melos migration eachlib/core/<domain>becomes apackages/<domain>and these turn into compile-time boundaries. See ARCHITECTURE.md.
Important: All features implicitly depend on Core for foundational services. These dependencies are not shown in the diagram to reduce visual clutter.
-
Infrastructure Services:
- Database (Drift/SQLite)
- Secure Storage instance (Flutter Secure Storage)
- API Clients (REST/GraphQL clients)
- Factory for a HTTP client to connect to Tor
- UI Kit (shared widgets, theme)
- DI setup and interfaces (Service Locator pattern)
- Router setup and interfaces (Navigation)
- PIN encrypted storage
-
Core Primitives:
- Canonical location:
packages/primitives; compatibility exports remain inlib/coreduring migration. - Extracted examples:
Failure,Result,Fingerprint, network types,Outpoint,Sats, andFeeRate. Security-domain types such asSecretremain future extraction work. - Shared types used across multiple features, avoiding redundant definitions
- Immutable, validated value objects that ensure domain integrity
- Canonical location:
Migration note:
lib/coreis shared infrastructure (no business logic). Shared domain modules that historically landed inlib/core/<domain>(e.g.wallet,secrets) graduate intopackages/<domain>under the melos workspace — each exposing its repository interfaces + domain types + shared use-cases through a public API, never a bloc or screen. See ARCHITECTURE.md.
- Core: Foundation for all features
- Wallets: Used by Send, UTXO Management, Transaction History, Backups, App Startup
- Secrets: Used by Wallets, BIP85
- Settings: Used by Wallets, Exchange, BIP85, Bitcoin Price
- Recipients: Used by Pay, Withdrawal
- UTXO Management: Used by Send, Swaps, Payjoin
- Send: Depends on Fees, Network, Payjoin, Swaps, UTXO Management, Wallets
- Receive: Depends on Payjoin, Swaps
- AutoSwaps: Depends on Transfer
- Backups: Depends on BIP85, Tor, Wallets
- Buy, Sell, Funding: All depend on Exchange
- Recipients: Depends on Exchange
To verify no cyclic dependencies exist, you can:
- Manual trace: Follow any path through the graph - it should never return to a previously visited node
- Automated tools: Use
dart pub depsor custom dependency analysis scripts - Import analysis: Review import statements in facade/public API files
- Add dependency type labels (e.g., "uses facade", "imports primitives")
- Document which specific APIs each feature exposes
- Add dependency cardinality (required vs optional dependencies)
- Include compile-time vs runtime dependency distinction
- Add layer groupings (ui, presentation, domain, data) per ARCHITECTURE.md