Skip to main content
Sovran follows a well-organized architecture that separates concerns and makes the codebase easy to navigate. This guide explains each directory and its purpose.

Root Directory Structure

Core Directories

app/ - Routes & Navigation

Expo Router uses file-based routing. Each file in app/ automatically becomes a route.
Screens should be thin: The app/ directory focuses on route orchestration. Business logic belongs in hooks, helpers, or stores.

components/ - UI Components

Components are organized by abstraction level:

hooks/ - React Hooks

Reusable hooks and Cashu-specific logic:
Cashu Integration: The hooks/coco/ directory contains all Cashu protocol integration logic. Always compose coco hooks rather than reimplementing them.

helper/ - Utility Functions

Stateless utility functions organized by domain:

stores/ - State Management

Zustand stores for global state (migrating from Redux):
Zustand Store Scoping: Some stores are profile-scoped, meaning they’re isolated per user profile. See .cursor/rules/zustand-store-scoping.mdc for details.

providers/ - Context Providers

React context providers for app-wide state:

utils/ - Utility Modules

Higher-level utilities:

Architecture Principles

Separation of Concerns

  1. Routes (app/) - Orchestration only, minimal logic
  2. Components (components/) - Pure presentation, receive data via props
  3. Hooks (hooks/) - Reusable stateful logic
  4. Helpers (helper/) - Pure functions, no side effects
  5. Stores (stores/) - Global state management
  6. Providers (providers/) - Context and initialization

Cashu Integration

Source of Truth: coco-cashu-core is the source of truth for Cashu types and logic.
  • Never redefine coco types
  • Compose coco hooks, don’t reimplement them
  • Import from coco, not @cashu/cashu-ts
The integration is layered:
  • coco-cashu-core - Core Cashu protocol logic
  • coco-cashu-expo-sqlite - SQLite storage adapter
  • coco-cashu-react - React hooks
  • coco-cashu-plugin-npc - NPC plugin
  • hooks/coco/ - App-specific Cashu hook composition
  • helper/coco/ - App-specific Cashu utilities

State Management Evolution

The app is migrating from Redux to Zustand:
  • Redux (redux/) - Legacy, being phased out
  • Zustand (stores/) - Current state management solution
  • Migration - stores/migrateSettings.ts handles data migration

Special Directories

.cursor/rules/ - Agent Documentation

Self-improving documentation for AI agents:
These docs are updated whenever gaps, stale info, or missing patterns are discovered.

scripts/ - Automation

The app uses nested navigators:
Modal flows use route groups:
  • (send-flow)/ - Send payment modals
  • (receive-flow)/ - Receive payment modals
  • (mint-flow)/ - Mint management modals
  • (map-flow)/ - Map view modals
  • (user-flow)/ - User profile modals

Next Steps

Tech Stack

Learn about the technologies used

Scripts Reference

Complete guide to all available scripts

Getting Started

Set up your development environment

API Reference

Explore the API documentation