Skip to content

cybercivizen/anchor-fullstack-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Anchor Fullstack Template 🚀

A complete Docker-based development template for building fullstack Solana applications with Anchor, featuring automatic setup, deployment, and a modern web stack.

🏗️ Architecture

This template includes 4 Docker services:

  1. solana-validator - Local Solana test validator (v1.18.26)
  2. anchor-program - Anchor development environment (v0.31.0) with auto-deployment
  3. backend - Node.js/Express backend server
  4. frontend - Frontend application (React/Vue/Svelte)

✨ Features

  • 🔄 Fully Automated Setup - Wallet creation, funding, and configuration
  • 🚀 One-Command Deployment - Custom anchor-deploy script with Docker compatibility
  • 🔧 Hot Reload - Changes reflect instantly across all services
  • 🐳 Isolated Environment - No local Solana/Anchor installation needed
  • 📦 Production Ready - Optimized Docker configuration with caching

📋 Prerequisites

  • Docker Desktop installed
  • At least 8GB RAM available for Docker
  • Ports available: 3000, 5174, 8899, 8900, 9900

🚀 Quick Start

1. Clone and Start Services

git clone https://github.com/cybercivizen/anchor-fullstack-template.git
cd anchor-fullstack-template
docker-compose up -d

This automatically:

  • ✅ Starts Solana test validator
  • ✅ Creates wallet keypair
  • ✅ Airdrops SOL for testing
  • ✅ Configures Solana CLI
  • ✅ Starts backend and frontend

2. Initialize Your Anchor Project

docker-compose exec anchor-program bash
cd /workspace
anchor init my-app
cd my-app

3. Configure Anchor for Docker

Update my-app/Anchor.toml:

[provider]
cluster = "http://solana-validator:8899"
wallet = "/workspace/.anchor/test-keypair.json"

4. Build and Deploy

anchor build
anchor-deploy
# or simply: deploy

That's it! Your program is deployed and ready to use. 🎉

📍 Service Endpoints

🔧 Configuration

Validator Configuration

The test validator is configured in docker-compose.yml:

solana-validator:
  image: solanalabs/solana:v1.18.26
  ports:
    - "8899:8899" # RPC
    - "8900:8900" # WebSocket
    - "9900:9900" # Faucet
    - "8001:8001" # Gossip
    - "8003:8003" # TPU

Anchor Environment Variables

environment:
  - ANCHOR_PROVIDER_URL=http://solana-validator:8899
  - ANCHOR_WALLET=/workspace/.anchor/test-keypair.json

🐛 Troubleshooting

"Insufficient funds" Error

docker-compose exec anchor-program solana airdrop 5

Rebuild After Dependency Changes

docker-compose down
docker-compose up -d --build

Reset Everything (Clean State)

docker-compose down -v
docker-compose up -d --build

🔗 Resources


Built with ❤️ for the Solana ecosystem

About

Docker-based development template for building fullstack Solana applications with Anchor

Resources

Stars

Watchers

Forks

Contributors