A comprehensive Next.js application for interacting with the Solana blockchain. This starter project provides essential Solana functionality including wallet connection, SOL transfers, token creation, and airdrop requests.
- Wallet Integration: Connect with Phantom and other Solana wallets
- SOL Transfers: Send SOL between addresses
- Token Management: Create and mint SPL tokens
- Airdrop Requests: Request SOL airdrops on devnet
- Real-time Balance: Live wallet balance updates
- Transaction History: View transactions on Solana Explorer
- Responsive Design: Mobile-friendly interface with Tailwind CSS
- Framework: Next.js 15 with App Router
- Language: TypeScript
- Styling: Tailwind CSS
- Blockchain: Solana Web3.js
- Wallet: Solana Wallet Adapter
- UI Components: React Hot Toast for notifications
- Package Manager: Bun (recommended)
@solana/web3.js- Solana JavaScript SDK@solana/wallet-adapter-react- React hooks for wallet integration@solana/wallet-adapter-phantom- Phantom wallet support@solana/spl-token- SPL token operationsreact-hot-toast- Toast notifications
typescript- TypeScript supporttailwindcss- CSS frameworkeslint- Code lintingprettier- Code formatting
- Node.js 18+ or Bun
- A Solana wallet (Phantom recommended)
- Git
-
Clone the repository
git clone <repository-url> cd solana-starter
-
Install dependencies
bun install # or npm install -
Set up environment variables Create a
.env.localfile in the root directory:NEXT_PUBLIC_SOLANA_ENDPOINT=https://api.devnet.solana.com
-
Run the development server
bun dev # or npm run dev -
Open your browser Navigate to http://localhost:3000
- Click the "Connect Wallet" button in the header
- Select your preferred wallet (Phantom, Solflare, etc.)
- Approve the connection in your wallet
- View Balance: Your SOL balance is displayed in real-time
- Request Airdrop: Get free SOL on devnet (1 SOL per day limit)
- Transfer SOL: Send SOL to any Solana address
- Create Token: Generate a new SPL token with 6 decimals
- Mint Tokens: Automatically mint 10 tokens to your wallet
- View Token Balance: See your token holdings
- Manage Multiple Tokens: Switch between different tokens you've created
The app is configured to use Solana devnet by default. To change networks, update the SOLANA_ENDPOINT in your environment variables:
# Devnet (default)
NEXT_PUBLIC_SOLANA_ENDPOINT=https://api.devnet.solana.com
# Mainnet
NEXT_PUBLIC_SOLANA_ENDPOINT=https://api.mainnet-beta.solana.com
# Testnet
NEXT_PUBLIC_SOLANA_ENDPOINT=https://api.testnet.solana.comSupported wallets are configured in src/components/providers.tsx. You can add or remove wallets as needed.
src/
├── app/
│ ├── layout.tsx # Root layout with wallet providers
│ └── page.tsx # Main page component
├── components/
│ ├── connect-wallet.tsx # Wallet connection component
│ ├── create-and-mint-token.tsx # Token creation and management
│ ├── header.tsx # Navigation header
│ ├── providers.tsx # Wallet and connection providers
│ ├── request-airdrop.tsx # SOL airdrop functionality
│ ├── transfer-s-o-l.tsx # SOL transfer component
│ └── wallet-info.tsx # Wallet balance and info display
├── config/
│ └── index.ts # App configuration
└── styles/
├── globals.css # Global styles
└── wallet.css # Wallet-specific styles
# Development server with Turbopack
bun dev
# Build for production
bun run build
# Start production server
bun start
# Lint code
bun run lint
# Format code
bun run format- ESLint: Configured for Next.js and TypeScript
- Prettier: Code formatting with Tailwind CSS plugin
- TypeScript: Strict type checking enabled
- This app is configured for devnet by default
- Never use mainnet private keys in development
- Always verify transaction details before signing
- Be cautious with airdrop requests (devnet only)
- Push your code to GitHub
- Connect your repository to Vercel
- Set environment variables in Vercel dashboard
- Deploy automatically on push
The app can be deployed to any platform that supports Next.js:
- Netlify
- Railway
- DigitalOcean App Platform
- AWS Amplify
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Wallet not connecting:
- Ensure you have a Solana wallet installed
- Check that the wallet is unlocked
- Try refreshing the page
Transaction failures:
- Verify you have sufficient SOL for transaction fees
- Check that recipient addresses are valid
- Ensure you're on the correct network (devnet)
Token creation errors:
- Make sure you have enough SOL for account creation
- Verify the transaction was confirmed
- Check Solana Explorer for transaction details
This project is licensed under the MIT License - see the LICENSE file for details.
- Solana Labs for the excellent developer tools
- Next.js team for the amazing framework
- The Solana community for inspiration and support