How snapshot-labs/sx-monorepo works
Main Components
• Frontend ("apps/ui"): The Snapshot X front-end implemented in Vue. It handles user interactions, presentation logic, and communicates with backend services.
• Backend API ("apps/api"): This service exposes endpoints (including GraphQL) to interact with the core business logic. It includes blockchain-related operations such as dealing with IPFS, EVM, and Starknet functionalities.
• Mana Service ("apps/mana"): A specialized backend service that appears to manage relaying and blockchain connection tasks (handled for both Ethereum and Starknet). It is responsible for managing nonces, handling relayer functionalities, and possibly for off-chain computation.
• Shared Library (packages/sx.js): A client-side library that encapsulates authentication, clients for EVM and Starknet, strategies, encoding/decoding utilities, and other blockchain integration logic. This package is used by internal applications and may be publishable as an npm package.
• Infrastructure / DevOps: Includes configuration files (Docker Compose, GitHub workflows, scripts), changesets for versioning, and project-wide configurations (tsconfig, linting, etc.).
Relationships and Interactions
• The Mana service acts as a relayer, bridging front-end requests with blockchain networks (EVM and Starknet). Indicate its connection to both blockchain networks and to the API service.
• For external integrations, denote connections to:
• IPFS services (as seen in multiple ipfs.ts files) for decentralized file storage.
• Optional external services such as Herodotus API for messaging across layer 1 and layer 2 solutions.
Architectural Patterns and Design Principles
• Monorepo Structure: Emphasize how multiple apps and packages are organized within a single repository. This facilitates reusability and coordinated versioning using changesets.
• Modularity and Extensibility: The shared library (sx.js) and the clear delineation between EVM and Starknet modules highlight an architecture that can be extended to support various blockchain interactions.
Relevant Technologies and Frameworks
• Frontend: Vue.js, Vite, Tailwind CSS (evidenced by configuration files and UI asset structure).
• Blockchain Integrations: Libraries and modules handling EVM contracts, Starknet interactions, and IPFS integration.
• Testing and CI/CD: GitHub workflows, changesets, Turbo (referenced by turbo.json), Docker.
• Shared Utility Libraries: Provided by packages/sx.js that contain clients, executors, strategies, and utilities supporting multiple blockchain protocols.
• Snapshot X UI (apps/ui)
• API Service (apps/api)
• Mana Service (apps/mana)
• Shared Library (sx.js)
• External Blockchain Networks (Ethereum Sepolia, Starknet Sepolia)
• External tools (IPFS, Herodotus API)
• CI/CD & Deployment Tools (GitHub workflows, Docker)
• Data flow between UI and backend services.
• Communication between backend services and external blockchain services.
• Including legends or labels that denote:
• Communication protocols (e.g., REST, GraphQL).
• Technology stacks (e.g., Vue, Node.js, TypeScript).
• Environment details (development vs. production containers).
Final Reminder
• This detail will aid in both understanding existing dependencies and planning for future architectural improvements.