Skip to main content
SocketFi gives your React application embedded, passkey-secured smart wallets on Stellar/Soroban without browser extensions, seed phrases, or external wallet apps. This guide walks you through every integration step, from installing the SDK to verifying sessions on your backend, so you can ship a fully working wallet experience.

Prerequisites

Before you begin, make sure you have:
  • React 18 or later
  • TypeScript (recommended)
  • A SocketFi application and Client ID from the SocketFi Dashboard

Protected routes

Redirect unauthenticated users away from sensitive pages:
src/components/ProtectedRoute.tsx

Production tips

Switch network from "TESTNET" to "MAINNET" when you deploy to production, and make sure VITE_SOCKETFI_CLIENT_ID points to your production Client ID.
  • Never trust client-side state alone. Always verify socketfiAccessToken with @socketfi/server before granting access to sensitive backend resources.
  • Use localStorage for convenience, sessionStorage for stricter security. For highly sensitive applications, clear the session on tab close.
  • Wrap every SDK call in try/catch. Users can cancel passkey prompts, network requests can time out, and contracts can revert.
  • Show descriptive intent before transactions. Users should understand exactly what they are signing — display the recipient, amount, and contract clearly in your UI before calling requestTransaction.
  • Monitor errors in production. Pipe onError events to your observability tool (Sentry, Datadog, etc.) so you catch auth failures and transaction errors before users report them.