DEV Community

Cover image for How to Build a Raydium Launchpad Bonding Curve in 5 Minutes with forgekit
Res
Res

Posted on

How to Build a Raydium Launchpad Bonding Curve in 5 Minutes with forgekit

If you've ever tried building a token launchpad or a bonding curve on Solana, you already know the pain. You spend hours wrestling with complex SDKs, trying to figure out the precise math for a bonding curve, ensuring your token mints are actually "rug-proof," and praying your Raydium CPMM pool creation doesn't fail silently.

Most of the tools out there are heavy, monolithic, and full of dependencies you don't need.

Thatโ€™s why we built forgekit (@forgekit-labs) - a modular, zero-dependency toolkit that breaks down Solana token launches and Raydium infrastructure into pure, highly-focused functions.

In this tutorial, I'll show you how to use forgekit to calculate a bonding curve, execute a secure token mint, and graduate a token to a Raydium CPMM pool in under 5 minutes.


What is forgekit?

forgekit is a collection of 8 single-purpose npm packages. Instead of forcing you to install a massive SDK, you only install exactly what you need:

  • @forgekit-labs/curve: Pure bonding curve math (no network required).
  • @forgekit-labs/token: Atomic token minting with built-in authority revocation.
  • @forgekit-labs/launchpad: Raydium CPMM pool creation.
  • @forgekit-labs/meta: Arweave upload via Turbo.
  • ...and more for LP splitting, fees, and v0 transaction building.

Let's build.


Step 1: Install the Modules

For a standard bonding curve launch, you only need three modules. Let's pull them down:

npm install @forgekit-labs/curve @forgekit-labs/token @forgekit-labs/launchpad
Enter fullscreen mode Exit fullscreen mode

Step 2: Calculate the Bonding Curve

Bonding curves require precise math. Instead of writing custom logic to calculate market caps, progress, and thresholds, we use the pure functions from @forgekit-labs/curve.

Because this package is mathematically pure, it requires zero network calls and executes instantly.

import { calculateGraduationThreshold, getCurveProgress } from '@forgekit-labs/curve';

// Define your curve parameters
const startingPriceLamports = 1000; // Starting price in lamports
const targetSol = 85; // E.g., Graduate the curve when 85 SOL is raised

// Calculate exactly how many tokens need to be sold to hit the threshold
const thresholdTokens = calculateGraduationThreshold(startingPriceLamports, targetSol);

console.log(`To graduate, we need to sell ${thresholdTokens} tokens.`);
Enter fullscreen mode Exit fullscreen mode

Step 3: The "Rug-Proof" Atomic Mint

One of the biggest issues with token launches is ensuring the creator actually revokes the Mint and Freeze authorities. If these aren't revoked, the token isn't safe.

@forgekit-labs/token handles this natively. It bundles the minting and authority revocation into a single, atomic transaction. If the revocation fails, the entire mint fails - guaranteeing safety.

import { createAtomicMintTx } from '@forgekit-labs/token';

// Build the transaction
const unsignedTx = await createAtomicMintTx({
  connection,
  creatorPubkey: userWallet.publicKey,
  name: "My Awesome Token",
  symbol: "MAT",
  metadataUri: "https://arweave.net/...", // Use @forgekit-labs/meta to get this!
  decimals: 6,
  totalSupply: 1_000_000_000,
});

// Send this unsigned v0 transaction to the frontend for the user to sign
Enter fullscreen mode Exit fullscreen mode

Step 4: Graduate to Raydium CPMM

Once your curve hits its SOL threshold, it's time to graduate. The token needs to migrate to a Raydium CPMM liquidity pool. Doing this manually involves massive boilerplate.

With @forgekit-labs/launchpad, it's a single, idempotent call. It includes built-in validation and fee configuration.

import { createCpmmPool } from '@forgekit-labs/launchpad';

const graduationResult = await createCpmmPool({
  connection,
  baseMint: tokenAddress,
  quoteMint: "So11111111111111111111111111111111111111112", // Wrapped SOL
  baseAmount: thresholdTokens,
  quoteAmount: targetSol,
  // forgekit automatically handles idempotency and validation under the hood
});

console.log(`Graduation successful! Pool ID: ${graduationResult.poolAddress}`);
Enter fullscreen mode Exit fullscreen mode

Conclusion

Thatโ€™s it. No bloated SDKs, no guessing the math, and no worrying about whether your token authorities were actually revoked.

By splitting these complex actions into isolated, modular packages, @forgekit-labs gives you the exact tools you need to build a premium launchpad or trading terminal, without the headache.

Check out the code and start building:

If you found this useful, drop a star on the repo and let me know what you're building!

Top comments (0)