Skip to content

feat: add community staking template with Anchor and Next.js frontend#325

Open
satyawaniaman wants to merge 8 commits intosolana-foundation:mainfrom
satyawaniaman:satyawaniaman/staking-template
Open

feat: add community staking template with Anchor and Next.js frontend#325
satyawaniaman wants to merge 8 commits intosolana-foundation:mainfrom
satyawaniaman:satyawaniaman/staking-template

Conversation

@satyawaniaman
Copy link

Demo

staking-walkthrough.mp4

Summary

Adds a new community/staking template for pnpm create solana-dapp --template staking.

This template provides a complete reference implementation of a Solana staking dApp including:

  • an Anchor staking program with initialize, stake, unstake, claim, and add_rewards
  • a Next.js + Tailwind + TypeScript frontend for staking, unstaking, claiming rewards, and viewing pool/user statistics
  • synced frontend IDL/types generated from the Anchor program
  • helper scripts for common setup tasks:
    • program ID synchronization
    • staking pool initialization
    • reward pool funding
  • README documentation covering architecture, deployment steps, reward calculation logic, security considerations, and troubleshooting

Validation

I verified the template locally with:

cd community/staking
anchor test
pnpm lint

cd app
pnpm lint
pnpm build

All checks completed successfully.


Manual Devnet Verification

I also validated the full workflow on devnet:

  • deploy program to devnet
  • create mint
  • initialize staking pool
  • fund reward pool
  • connect wallet in frontend
  • mint test tokens
  • stake tokens
  • claim rewards
  • unstake tokens

Notes

  • The frontend defaults to devnet via app/.env.local
  • sync-program-id.js keeps the program ID aligned across Rust, Anchor config, and frontend types/env
  • initialize-pool.js creates the staking PDAs
  • add-rewards.js funds the reward pool and sets the emission rate

Anchor program with 5 instructions (initialize, stake, unstake, claim, add_rewards)
and a Next.js frontend with wallet integration, token faucet, and clean black/white UI.

- Program: SPL token staking with PDAs, reward distribution, admin controls
- Frontend: Next.js 16 + Tailwind 4 with Stake/Manage tabs
- Tests: 4 passing anchor tests (initialize, stake, unstake, error handling)
- Scripts: Pool initialization and token minting utilities
- oklch-based color tokens (matching supabase-auth convention)
- bg-card/50 navbar with proper hover transitions
- Link component for navigation
- Cleaner wallet adapter overrides
- Consistent border-border, outline-ring/50 base styles
- Light + dark oklch color schemes (matching supabase-auth convention)
- ThemeProvider wrapping app with dark default, system detection
- Sun/Moon toggle button in navbar
- Wallet adapter overrides use CSS vars for theme-awareness
…WalletMultiButton` and removing wallet adapter UI specific styles.
@satyawaniaman
Copy link
Author

@cxalem gentle ping for visibility, thanks.

@github-actions
Copy link

This pull request has been automatically marked as stale because it has not had any activity for 7 days.

It will be closed in 7 days if no further activity occurs.

If you believe this PR is still relevant, please add a comment or push new commits to keep it open.

Thank you for your contributions!

@github-actions github-actions bot added the stale label Mar 15, 2026
@satyawaniaman
Copy link
Author

@cxalem Hi! just checking if there are any updates on this PR. Thanks!

@github-actions github-actions bot removed the stale label Mar 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant