@apps-fun/sdk

Build with apps.fun

Token gating, trading, burns, and revenue sharing in one SDK.

$npm install @apps-fun/sdk @solana/web3.js

What you can build

Token Gating

Gate features behind token holdings. Check balances, set minimums, create tiers.

Direct Trading

Buy, sell, and burn tokens directly on-chain. Works with Keypair or external wallets.

Privy Support

Full support for Privy embedded wallets. Prepare transactions, sign externally, submit.

Revenue Routing

Route app revenue to token holders. Integrate dividends with a few lines of code.

Quick start

token-gate.ts
import { TokenGate } from '@apps-fun/sdk';
import { Connection, PublicKey } from '@solana/web3.js';

const gate = new TokenGate({
  tokenMint: new PublicKey('YOUR_TOKEN_MINT'),
  minAmount: BigInt(1_000_000), // 1 token (6 decimals)
  rpcUrl: process.env.RPC_URL,
});

// Check if user has access
const result = await gate.check(walletAddress);

if (result.allowed) {
  // Grant access to premium features
} else {
  console.log(`Need ${result.required - result.balance} more tokens`);
}

Starter templates

Clone and deploy in minutes

Next.js + Privy

Full-stack app with embedded wallets and token gating

Privy embedded walletsToken-gated pagesTrading UI

Discord Bot

Role-based token gating for Discord servers

Verify commandRole assignmentBalance checks

Express API

REST API with token-gated endpoints

Middleware authTrading endpointsWebhook support

Ready to build?

Launch your token-powered app today.

Start Building

Send Feedback