System Overview
The application follows a modern client-server architecture with blockchain integration:Architecture Layers
Frontend Layer
Frontend Layer
The presentation layer built with React 19 and Next.js 16 App Router.
- User Interface: TailwindCSS with Framer Motion animations
- State Management: React hooks with custom
useWalletConnection - Routing: Next.js App Router for server-side rendering
- Wallet Integration: Jupiter Wallet Adapter for unified wallet support
Service Layer
Service Layer
Business logic and external API integration located in
src/services/.- SupabaseWalletService: Wallet persistence and lookup
- SupabaseTradeService: Trade data caching and retrieval
- HeliusService: Blockchain transaction fetching
- DeriverseTradeService: Trade analytics processing
Data Layer
Data Layer
PostgreSQL database managed by Supabase with Row Level Security.
- Persistence: User wallets and trade data
- Caching: 24-hour cache for blockchain data
- Security: RLS policies ensure data isolation
Component Structure
The codebase is organized following a feature-based architecture:The component structure follows atomic design principles with clear separation between features, layout, and reusable UI elements.
Technology Stack
Core Framework
Next.js 16
App Router for server-side rendering, routing, and API routes.
React 19
Latest React with improved concurrency and suspense features.
Infrastructure
Supabase
PostgreSQL database with real-time subscriptions and authentication.
Solana Web3.js
Blockchain interaction and transaction parsing.
Jupiter Wallet Adapter
Unified wallet connection supporting Phantom, Solflare, and more.
Frontend Technologies
| Technology | Purpose | Version |
|---|---|---|
| TypeScript | Type safety across the codebase | 5.x |
| TailwindCSS | Utility-first styling system | 4.x |
| Framer Motion | Animation library for smooth transitions | 12.x |
| Geist Fonts | Unified typography (Sans, Mono, Pixel Grid) | 1.7 |
| Recharts | Data visualization for analytics | 3.7 |
| Sonner | Toast notifications | 2.0 |
Data Flow Patterns
Wallet Connection Flow
The application uses a unified wallet connection flow that handles both new and returning users:Connect
User triggers Jupiter Wallet Adapter through the UI. Supported wallets include Phantom, Solflare, and manual address entry.
Register
New users are guided through
NewUserModal for registration with network selection and wallet provider metadata.Data Modes
Deriverse operates in two distinct modes:- Mock Mode
- Real Mode (Devnet)
Local Development & Demos
- Uses
mockData.tsfor rapid UI testing - No blockchain or database connection required
- Ideal for exploring features without wallet setup
- Banner indicates mock data is active
Trade Data Pipeline
Trade data flows through multiple processing stages:The caching strategy balances data freshness with RPC efficiency. Trades older than 24 hours show a “Refresh” button to fetch updated data.
State Management
Connection State
TheuseWalletConnection hook wraps Jupiter’s wallet adapter and provides:
Persistence Strategy
User Wallets
Stored in Supabase
user_wallets table for cross-device persistence and recent wallet tracking.Trades
Cached in
trades table after blockchain fetch. Filtered locally for real-time analytics.Annotations
Journal entries stored in
trade_annotations table, synced from localStorage fallback.UI State
Ephemeral React state for filters, modals, and temporary data. Cleared on navigation.
Security & Authentication
Security Measures
- Environment Variables: Sensitive keys (RPC URLs, Supabase credentials) stored in
.env.local - RLS Policies: Users can only access trades associated with their wallet address
- JWT Tokens: Secure communication between frontend and Supabase
- No Private Keys: Wallet adapters handle signing; private keys never leave user’s wallet
Local Development
Run the development server with:http://localhost:3000. Hot module reloading is enabled for rapid iteration.
Performance Considerations
Optimization Strategies
- Static Generation: Next.js pre-renders pages at build time where possible
- Incremental Loading: Trades load in batches to prevent UI blocking
- Client-Side Caching: Supabase caches reduce redundant blockchain queries
- Lazy Loading: Wallet adapter and heavy components load on-demand
- Code Splitting: Next.js automatically splits code by route
Resource Usage
| Resource | Limit (Free Tier) | Usage Pattern |
|---|---|---|
| Supabase DB | 500 MB | ~420 KB per 1,000 trades |
| RPC Calls | Varies by provider | Cached 24 hours |
| Vercel Bandwidth | 100 GB/month | Minimal (static assets) |
Last Updated: February 2026 For database schema details, see Database. For deployment configuration, see Deployment.
