Skip to main content
This page describes SocketPay, a reference application that demonstrates every major SocketFi capability working together end-to-end. Rather than listing every line of code, it explains the architecture — how the layers connect, what each module does, and which patterns you should replicate in your own production application. By the time you finish reading this page, you’ll understand the recommended full-stack SocketFi structure and be ready to adapt it to your own product.

What SocketPay covers

Authentication

Passkey-powered sign-in that creates or loads a smart wallet on first use.

Wallet dashboard

Real-time balance reads and asset display using readContract().

Token transfers

Full transfer form with status lifecycle, approval flow, and post-tx refresh.

Backend verification

Express API with verifyAuth() middleware protecting every sensitive route.

Activity feed

Transaction history stored server-side and displayed in the frontend.

Security center

Credential rotation and account recovery entry points in a settings page.

High-level architecture

Repository structure

Environment variables

Authentication flow

SDK initialization is the first thing that runs. The AuthProvider wraps the entire application and restores any persisted session before rendering routes.
apps/web/src/socketfi/client.ts
See React Authentication for the complete file-by-file implementation.

Wallet dashboard

The dashboard reads balances directly from Soroban using readContract() and caches them with React Query. After any transaction, the query is invalidated so the display stays accurate.
apps/web/src/wallet/useBalance.ts

Transaction flow

Every state-changing operation goes through requestTransaction(). SocketPay wraps it in a service layer, leaving TransferForm free of SDK-specific logic.
apps/web/src/transactions/transactionService.ts
See React Transactions for the complete form and status-lifecycle implementation.

Backend verification

The Express backend protects all /api routes with authMiddleware. No route handler ever trusts user-supplied identity.
server/src/middleware/auth.ts
server/src/app.ts
See Server Verification for the full middleware, route, and TypeScript type-extension implementation.

Activity feed

SocketPay stores transaction hashes server-side after every successful transfer. The frontend fetches them with React Query.
server/src/routes/activity.ts

Security center

Give users a dedicated settings page to manage their passkey credentials and initiate account recovery if needed.
apps/web/src/settings/SecurityPage.tsx

React Query setup

Wrap your app with QueryClientProvider at the root alongside AuthProvider:
apps/web/src/main.tsx

Production checklist

Full user lifecycle