Skip to content

⚓ Solana Anchor Template

This is a template repository for a Solana program built with Anchor.

Features

  • 🚀 Modern Stack: Built with Anchor framework for Solana program development
  • 🔗 Blockchain Ready: Deploy to devnet or mainnet with automated scripts
  • 🧪 Testing: Anchor test framework with TypeScript client tests
  • 🔒 Security:
    • Squads multisig support for upgrade authority
    • Pre-deployment validation checks
  • 🛠️ Developer Experience:
    • Code quality with Biome for TypeScript linting
    • Changesets for versioning
    • Local validator for development
    • Easy spin up with Tilt
  • 🚢 Production Ready:
    • Automated deployment scripts
    • Pre-deploy validation
    • Upgrade support

Prerequisites

Local Development

Installation

bun install
tilt up

Building

bun build
# or
anchor build

Testing

bun test
# or
anchor test

Local Validator

Start a local Solana validator:

./scripts/start-validator.sh

Deployment

Deploy to Devnet

# Get devnet SOL (repeat 4-5 times)
solana config set --url devnet
solana airdrop 2

# Deploy
./scripts/deploy.sh devnet --new

Deploy to Mainnet

./scripts/deploy.sh mainnet --new

Upgrade Existing Program

./scripts/deploy.sh devnet
# or
./scripts/deploy.sh mainnet

Scripts

Script Description
deploy.sh Build and deploy to devnet/mainnet
pre-deploy-check.sh Validate config before deployment
start-validator.sh Start local Solana validator
init-config.ts Initialize on-chain program config

Project Structure

programs/{{program-name}}/
├── src/
│   ├── lib.rs           # Program entry point
│   ├── instructions/    # Instruction handlers
│   ├── state/           # Account definitions
│   └── errors.rs        # Custom errors
scripts/
├── deploy.sh            # Deployment automation
└── ...
tests/
├── {{program-name}}.ts  # TypeScript tests

Costs

Action Approximate Cost
First deployment ~8 SOL
Upgrade ~0.01 SOL

Security

For mainnet deployments, use Squads multisig to secure upgrade authority:

solana program set-upgrade-authority <PROGRAM_ID> \
  --new-upgrade-authority <SQUADS_ADDRESS>

License

The code in this repository is licensed under Apache 2.0, © Omni LLC. See LICENSE.md for more information.

Releases

Sponsor this project

Packages

Contributors

Languages