Core Technologies
- React Native - Cross-platform mobile framework
- TypeScript - Primary language for type safety
- React Navigation - Navigation framework
- Zustand - Foundation for custom store creators
- MMKV - High-performance local storage
- ethers/viem - Blockchain interactions
Architectural Principles
Type Safety First
All new code is written in TypeScript. Remaining JavaScript files are checked against an error baseline to prevent regressions.Domain-Organized Structure
The codebase is mid-migration toward domain-organized architecture:- New code →
src/features/withui/data/corelayer separation - Legacy code → Flat top-level directories (
components/,screens/,hooks/)
No Barrel Exports
Barrel exports (index.ts re-exports) are discouraged because they:- Defeat tree-shaking
- Hide circular dependencies
- Trigger cascading module loading
Type-Only Imports
Use thetype annotation for type-only imports:
Architecture Layers
State Management
Custom Zustand-based stores for client and server state
Navigation
React Navigation with custom sheet coordination
Storage
MMKV-based persistent storage system
Analytics
Rudderstack-based event tracking
Source Layout
Key Directories
src/features/ - Domain Features
src/features/ - Domain Features
New features organized by domain with
ui/, data/, and core/ layers.Each feature contains:components/orui/- React componentsstores/ordata/- State managementhooks/- Feature-specific hooksscreens/- Screen componentsutils/- Feature utilities
src/framework/ - Infrastructure
src/framework/ - Infrastructure
App-agnostic infrastructure including:
- HTTP clients
- Safe math utilities
- UI primitives
- Core utilities
src/state/ - State Stores
src/state/ - State Stores
Zustand stores organized by domain:
wallets/- Wallet managementswaps/- Swap statenfts/- NFT collectionsnavigation/- Navigation stateinternal/- Store creators
src/__swaps__/ - Swap Feature
src/__swaps__/ - Swap Feature
Swap functionality aliased as
@/swaps in tsconfig. Contains swap-specific logic, UI, and state.src/graphql/ - GraphQL Workspace
src/graphql/ - GraphQL Workspace
Separate yarn workspace for GraphQL code generation.
Legacy Systems
Several legacy state management systems remain in use:React Query
Located insrc/react-query/ - used for server state caching. Being replaced by createQueryStore.
Redux
Located insrc/redux/ - only used for:
- Charts
- Contacts
- ENS registration
- Gas management
- Settings
Testing
Migration to External Package
The in-repo store creators (createRainbowStore, createQueryStore, createDerivedStore) are being replaced by the external stores package.
The APIs are identical:
createRainbowStore→createBaseStorecreateQueryStore→createQueryStorecreateDerivedStore→createDerivedStore
Next Steps
Project Structure
Detailed directory structure and organization
State Management
Learn about Rainbow’s state management system