Skip to content

yaji33/swarmi

Repository files navigation

🐝 Swarmi

Mobile-native AI-powered DeFi companion on Solana.
Automate yield strategies. Onboard web3 novices through collaborative AI mentor swarms.


Hackathon Scoring Alignment

Criteria (25% each) How Swarmi Delivers
Stickiness & PMF Gamified swarm mentoring, SKR badges, leaderboard hooks
User Experience 3-tap onboarding, natural language mentor chat, biometric signing
Innovation / X Factor RL-inspired on-device swarm mentoring β€” turns DeFi education into guided participation
Presentation & Demo Polished APK, live devnet transactions, recorded walkthrough

Tech Stack

Layer Technology
Framework Expo + React Native (create-solana-dapp β€” Solana Mobile template)
Blockchain @solana/kit, @solana-mobile/mobile-wallet-adapter
Protocols Kamino (yield vaults), Jupiter (swaps), SPL Token (USDC transfers)
Styling Uniwind (Tailwind for React Native)
State Zustand
AI / ML TensorFlow.js React Native β€” on-device, quantized model
Navigation Expo Router (file-based)
Build EAS β†’ APK (buildType: apk)
RPC Helius (primary) β†’ public mainnet (fallback)

Project Structure

swarmi/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ app/                        # Expo Router β€” file-based screens
β”‚   β”‚   β”œβ”€β”€ _layout.tsx             # Root layout (providers, nav shell)
β”‚   β”‚   β”œβ”€β”€ index.tsx               # Splash / entry redirect
β”‚   β”‚   β”œβ”€β”€ (onboarding)/
β”‚   β”‚   β”‚   β”œβ”€β”€ welcome.tsx         # Splash + CTA
β”‚   β”‚   β”‚   β”œβ”€β”€ connect.tsx         # Wallet connect (MWA)
β”‚   β”‚   β”‚   └── swarm-intro.tsx     # First mentor chat
β”‚   β”‚   └── (main)/
β”‚   β”‚       β”œβ”€β”€ _layout.tsx         # Bottom tab navigator
β”‚   β”‚       β”œβ”€β”€ dashboard.tsx       # Balances + live feed
β”‚   β”‚       β”œβ”€β”€ optimizer.tsx       # AI yield optimizer
β”‚   β”‚       β”œβ”€β”€ payments.tsx        # Micropayment scheduler
β”‚   β”‚       └── simulate.tsx        # Offline simulation mode
β”‚   β”‚
β”‚   β”œβ”€β”€ components/                 # Shared UI primitives
β”‚   β”‚   β”œβ”€β”€ GlassCard.tsx
β”‚   β”‚   β”œβ”€β”€ ParticleSwarm.tsx
β”‚   β”‚   β”œβ”€β”€ SwarmAvatar.tsx
β”‚   β”‚   β”œβ”€β”€ PrimaryButton.tsx
β”‚   β”‚   β”œβ”€β”€ BalanceDisplay.tsx
β”‚   β”‚   β”œβ”€β”€ YieldFeedItem.tsx
β”‚   β”‚   └── ProgressBar.tsx
β”‚   β”‚
β”‚   β”œβ”€β”€ features/                   # Feature-scoped logic + UI
β”‚   β”‚   β”œβ”€β”€ onboarding/
β”‚   β”‚   β”‚   β”œβ”€β”€ SwarmMentorChat.tsx
β”‚   β”‚   β”‚   β”œβ”€β”€ BadgeUnlock.tsx
β”‚   β”‚   β”‚   └── useSwarmMentor.ts
β”‚   β”‚   β”œβ”€β”€ vault/
β”‚   β”‚   β”‚   β”œβ”€β”€ YieldCard.tsx
β”‚   β”‚   β”‚   β”œβ”€β”€ ExecuteFlow.tsx
β”‚   β”‚   β”‚   └── useYieldVault.ts
β”‚   β”‚   β”œβ”€β”€ payments/
β”‚   β”‚   β”‚   β”œβ”€β”€ PaymentForm.tsx
β”‚   β”‚   β”‚   └── usePayments.ts
β”‚   β”‚   └── simulation/
β”‚   β”‚       β”œβ”€β”€ SimChart.tsx
β”‚   β”‚       └── useSimulation.ts
β”‚   β”‚
β”‚   β”œβ”€β”€ hooks/                      # Cross-feature hooks
β”‚   β”‚   β”œβ”€β”€ useWallet.ts            # MWA session + auth state
β”‚   β”‚   β”œβ”€β”€ useSolanaRpc.ts         # RPC queries via @solana/kit
β”‚   β”‚   └── useOnChainBalance.ts    # SOL + USDC balance polling
β”‚   β”‚
β”‚   β”œβ”€β”€ stores/                     # Zustand state slices
β”‚   β”‚   β”œβ”€β”€ walletStore.ts
β”‚   β”‚   β”œβ”€β”€ portfolioStore.ts
β”‚   β”‚   └── swarmStore.ts
β”‚   β”‚
β”‚   β”œβ”€β”€ lib/
β”‚   β”‚   β”œβ”€β”€ solana/
β”‚   β”‚   β”‚   β”œβ”€β”€ client.ts           # RPC connection factory (Helius β†’ public fallback)
β”‚   β”‚   β”‚   β”œβ”€β”€ mwa.ts              # MWA helpers (connect, sign, disconnect)
β”‚   β”‚   β”‚   └── tokens.ts           # SPL token utils (USDC transfers)
β”‚   β”‚   β”œβ”€β”€ ai/
β”‚   β”‚   β”‚   β”œβ”€β”€ swarmModel.ts       # tfjs model loader + inference runner
β”‚   β”‚   β”‚   └── mentorRules.ts      # Rule-based NLP fallback (MVP)
β”‚   β”‚   └── utils/
β”‚   β”‚       β”œβ”€β”€ format.ts           # Number/address formatting
β”‚   β”‚       └── cache.ts            # Offline data caching (AsyncStorage)
β”‚   β”‚
β”‚   └── constants/
β”‚       β”œβ”€β”€ colors.ts               # Design system palette
β”‚       β”œβ”€β”€ fonts.ts                # Typography config
β”‚       └── config.ts               # RPC endpoints, program IDs, feature flags
β”‚
β”œβ”€β”€ assets/
β”‚   β”œβ”€β”€ fonts/                      # Space Grotesk + Inter (local)
β”‚   β”œβ”€β”€ icons/                      # SVG icon set (24Γ—24)
β”‚   β”œβ”€β”€ animations/                 # Reanimated configs
β”‚   └── models/                     # Quantized tfjs model (bundled)
β”‚
β”œβ”€β”€ app.json
β”œβ”€β”€ eas.json
β”œβ”€β”€ babel.config.js
β”œβ”€β”€ tsconfig.json
└── package.json

