nextjs
Next.js starter built on @solana/kit v8, Kit plugins, and @solana/react. Connect a browser wallet, switch networks, and send real transactions — SOL transfers, SPL token actions, and memos.
Getting Started
Requires Node.js 24 or newer.
npx -y create-solana-dapp@latest -t solana-foundation/templates/kit/nextjsnpm install
npm run devOpen http://localhost:3000, connect a wallet, and (on devnet) click Airdrop 1 SOL to fund it. Then try the actions. Need devnet SOL another way? faucet.solana.com.
To use localnet, start a local validator in another terminal before selecting localnet:
solana-test-validatorWhat's Included
- Wallet connection via the Kit wallet plugin (wallet-standard discovery, auto-reconnect)
- Network switcher — devnet, testnet, mainnet, localnet
- Transfer SOL with the
@solana-program/systemkit plugin - Token actions — create a mint, mint tokens, and transfer them with the
@solana-program/tokenkit plugin (associated token accounts created for you) - Add memo with the
@solana-program/memokit plugin - Live balance and toast notifications with explorer links
- Tailwind CSS v4 with light/dark mode
How it works
The app builds a Kit client in app/lib/solana-client.ts. The Kit wallet plugin supplies the connected wallet's transaction signer:
createClient()
.use(walletSigner({ chain }))
.use(solanaRpc({ rpcUrl, rpcSubscriptionsUrl, transactionConfig }))
.use(rpcAirdrop()) // client.airdrop (non-mainnet)
.use(systemProgram()) // client.system.instructions.transferSol
.use(tokenProgram()) // client.token.instructions.{createMint,mintToATA,transferToATA}
.use(memoProgram()); // client.memo.instructions.addMemoComponents use useAppClient() and the Kit wallet hooks from the local provider. Sending uses client.sendTransaction([instruction]) or the program plugin's instruction-plan helpers.
The Kit 8 RPC planner is configured to emit Version 1 transactions. This
requires @solana/kit-plugin-rpc 0.19 or newer and a wallet that advertises
Version 1 signing support. Version 1 transactions use a total priority fee in
lamports and keep resource-limit estimation enabled through the RPC planner.
Switching networks
A kit client is bound to one chain and RPC endpoint. The cluster dropdown rebuilds the client for that cluster. See app/lib/client-provider.tsx.
Testing
npm run testThe tests in tests/ drive the real UI — click Connect Wallet, pick a wallet, fill in the transfer form, press Send SOL — and assert on-chain state before and after each click. Three pieces make that work without a browser or a wallet extension:
@solana/surfpool1.7.0 starts an isolated, in-process local runtime with dynamic RPC and WebSocket ports. It supports V1 transactions and provides funding helpers without a separate validator process.- A mock wallet-standard wallet (
tests/mock-wallet.ts) registers itself like any browser extension would, so the app's real wallet discovery, connect flow, and transaction signing run unmodified — signatures come from an in-memory keypair. - Vitest + Testing Library render the actual app components in jsdom and interact with them by role and label, the same way a user would.
The tests point AppClientProvider at Surfpool through its optional URL override and assert that sent transactions have version 1 as well as their expected local-chain effects. Each run starts its own runtime and stops it during teardown. No existing validator, ledger, or devnet funds are used.
Surfpool's native test runtime supports Linux x64 and macOS x64/arm64. On Windows, run the tests in a supported Linux x64 WSL environment with Node.js 24 or newer. No separate Solana CLI installation is required.
The tests use Surfnet.startWithConfig with remote account fallback enabled so Surfpool can fetch the deployed Memo program. An internet connection and an available mainnet RPC are required. The default is https://api.mainnet-beta.solana.com; set SOLANA_TEST_REMOTE_RPC_URL to use another mainnet RPC if needed. Test transactions are sent only to Surfpool's local RPC, never to the upstream network. No Memo binary or license fixture is bundled, and no Solana CLI dump or deployment step is needed.
