A complete Solana token vesting application built with modern React and Rust. This platform enables companies to create sophisticated token vesting schedules for employees, advisors, and partners with on-chain enforcement.
This is a production-ready template for building token vesting platforms on Solana. The application includes:
- Smart Contract: Rust-based Anchor program with modular vesting logic
- Frontend: React 19 + TypeScript + Tailwind CSS v4
- Wallet Integration: Full Solana wallet adapter support
- Vesting Features: Cliff periods, linear vesting, and automatic token distribution
- Language: Rust using Anchor framework v0.30.1
- Features:
- Company vesting account management
- Employee vesting schedule tracking
- Cliff period enforcement
- Linear vesting calculations
- Automatic treasury funding
- SPL token support
- Framework: React 19 + Vite 7
- Styling: Tailwind CSS v4 + shadcn/ui + Radix UI
- State Management: Jotai + TanStack Query v5
- Wallet: Solana Wallet Adapter
- Theme: Dark/light mode support via next-themes
- Clone the repository
git clone https://github.com/samar-58/token-vesting
cd token-vesting- Install dependencies
pnpm install
# or
bun install- Build the smart contract
pnpm anchor-build- Start local development
# Start Solana test validator with deployed program
pnpm anchor-localnet
# In another terminal, start the frontend
pnpm dev- Create company vesting accounts linked to any SPL token
- Define vesting schedules with cliff periods
- Add employees with custom vesting terms
- Automatic treasury funding when adding employees
- Track vesting progress across all employees
- View personal vesting schedules
- Claim vested tokens after cliff period
- Track claim history and remaining allocation
- Monitor vesting progress with visual timeline
- View claimable amounts in real-time
- On-chain enforcement: Vesting rules enforced by blockchain
- Linear vesting: Smooth token release between start and end times
- Cliff periods: Tokens locked until cliff timestamp is reached
- PDA treasury: Secure token custody in program-derived accounts
- Automatic ATA creation: Beneficiary token accounts created on first claim
| Script | Description |
|---|---|
pnpm dev |
Start development server |
pnpm build |
Build for production |
pnpm preview |
Preview production build |
pnpm lint |
Run ESLint |
pnpm format |
Format all files with Prettier |
pnpm format:check |
Check formatting |
pnpm ci |
Run build, lint, and format check |
pnpm anchor-build |
Build smart contract |
pnpm anchor-test |
Run contract tests (LiteSVM) |
pnpm anchor-localnet |
Start local validator |
token-vesting/
├── anchor/ # Smart contract (Rust + Anchor)
│ ├── programs/counter/ # Token vesting program
│ │ └── src/
│ │ ├── lib.rs # Program entry point
│ │ ├── errors.rs # Custom error codes
│ │ ├── instructions/ # Instruction handlers
│ │ │ ├── initialize_vesting.rs
│ │ │ ├── initialize_employee.rs
│ │ │ └── claim_tokens.rs
│ │ └── states/ # Account structures
│ │ ├── vesting_account.rs
│ │ └── employee_account.rs
│ ├── src/ # TypeScript exports
│ │ ├── index.ts
│ │ └── token-exports.ts # IDL and program helpers
│ ├── tests/
│ │ └── tokenvesting.test.ts # LiteSVM test suite
│ └── Anchor.toml
├── src/ # Frontend application
│ ├── app.tsx # Main app component
│ ├── main.tsx # Entry point
│ ├── index.css # Global styles
│ ├── lib/
│ │ └── utils.ts
│ └── components/
│ ├── vesting/ # Vesting feature
│ │ ├── vesting-feature.tsx # Main page
│ │ ├── vesting-ui.tsx # UI components
│ │ └── vesting-data-access.tsx # Data hooks
│ ├── cluster/ # Cluster management
│ ├── solana/ # Wallet integration
│ └── ui/ # shadcn/ui components
├── public/
├── vite.config.ts
├── tsconfig.json
└── package.json
pub struct VestingAccount {
pub owner: Pubkey, // Company owner wallet
pub mint: Pubkey, // SPL token mint
pub treasury_token_account: Pubkey, // PDA treasury for tokens
pub company_name: String, // Company identifier (max 64 chars)
pub treasury_bump: u8, // Treasury PDA bump
pub bump: u8, // Account PDA bump
}pub struct EmployeeAccount {
pub beneficiary: Pubkey, // Employee wallet
pub vesting_account: Pubkey, // Parent vesting account
pub total_allocated: u64, // Total tokens allocated
pub total_claimed: u64, // Tokens already claimed
pub start_time: i64, // Vesting start timestamp
pub end_time: i64, // Vesting end timestamp
pub cliff_time: i64, // Cliff period timestamp
pub bump: u8, // Account PDA bump
}| Instruction | Parameters | Description |
|---|---|---|
initialize_vesting_account |
company_name: String |
Create company vesting account with treasury PDA |
initialize_employee_account |
start_time, end_time, total_amount, cliff_time |
Add employee and fund treasury |
claim_tokens |
company_name: String |
Claim vested tokens (enforces cliff) |
| Error | Description |
|---|---|
CliffNotReached |
Cliff period has not been reached yet |
NothingToClaim |
No tokens available to claim |
The project uses LiteSVM for fast, local smart contract testing without requiring a network connection.
# Run smart contract tests
pnpm anchor-test
# Run CI checks (build + lint + format)
pnpm ciCreate a .env file in the root directory:
VITE_SOLANA_NETWORK=devnet
VITE_SOLANA_RPC_URL=https://api.devnet.solana.comThe frontend supports multiple Solana clusters:
- Localnet: Local development with test validator
- Devnet: Solana devnet for testing
- Testnet: Solana testnet
- Mainnet: Production deployment
{
"@project/anchor": "anchor/src",
"@/*": "./src/*"
}# Build and deploy
pnpm anchor-build
cd anchor && anchor deploy --provider.cluster devnet
# Sync program ID
anchor keys sync# Update Anchor.toml for mainnet
cd anchor && anchor deploy --provider.cluster mainnet-beta
# Build frontend for production
pnpm build- Fork the repository
- Create a feature branch
- Make your changes
- Run
pnpm cito verify - Submit a pull request
This project is licensed under the MIT License.
Built for the Solana ecosystem