Core Features

AI Onboarding Swarm β€” Natural language mentor chat that guides novices from zero to first yield position. Gamified with SKR badges and a sandbox mode before going live.

AI Yield Optimizer β€” Suggests and executes auto-compound strategies across Kamino vaults. One-tap execution with MWA biometric signing. Real transactions on Solana.

Micropayment Scheduler β€” Sub-$0.01 USDC transfers via SPL Token. Demonstrates Solana's sub-400ms finality and near-zero fees in a concrete, visual way.

Offline Simulation Mode β€” Risk-free strategy sandbox powered by on-device tfjs inference. No wallet, no RPC β€” runs fully local. Bridges to live execution when the user is ready.

Real-Time Dashboard β€” Live SOL + USDC balances via RPC, yield feed, offline cache with last-sync timestamp.


Design System

Token Value Usage
Background #0A0E17 Primary BG (OLED-optimized)
Surface #1A1F2E Glassmorphic cards
Primary #9945FF CTAs, active states
Accent #14F195 Yields, success, badges
Warning #FF6B6B Risk labels, errors
Info #03E1FF Charts, tooltips
Text Primary #F5F7FA Headlines
Text Secondary #A0AEC0 Body

Fonts: Space Grotesk (headlines, CTAs) + Inter (body, data).


Setup

Prerequisites

  • Node.js 18+
  • Android Studio + Pixel 8 emulator (API 36) or physical Android 13+ device
  • EAS CLI: npm install -g eas-cli
  • Phantom or Backpack wallet installed on the same device

Bootstrap

npm create solana-dapp@latest
# Select: Solana Mobile β†’ Expo

Install

npm install

Environment

Create .env.local:

EXPO_PUBLIC_RPC_URL=https://rpc.helius.xyz/?api-key=YOUR_KEY
EXPO_PUBLIC_NETWORK=mainnet-beta
EXPO_PUBLIC_AI_ENABLED=false

AI_ENABLED=false uses rule-based mentor responses (faster iteration). Flip to true when the tfjs model is bundled under assets/models/.

Run

npm run android

Build APK

eas build --platform android --profile dapp-store

Profile config in eas.json:

{
  "build": {
    "dapp-store": {
      "android": {
        "buildType": "apk"
      }
    }
  }
}

Architecture Notes

Feature-first structure. Each feature (onboarding, vault, payments, simulation) owns its components, hooks, and types. Cross-cutting concerns (wallet, RPC, state) live in hooks/, stores/, and lib/. Two devs can work on separate features without file conflicts.

Blockchain is the backend. No custom server. Wallet identity = pubkey via MWA. Balances and transactions go directly to Solana RPC. Kamino and Jupiter APIs are consumed read-only for strategy data.

AI is feature-flagged. mentorRules.ts handles the MVP mentor chat. swarmModel.ts wraps tfjs for the quantized model β€” swapped in via EXPO_PUBLIC_AI_ENABLED. No model training on the critical path.

Offline-first. Dashboard caches via AsyncStorage. Simulation runs entirely local. RPC failures degrade gracefully with cached data and a sync timestamp.

MWA for all signing. Private keys never enter the app. All transactions are assembled client-side and sent to MWA for biometric signing β€” follows the Solana Mobile security model exactly.


References


License

MIT β€” Built for Solana Mobile Hackathon 2026.

About

Mobile-native AI-powered DeFi companion on Solana. Automate yield strategies and onboard web3 novices through collaborative AI mentor swarms.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors