Skip to content
@solana/kit ships createClient, a small host you extend with plugins. Each plugin adds a capability — an RPC connection, a signer, transaction planning — and the composed client backs scripts, server routes, and UIs alike.
Building a React app? The React guide wraps this same client with @solana/react so components read wallet state and RPC data through hooks. Start there and drop back here when you need finer control.

​Install

Terminal
Use any package manager. Kit is v7+ and the @solana/kit-plugin-* packages are 0.13+. @solana-program/system provides the transfer instruction in Send a transaction.
Security: Lock your dependency versions
  • Commit the lockfile, and install with npm ci or pnpm install --frozen-lockfile in CI and on deploy.
  • Review lockfile changes in pull requests like any other code change.
  • Hold back new releases for a few days with your package manager’s release-age setting, such as pnpm’s minimumReleaseAge.
  • Turn on Dependabot or GitHub security alerts, and upgrade when an advisory affects a package you use.
  • Copy package names from these docs. Kit and its plugins are published under @solana, and program clients under @solana-program.
  • Allow dependency install scripts only for the packages that need them.

​Create a client

Compose plugins with .use(...). Set a signer first, then the RPC connection. solanaDevnetRpc() adds client.rpc, subscriptions, the transaction planner/executor, and the client.sendTransaction helper — so an app rarely needs to wire those pieces itself.
The signer plugin sets both the fee payer and the app identity. The RPC bundle requires a payer to be in place first, which is why the order matters.

​Signer variants

@solana/kit-plugin-signer exposes three roles so you only grant what a client needs:
  • signer(x) — sets both client.payer and client.identity.
  • payer(x) — fee payer only.
  • identity(x) — app authority only.
Each has *FromFile(path) (Node), generated*(), generated*WithSol(amount), and airdrop*() variants for tests and scripts. The *WithSol and airdrop* variants call client.airdrop, so use them on a local validator.

​Send a transaction

Build instructions with a generated program client, then hand them to client.sendTransaction. The planner resolves the blockhash, estimates compute, signs with the client’s payer, and submits. The payer from Create a client is a new keypair with no SOL, so it can’t pay the fee or the transfer yet. client.airdrop calls the network’s RPC faucet, which public devnet no longer serves, so fund the payer on a local validator or load a devnet keypair you funded yourself:
Start a local validator with surfpool start (install the Surfpool CLI) or solana-test-validator. This version swaps solanaDevnetRpc() for solanaLocalRpc() and airdrops 1 SOL to the payer before the transfer:
sendTransaction resolves to a result object; the transaction signature is at result.context.signature. It asserts the plan fits a single transaction and throws otherwise — use sendTransactions when a batch may span multiple transactions.

​Pick an RPC bundle

@solana/kit-plugin-rpc ships cluster presets:
  • solanaDevnetRpc() — devnet defaults. It adds client.airdrop, but the public devnet RPC no longer serves airdrops; get devnet SOL from the Solana Faucet.
  • solanaMainnetRpc({ rpcUrl: "https://..." }) — mainnet; rpcUrl is required, and airdrop is a compile-time error.
  • solanaLocalRpc() — http://127.0.0.1:8899 for a local validator, with a working client.airdrop.
  • solanaRpc({ rpcUrl }) — any endpoint.
Only the devnet, testnet, and local presets default their URL; the mainnet preset throws if you call it without a config.
Security: Keep RPC API keys out of the browserAn RPC URL you pass to solanaRpc in browser code ships in your JavaScript bundle, along with any API key in it. In the browser, use an endpoint your provider restricts to your domain and set usage limits on it, or send requests through a server route that rate-limits each client. Apply the same restriction to rpcSubscriptionsUrl, which defaults to rpcUrl with a ws or wss scheme. See RPC Security.

​Compose granularly

The presets bundle the RPC connection, planner, executor, and send helpers, so most apps never need the pieces individually. Drop to the granular plugins only to customize one — for example a custom planner or a different subscription channel. This path also needs @solana/kit-plugin-instruction-plan, which the presets otherwise include for you:

​Add program clients

Generated @solana-program/* packages expose client plugins so program calls hang off the client. Install the program you need and .use() its plugin:

​Signing without a browser wallet

Running headless in an API route, worker, or script? Sign with a backend key-management service instead of a raw keypair. See Keychain and Signing in Production.

​Common patterns for Solana devs

  • Shared setup: Build the client once in a core module and import it into scripts, server routes, and your UI.
  • Server-side reads: A client with just signer + solanaRpc (no wallet plugin) reads accounts and simulates transactions from the server.
  • Local testing: Swap the RPC bundle for .use(litesvm()) from @solana/kit-plugin-litesvm to run against an in-memory validator (Node only).
  • Testability: The composed client is easy to mock — stub RPC responses or signers without a browser wallet present.