Documentation Index
Fetch the complete documentation index at: https://mintlify.com/snapshot-labs/sx-monorepo/llms.txt
Use this file to discover all available pages before exploring further.
Overview
The UI application is a modern Vue 3 frontend that provides a unified interface for interacting with both onchain governance protocols (Snapshot X, Compound Governor, OpenZeppelin Governor) and offchain Snapshot spaces.The UI communicates with the API service via GraphQL for data queries and Mana via JSON-RPC for gasless transaction submission.
Quick Start
Development Server
Start the Vite development server on port 8080:http://localhost:8080.
Other Commands
Technology Stack
Vue 3
Composition API with
<script setup> syntaxVite
Lightning-fast dev server and build tool (rolldown-vite 7.3.1)
Pinia
State management for client-side state
TanStack Query
Server state management (
@tanstack/vue-query 5.64.2)Vue Router
Client-side routing (v4.2.5)
TailwindCSS
Utility-first styling with custom design system
Additional Libraries
- @snapshot-labs/sx - Governance SDK
- @apollo/client - GraphQL client
- Ethers.js v6 - Ethereum interactions
- Starknet.js 7.6.4 - Starknet interactions
- Reown AppKit - Wallet connections
- Tiptap - Rich text editor
- VueUse - Vue composition utilities
Architecture
Data Flow
Onchain Spaces:- Fetch data from API (GraphQL)
- Submit transactions via Mana (JSON-RPC) for gasless voting or directly to networks
- Fetch data from snapshot-hub (GraphQL)
- Submit signed messages to snapshot-sequencer (JSON-RPC)
Auto-Imports
Auto-imported APIs:Component Structure
All components use TypeScript setup syntax:Component Directories
| Directory | Purpose |
|---|---|
Ui/ | Base reusable components (Button, Modal, Form, etc.) |
Modal/ | Specialized modal components |
App/ | App-level components (navigation, sidebars) |
Layout/ | Page layout wrappers |
Site/ | Site-wide elements |
Landing/ | Landing page components |
Widget/ | Embeddable widget components |
State Management
Pinia Stores
For client-side state (UI preferences, contacts, followed spaces):Vue Query
For server state with reactive query keys:Always handle
isPending, isError, and data states in templates when using Vue Query.Styling with Tailwind
Custom Design System
Spacing Scale (non-standard):0= 0px,0.5= 2px,1= 4px,1.5= 6px2= 8px,2.5= 12px,3= 16px,3.5= 20px4= 24px,5= 32px,6= 40px,7= 48px8= 64px,9= 72px,10= 80px,11= 88px,12= 96px
xs= 14px,sm= 16px,base= 18pxmd= 20px,lg= 22px,xl= 28px
minimum= 320px,xs= 420px,sm= 544pxmd= 768px,lg= 1012px,xl= 1280px2xl= 1536px,3xl= 1844px,maximum= 1900px
Theme Colors
Always use
skin-* classes for theming - no hardcoded colors!GraphQL Code Generation
| Output Directory | Schema Source |
|---|---|
src/networks/common/graphqlApi/gql/ | ../api/.checkpoint/schema.gql |
src/helpers/auction/gql/ | Subgraph endpoint |
src/helpers/auction/referral/gql/ | Brokester API |
File Structure
Testing
- Vitest for unit tests with happy-dom
- @vue/test-utils for component testing
- Storybook 9 for component documentation
Path Alias
vite.config.ts via resolve.alias.
Electron Support
The UI can run as a desktop application:Key Dependencies
Frompackage.json:
Best Practices
- Use
<script lang="ts" setup>for all components - Use
skin-*color classes for theming - Put queries in
src/queries/using Vue Query patterns - Use custom Tailwind spacing scale
- Don’t manually import auto-imported APIs
- Don’t edit
gql/directories