in-solana by Supanode

@solana/kit vs @solana/web3.js

@solana/kit is the next-generation Solana JavaScript SDK, replacing @solana/web3.js 1.x. It is a ground-up rewrite with a modular architecture, tree-shakeable exports, and a functional API instead of class-based patterns.

Comparison

Feature@solana/web3.js 1.x@solana/kit
ArchitectureMonolithic, class-basedModular, functional
Bundle size~100KB+ (full import)Tree-shakeable (import only what you use)
Key handlingKeypair classCryptoKeyPair (Web Crypto API)
Transaction buildingTransaction / VersionedTransaction classesFunctional builders with pipe pattern
RPC clientConnection classcreateSolanaRpc() with typed methods
TypeScriptPartial typesFull type safety, branded types
RuntimeNode.js focusedBrowser and Node.js (Web Crypto)
StatusMaintenance modeActive development

Key differences

Key generation

// web3.js 1.x
import { Keypair } from "@solana/web3.js";
const keypair = Keypair.generate();
const pubkey = keypair.publicKey.toBase58();

// @solana/kit
import { generateKeyPairSigner } from "@solana/kit";
const signer = await generateKeyPairSigner();
const address = signer.address;

RPC calls

// web3.js 1.x
import { Connection } from "@solana/web3.js";
const connection = new Connection("https://api.mainnet-beta.solana.com");
const balance = await connection.getBalance(pubkey);

// @solana/kit
import { createSolanaRpc } from "@solana/kit";
const rpc = createSolanaRpc("https://api.mainnet-beta.solana.com");
const balance = await rpc.getBalance(address).send();

Transaction building

// web3.js 1.x
const tx = new Transaction().add(
  SystemProgram.transfer({ fromPubkey, toPubkey, lamports })
);
tx.sign(keypair);

// @solana/kit
import { pipe } from "@solana/kit";
const tx = pipe(
  createTransaction({ version: 0 }),
  (tx) => appendTransactionMessageInstruction(tx, transferIx),
);
const signed = await signTransaction([signer], tx);

When to use which

ScenarioRecommendation
New project@solana/kit
Existing project (web3.js 1.x)Continue with web3.js, migrate gradually
Library authors@solana/kit (smaller consumer bundles)
Quick prototypingEither (web3.js has more examples/docs)
Browser-first application@solana/kit (Web Crypto, tree-shaking)

FAQ

Is @solana/web3.js deprecated? The 1.x version is in maintenance mode — it receives security fixes but no new features. New projects should use @solana/kit. Existing projects can migrate at their own pace.

Can I use both in the same project? Yes, during migration. Both can coexist. Convert address types between libraries using address() and new PublicKey().

Is @solana/kit stable? Yes. The 2.x release (published as @solana/kit) is stable and used in production. The API has stabilized, though some utility packages continue to receive updates.

Updated: