Installation
Set up Nitso in your Next.js or Vite project.
Nitso is distributed via the shadcn registry — components are copied directly into your project. Before installing any Nitso component, you need shadcn set up in your project.
Create a Next.js project
If you already have a Next.js project, skip this step.
npx create-next-app@latestpnpm create next-app@latestyarn create next-app@latestbun create next-app@latestChoose the recommended defaults — Tailwind CSS, App Router, and the @/* import alias are configured automatically.
Initialize shadcn
npx shadcn@latest initpnpm dlx shadcn@latest inityarn dlx shadcn@latest initbunx --bun shadcn@latest initFollow the prompts. This sets up your components.json config file.
Add Environment Variables
Nitso Provider requires RPC URLs to connect to the Solana network. Add them to your environment file before wiring up the provider. Get a free key at helius.dev, quicknode.com, or alchemy.com.
RPC_MAINNET=https://mainnet.helius-rpc.com/?api-key=your-key
RPC_DEVNET=https://devnet.helius-rpc.com/?api-key=your-keyInstall Nitso Provider
npx shadcn@latest add https://nitso.fun/r/nitso-provider.jsonpnpm dlx shadcn@latest add https://nitso.fun/r/nitso-provider.jsonyarn dlx shadcn@latest add https://nitso.fun/r/nitso-provider.jsonbunx --bun shadcn@latest add https://nitso.fun/r/nitso-provider.jsonNitsoProvider uses React hooks internally and requires "use client". To keep your root layout as a Server Component so metadata exports work correctly for SEO, create a separate client boundary file:
"use client";
import { NitsoProvider } from "@/components/nitso/nitso-provider";
// ⚠️ Public RPC endpoints are rate limited and not suitable for production.
// Replace these with your own — get a free key at helius.dev, quicknode.com, or alchemy.com
const clusters = [
{
id: "solana:mainnet" as const,
label: "Mainnet Beta",
url: process.env.RPC_MAINNET!,
},
{
id: "solana:devnet" as const,
label: "Devnet",
url: process.env.RPC_DEVNET!,
},
{
id: "solana:testnet" as const,
label: "Testnet",
url: "https://api.testnet.solana.com",
},
];
export function Providers({ children }: { children: React.ReactNode }) {
return (
<NitsoProvider appName="My App" clusters={clusters}>
{children}
</NitsoProvider>
);
}Then wrap your root layout:
import { Providers } from "./provider";
export const metadata = {
title: "My App",
};
export default function RootLayout({
children,
}: {
children: React.ReactNode;
}) {
return (
<html lang="en">
<body>
<Providers>{children}</Providers>
</body>
</html>
);
}Install Connect Button
npx shadcn@latest add https://nitso.fun/r/connect-button-demo.jsonpnpm dlx shadcn@latest add https://nitso.fun/r/connect-button-demo.jsonyarn dlx shadcn@latest add https://nitso.fun/r/connect-button-demo.jsonbunx --bun shadcn@latest add https://nitso.fun/r/connect-button-demo.jsonUse it anywhere in your app:
import { ConnectButtonDemo } from "@/components/nitso/connect-button-demo";
export default function Home() {
return (
<nav>
<ConnectButtonDemo />
</nav>
);
}Install Tailwind CSS
If your project already has Tailwind CSS configured, skip this step.
npm install tailwindcss @tailwindcss/vitepnpm add tailwindcss @tailwindcss/viteyarn add tailwindcss @tailwindcss/vitebun add tailwindcss @tailwindcss/viteReplace everything in src/index.css with:
@import "tailwindcss";Configure path aliases
If your project already has the @/* alias configured, skip this step.
Vite splits TypeScript config across multiple files. Update both:
{
"files": [],
"references": [
{ "path": "./tsconfig.app.json" },
{ "path": "./tsconfig.node.json" }
],
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
}
}
}{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
}
}
}Install @types/node and update vite.config.ts:
npm install @types/node -Dpnpm add @types/node -Dyarn add @types/node --devbun add @types/node --devimport path from "path";
import tailwindcss from "@tailwindcss/vite";
import react from "@vitejs/plugin-react";
import { defineConfig } from "vite";
export default defineConfig({
plugins: [react(), tailwindcss()],
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
},
},
});Initialize shadcn
npx shadcn@latest initpnpm dlx shadcn@latest inityarn dlx shadcn@latest initbunx --bun shadcn@latest initFollow the prompts to complete setup.
Add Environment Variables
Nitso Provider requires RPC URLs to connect to the Solana network. Add them to your environment file before wiring up the provider. Get a free key at helius.dev, quicknode.com, or alchemy.com.
VITE_RPC_MAINNET=https://mainnet.helius-rpc.com/?api-key=your-key
VITE_RPC_DEVNET=https://devnet.helius-rpc.com/?api-key=your-keyInstall Nitso Provider
npx shadcn@latest add https://nitso.fun/r/nitso-provider.jsonpnpm dlx shadcn@latest add https://nitso.fun/r/nitso-provider.jsonyarn dlx shadcn@latest add https://nitso.fun/r/nitso-provider.jsonbunx --bun shadcn@latest add https://nitso.fun/r/nitso-provider.jsonAdd it to src/main.tsx:
import { StrictMode } from "react";
import { createRoot } from "react-dom/client";
import { NitsoProvider } from "@/components/nitso/nitso-provider";
import App from "./App";
import "./index.css";
// ⚠️ Public RPC endpoints are rate limited and not suitable for production.
// Replace these with your own — get a free key at helius.dev, quicknode.com, or alchemy.com
const clusters = [
{
id: "solana:mainnet" as const,
label: "Mainnet Beta",
url: import.meta.env.VITE_RPC_MAINNET,
},
{
id: "solana:devnet" as const,
label: "Devnet",
url: import.meta.env.VITE_RPC_DEVNET,
},
{
id: "solana:testnet" as const,
label: "Testnet",
url: "https://api.testnet.solana.com",
},
];
createRoot(document.getElementById("root")!).render(
<StrictMode>
<NitsoProvider appName="My App" clusters={clusters}>
<App />
</NitsoProvider>
</StrictMode>,
);Install Connect Button
npx shadcn@latest add https://nitso.fun/r/connect-button-demo.jsonpnpm dlx shadcn@latest add https://nitso.fun/r/connect-button-demo.jsonyarn dlx shadcn@latest add https://nitso.fun/r/connect-button-demo.jsonbunx --bun shadcn@latest add https://nitso.fun/r/connect-button-demo.jsonUse it anywhere in your app:
import { ConnectButtonDemo } from '@/components/connect-button-demo';
export default function App() {
return (
<nav>
<ConnectButtonDemo />
</nav>
);
}Next steps
Install only the addons you need — each has its own docs page with installation instructions and wiring guide: