How safe-global/safe-wallet-monorepo works
This repository is a sophisticated monorepo for Safe{Wallet} that contains multiple workspaces (apps and packages) managed by Yarn Workspaces. The core components include:
Apps
• The web application (in apps/web), built with Next.js and React, serves as the primary user interface for desktop users.
• The mobile application (in apps/mobile) uses Expo (thus React Native) to serve mobile platforms.
• Both apps share similar design principles like testing (Jest, Cypress) and linting/formatting.
Packages
• Shared libraries such as “packages/store” and “packages/utils” provide state management, common utilities, and shared business logic.
• These packages abstract shared functionality, making it reusable across the different apps in the monorepo.
Configuration & Tooling
• The “config” directory and various scripts within the repository (e.g., GitHub actions workflows, husky hooks) manage CI/CD, linting, testing, and deployment.
• Yarn Workspaces are leveraged to coordinate dependency management and script execution across the apps and packages.
Additional Elements
• A rich testing infrastructure exists (with unit tests, end-to-end tests, storybook, etc.) ensuring quality throughout.
• There are various third-party integrations (Expo for mobile, Next.js for web, analytics, push notifications, etc.) that can be noted as external services/components.
• “Safe{Wallet} Web App” (Next.js/React) – Represented as a primary frontend component.
• “Safe{Wallet} Mobile App” (Expo/React Native) – Another standalone frontend component.
• “Shared Packages & Libraries” – Group together packages like “store” (state management, API interfaces) and “utils” (utilities, common functions).
• “Configuration/Tooling” – This can be a smaller section that encompasses CI/CD workflows (GitHub Actions), scripts, pre-commit hooks (Husky/ESLint/Prettier), and Yarn’s workspace management.
B. Show the relationships and interactions:
• That both apps rely upon a common “state management” layer (from the packages/store) and domain-specific utilities (from packages/utils).
• Data flows from users interacting with the apps that, in turn, communicate with external APIs or blockchain services through these shared packages.
C. Highlight architectural patterns and design principles:
• Monorepo structure with Yarn Workspaces for dependency management and unified versioning.
• Separation of concerns: distinct apps for web and mobile, with shared libraries for business logic and common code.
• Emphasis on testing and continuous integration using GitHub Actions and pre-commit hooks.
• Usage of modern frameworks (Next.js and Expo) that provide their own internal abstraction layers.
D. Incorporate key technologies and frameworks:
• Next.js, React, and TypeScript for the web frontend.
• Expo/React Native for the mobile frontend.
• Yarn Workspaces, ESLint, Prettier, Jest, and Cypress integrated as part of the development and deployment workflow.
• Shared packages utilizing modern JavaScript/TypeScript patterns and possibly core SDK integrations for blockchain interactions (e.g., safeCoreSDK provided in hooks and services).
• Optionally, include a section for GitHub workflows (e.g., “cypress tests”, “release pipelines”, “mobile deployment”) to showcase the DevOps workflow.
F. Final guidelines:
• Notable technologies next to their respective components (e.g., “Next.js + React” for the web, “Expo” for mobile, “Yarn Workspaces” for repository management).
• If there are any APIs or blockchain communication modules (for signing transactions, notifications, etc.), note them as external connectors.