A complete decentralized Automated Market Maker (AMM) built on Solana using Anchor framework, featuring a modern Next.js frontend with flexible background theming.
To add screenshots: Create a screenshots folder in the root directory and add your interface screenshots
- Complete AMM Functionality: Swap tokens, add/remove liquidity
- Solana Integration: Built with Anchor framework for high-performance on-chain operations
- Modern Frontend: Next.js 15 with TypeScript and Tailwind CSS
- Real-time Pool Data: Live pool statistics and balance tracking
- Wallet Integration: Seamless wallet connection with multiple wallet support
- Flexible UI: Glassmorphism design with customizable backgrounds
- Responsive Design: Works perfectly on desktop and mobile
- Type Safety: Full TypeScript support throughout the stack
This project is organized as a Turborepo monorepo with the following structure:
mini-amm/
βββ apps/
β βββ frontend/ # Next.js frontend application
β β βββ components/ # React components
β β βββ hooks/ # Custom React hooks
β β βββ utility/ # Utility functions
β β βββ types/ # TypeScript type definitions
β βββ program/ # Solana program (smart contract)
β βββ programs/ # Anchor program source
β βββ scripts/ # Deployment and interaction scripts
β βββ tests/ # Program tests
βββ packages/ # Shared packages
βββ ui/ # Shared UI components
βββ typescript-config/ # Shared TypeScript configs
βββ eslint-config/ # Shared ESLint configs
- Node.js 18+ and pnpm
- Rust and Cargo (for Solana development)
- Solana CLI tools
- Anchor CLI
-
Clone the repository
git clone <repository-url> cd mini-amm
-
Install dependencies
pnpm install
-
Set up Solana environment
# Configure Solana CLI for devnet solana config set --url devnet # Create a new keypair (if needed) solana-keygen new # Airdrop some SOL for testing solana airdrop 5
-
Start the development servers
# Start all services pnpm dev # Or start specific services pnpm dev --filter=frontend # Frontend only pnpm dev --filter=program # Program only
-
Build the Anchor program
cd apps/program anchor build -
Deploy the program (if needed)
cd apps/program anchor deploy
The frontend features a flexible background system. You can easily change the background by modifying apps/frontend/app/page.tsx:
export default function Home() {
return (
<div className="min-h-screen w-full relative">
<div
className="absolute inset-0 z-0"
style={{
backgroundImage: "radial-gradient(125% 125% at 50% 90%, #fff 40%, #7c3aed 100%, transparent)",
}}
/>
<AMM />
</div>
);
}export default function Home() {
return (
<div className="min-h-screen w-full bg-[#020617] relative">
<div
className="absolute inset-0 z-0"
style={{
backgroundImage: `radial-gradient(circle 500px at 50% 100px, rgba(139,92,246,0.4), transparent)`,
}}
/>
<AMM />
</div>
);
}export default function Home() {
return (
<div className="min-h-screen w-full bg-[#0a0a0a] relative">
<div
className="absolute inset-0 z-0"
style={{
backgroundImage: `radial-gradient(circle 600px at 30% 40%, rgba(20,184,166,0.3), transparent)`,
}}
/>
<AMM />
</div>
);
}cd apps/program
node scripts/create-tokens.jscd apps/program
npx ts-node scripts/initialize-pool.tscd apps/program
node scripts/add-liquidity.jscd apps/program
node scripts/test-swap.jspnpm dev- Start all development serverspnpm build- Build all packages and appspnpm lint- Run linting across all packagespnpm clean- Clean all build artifacts
pnpm dev- Start Next.js development serverpnpm build- Build the frontend for productionpnpm start- Start production serverpnpm lint- Run ESLint
anchor build- Build the Anchor programanchor deploy- Deploy to configured networkanchor test- Run program testsanchor localnet- Start local validator
The program configuration is in apps/program/Anchor.toml:
[programs.devnet]
mini_amm = "3i6Xy9tVvVLB5LdYeAe3irwTTdzrHRNw7MC4qijcNVBW"
[provider]
cluster = "devnet"
wallet = "~/.config/solana/id.json"Key configuration files:
apps/frontend/utility/constants.ts- Program ID and other constantsapps/frontend/next.config.ts- Next.js configurationapps/frontend/tailwind.config.ts- Tailwind CSS configuration
- Program ID:
3i6Xy9tVvVLB5LdYeAe3irwTTdzrHRNw7MC4qijcNVBW - Token A:
M546sKo2CSLUgadVRayVcZAKX27bQTGUWpB9Y1vSgh7 - Token B:
BxjrNSGbZbkuJuuHBhjPze5YDiKEtmwHDRKajsPZiCL5
- Connect Wallet: Click the wallet button to connect your Solana wallet
- Swap Tokens: Use the swap interface to exchange tokens
- Add Liquidity: Provide liquidity to earn fees
- Remove Liquidity: Withdraw your liquidity position
- View Pool Stats: Monitor real-time pool information
- Modify Program: Edit
apps/program/programs/mini-amm/src/lib.rs - Update Frontend: Modify components in
apps/frontend/components/ - Add Features: Extend functionality using the existing patterns
- Customize UI: Change backgrounds, colors, and styling
cd apps/program
anchor testcd apps/frontend
pnpm test- Next.js 15 - React framework
- @solana/wallet-adapter - Wallet integration
- @coral-xyz/anchor - Solana program interaction
- Tailwind CSS - Styling
- TypeScript - Type safety
- Anchor - Solana development framework
- SPL Token - Token program integration
cd apps/program
anchor build
anchor deploy --provider.cluster devnetcd apps/frontend
pnpm build
# Deploy to your preferred hosting platform- Fork the repository
- Create your 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
This project is licensed under the MIT License - see the LICENSE file for details.
-
Wallet Connection Issues
- Ensure your wallet is set to Devnet
- Check if you have sufficient SOL for transactions
-
Program Errors
- Verify program is deployed correctly
- Check program ID matches in configuration
-
Frontend Build Issues
- Clear Next.js cache:
rm -rf .next - Reinstall dependencies:
pnpm install
- Clear Next.js cache:
-
RPC Issues
- Switch to a different RPC endpoint
- Check network connectivity
For questions and support:
- Open an issue on GitHub
- Check the troubleshooting section
- Review the Anchor and Solana documentation
- Solana Foundation for the excellent blockchain infrastructure
- Anchor framework for simplifying Solana development
- Next.js team for the amazing React framework
- Tailwind CSS for the utility-first CSS framework
Built with β€οΈ on Solana



