React + Vite app that talks to the Trivela API and, when wired, Stellar/Soroban for wallet and contract interactions.
npm install
npm run devOpen http://localhost:5173. The dev server proxies /api, /api/v1, and /health to the backend on port 3001.
End-to-end tests live in frontend/e2e/ and are powered by Playwright.
Run locally:
# From the repo root — build first so vite preview has a dist/ to serve
npm run build --workspace=frontend
# Then run the tests (Playwright starts vite preview automatically)
npm run test --workspace=frontendOr from inside the frontend/ directory:
npm run build
npm run testFirst-time setup — install the Chromium browser binary once:
npx playwright install chromiumTests cover:
- Page loads with the correct title and hero heading
- Campaigns section renders either a campaign list or an empty state after loading
- Clicking a campaign card navigates to the detail page (runs only when campaigns are present)
The Playwright config is at frontend/playwright.config.js. Tests run in Chromium only to keep CI fast.
Run Storybook from the frontend workspace:
npm run storybookBuild the static Storybook bundle with:
npm run build-storybookCreate a .env.local file in frontend/ when you need to point the app at non-default services.
VITE_API_URL=http://localhost:3001
VITE_STELLAR_NETWORK=testnet
VITE_SOROBAN_RPC_URL=https://soroban-testnet.stellar.org
VITE_HORIZON_URL=https://horizon-testnet.stellar.org
VITE_REWARDS_CONTRACT_ID=CC...
VITE_CAMPAIGN_CONTRACT_ID=CC...
VITE_STELLAR_NETWORK_PASSPHRASE="Test SDF Network ; September 2015"VITE_API_URL: Base URL used for frontendfetchcalls. Leave empty to use the local Vite proxy.VITE_STELLAR_NETWORK: Explicit named preset (testnetormainnet).VITE_SOROBAN_RPC_URL: Optional override for the selected network's Soroban RPC endpoint.VITE_HORIZON_URL: Optional override for the selected network's Horizon endpoint.VITE_REWARDS_CONTRACT_ID: Optional rewards contract ID for frontend Soroban calls.VITE_CAMPAIGN_CONTRACT_ID: Optional campaign contract ID for frontend Soroban calls.VITE_STELLAR_NETWORK_PASSPHRASE: Optional override for the selected network's passphrase.
The frontend targets /api/v1/* routes by default. Campaign loading uses the paginated response shape from GET /api/v1/campaigns?page=1&limit=6. Legacy /api/* routes are still supported by the backend for backward compatibility, but new integrations should use the v1 prefix.
The frontend reads these values from src/config.js:
- API requests are built with
apiUrl(...). - Soroban RPC access goes through
createSorobanServer(). - Rewards and campaign contract IDs are exposed through
getRewardsContract()andgetCampaignContract(). - On startup, the frontend fetches
/api/v1/configand prefers the backend-resolved network config when that endpoint is available.
Use @stellar/stellar-sdk for:
- Connecting to Soroban RPC
- Building and signing transactions
- Invoking the rewards and campaign contracts
See Stellar Developers and the root README for deployment flows.