How daimo-eth/daimo works
Major Components
• Mobile App – under apps/daimo-mobile. This is a React Native/Expo project that includes both a native layer (for interfacing with device hardware like the secure enclave for key management) and a Typescript React Native layer (UI, navigation, and business logic).
• Web App – under apps/daimo-web. It is a NextJS project that displays deep links, onboarding, and web functionalities.
• API Server – under packages/daimo-api. A Node/TypeScript application that runs a TRPC API, handles business logic, integrates with a Postgres database (and an indexer) and interacts with blockchain contracts.
• Smart Contracts – under packages/contract (and also daimo-contract). These consist of Solidity contracts built with Forge. They implement ERC-4337 account abstraction along with additional functionality such as account factories, paymaster, and the contract wallet.
• Common Code/Models – under packages/daimo-common. This layer encapsulates shared data models and utilities that are used across the mobile app, web app, and API.
• Hardware Enclave & Passkeys – represented by packages/daimo-expo-enclave and packages/daimo-expo-passkeys. These integrate native modules (in Kotlin/Swift) with the Expo ecosystem to facilitate secure key storage and crypto operations.
• User Operation Logic – in packages/daimo-userop for account abstraction handling (helps build and send “user ops” for transactions).
• Testing & CI/CD – tools like Maestro (with configuration files in apps/daimo-mobile/.maestro), GitHub workflows (.github/workflows), and various test folders (for example, in apps/daimo-mobile/test) indicate automated end-to-end testing.
• Auxiliary Tools – a scratchpad app, documentation, auditing reports (PDFs under audits), and more to support rapid development and diagnostics.
Out the Relationships and Interactions
• Clients (mobile and web) are the primary interfaces. They send requests (transactions or API calls) to the backend.
• The mobile app communicates with the API on localhost:3000 (or via a hosted API), and it also might take direct actions with the local hardware (via the expo-enclave/passkeys modules) to sign transactions.
• The API (daimo-api) serves as a bridge between the user-facing apps and the blockchain. It processes requests, performs validations, queries the database, and interacts with smart contracts.
• Smart contracts are deployed on the Base blockchain and manage account abstraction (ERC-4337 functionality). They are called by both the API and sometimes directly by the clients.
• Shared libraries in daimo-common ensure consistency in data models, cryptographic functions, and configuration between the various parts.
• CI/CD, testing (e.g., Maestro for mobile tests) and audit artifacts ensure that the high level of security and quality is maintained across releases.
Important Architectural Patterns and Technologies
• Full-Stack Separation: Clear distinction among client (mobile/web), API/backend, and blockchain contract layers.
• Micro-modular Design: Each major function is split into packages (API, contracts, common utilities, enclave interfaces, and user op building) that interact via well-defined interfaces.
• Secure and Non-Custodial Design: Emphasizing client device key storage inside secure enclaves and leveraging passkeys for authentication.
• Account Abstraction (ERC-4337): The smart contracts implement advanced wallet functionalities.
• Infrastructure & DevOps: Presence of CI/CD pipelines, automated testing (Maestro and GitHub workflows), and Foundry tooling for contract development.
Final Checklist
• Every component (mobile app, web app, API, blockchain contracts, shared libraries, testing frameworks) is present and clearly labeled.
• Element with technology stack information (e.g., Typescript, Expo, NextJS, Solidity, Foundry, etc.).