A full-stack application that tracks token balances and prices for Solana wallets, providing historical price data and portfolio management capabilities.
The frontend uses React with MobX for state management, providing real-time updates of token balances and prices.
Key Components:
- TokenStore: Central state management for token data using MobX
- API Service: Handles all communication with the backend
- DataMapperService: Transforms API responses into frontend data structures
The backend integrates multiple external APIs and maintains a database of token data.
-
HeliusClient
- Fetches token balances for user wallets
- Provides token metadata
-
BirdeyeClient
- Retrieves current and historical token prices
- Supports price tracking over customizable time periods
-
JupiterClient
- Fetches comprehensive token metadata
- Provides token list with accurate decimals and symbols
-
TokenService
- Manages token data and price history
- Integrates Jupiter metadata with Birdeye prices
- Handles database operations for tokens
-
UserService
- Manages user accounts and their token holdings
- Synchronizes token balances with Helius data
- Maintains user portfolio state
-
TokenAccountService
- Handles token balance tracking
- Maps raw API data to database structures
Stores:
- User accounts
- Token metadata
- Historical price data
- Token balances
- User connects wallet
- Backend fetches token balances from Helius
- For each token:
- Retrieves metadata from Jupiter
- Fetches prices from Birdeye
- Stores data in database
- Frontend displays portfolio with real-time updates
GET /api/users/withTokens
: Get user data with all token holdingsPOST /api/users/newUser
: Create new user
GET /api/tokens/token
: Get token metadata and pricesPOST /api/tokens/setToken
: Save new token data
GET /api/token-accounts/getBalances
: Get user token balancesPOST /api/token-accounts/createTokenAccount
: Create new token account
Required environment variables:
HELIUS_API_KEY
: API key for HeliusBIRDEYE_API_KEY
: API key for BirdeyeDATABASE_URL
: PostgreSQL connection stringPORT
: Backend server port
run npm i
from both frontend/
and backend/
directories to install dependencies.
run npm start
to start both frontend and backend.
run npm test
to run tests
Open debugger in VSCode and select Run Script: test
in the run configuration drop down.