Algorand Frontends
Build frontend applications that connect to Algorand wallets and interact with smart contracts using typed clients. Works with React, Vue, SolidJS, Svelte, and vanilla JS/TS.
Prerequisites
- Smart contract is deployed with a known App ID
- ARC-56/ARC-32 app spec exists (e.g.,
MyContract.arc56.json) - Frontend project is set up (Vite, Next.js, Nuxt, SvelteKit, or any bundler)
Core Pattern: Signer Handoff
Wallet (use-wallet) → transactionSigner
↓
AlgorandClient.setSigner()
↓
Typed App Client (defaultSender)
↓
Contract Method Calls (auto-signed)
Quick Start
# Generate typed client
algokit generate client path/to/MyContract.arc56.json --output src/contracts/MyContractClient.ts
# Install core + framework adapter (pick one)
npm install @algorandfoundation/algokit-utils algosdk @txnlab/use-wallet-react # React
npm install @algorandfoundation/algokit-utils algosdk @txnlab/use-wallet-vue # Vue
npm install @algorandfoundation/algokit-utils algosdk @txnlab/use-wallet-solid # SolidJS
npm install @algorandfoundation/algokit-utils algosdk @txnlab/use-wallet-svelte # Svelte
npm install @algorandfoundation/algokit-utils algosdk @txnlab/use-wallet # Vanilla JS/TS
# Install wallet peer dependencies (only for wallets you use)
npm install @perawallet/connect @blockshake/defly-connect
Minimal Integration (React)
import { useWallet } from '@txnlab/use-wallet-react'
import { AlgorandClient } from '@algorandfoundation/algokit-utils'
import { MyContractClient } from './contracts/MyContractClient'
function ContractInteraction() {
const { transactionSigner, activeAddress } = useWallet()
const callContract = async () => {
if (!activeAddress || !transactionSigner) return
const algorand = AlgorandClient.testNet()
algorand.setSigner(activeAddress, transactionSigner)
const appClient = algorand.client.getTypedAppClientById(MyContractClient, {
appId: 12345n,
defaultSender: activeAddress,
})
const result = await appClient.send.myMethod({ args: { value: 42n } })
console.log('Result:', result.return)
}
return <button Contract</button>
}
Important Rules
- Always call
setSigner()before creating clients — signer must be registered first - Check for null
activeAddressandtransactionSigner— null when no wallet connected - Match networks — AlgorandClient network must match WalletManager network
- Use
getTypedAppClientById()for frontends with known App IDs - Check
isReadybefore rendering wallet state — prevents SSR hydration mismatches in Next.js, Nuxt, and SvelteKit - Trigger signing from direct user interaction — button clicks, not timers or effects. Some wallets (especially mobile) block or silently fail signing from
useEffect/onMount/setTimeout - Never use hook-returned clients as effect/callback dependencies —
clientandalgorandfrom custom hooks are new references on every wallet state change. Use refs for data fetching in effects (see Example 11 in frontend-examples.md)
Reference Guide
- wallet-integration.md — Framework adapters, wallet providers, network config, useNetwork(), pre-built UI, gotchas
- frontend-examples.md — Complete code examples for common patterns
Canonical Example Repos
Search these repositories for real-world code examples:
algorandfoundation/algokit-fullstack-template— Fullstack project template (React + contracts)algorandfoundation/algokit-react-frontend-template— React frontend templateTxnLab/use-wallet— UseWallet library source and framework adaptersTxnLab/next-use-wallet— Next.js + UseWallet example app
Cross-References
- New to Algorand? Read
algorand-coreskill first for AVM mental model - Smart contracts: See
algorand-typescriptoralgorand-pythonskills - Project scaffolding and CLI: See
algorand-project-setupskill