Module 0: Prerequisites & Environment Setup¶
This module guides you through setting up a complete development environment for Solana DApp development. By the end, you'll have all tools installed and verified.
Overview¶
| Tool | Purpose | Required |
|---|---|---|
| Rust | Smart contract development | Yes |
| Solana CLI | Blockchain interaction | Yes |
| Anchor | Framework for Solana programs | Yes |
| Node.js + pnpm | Frontend development | Yes |
| Python + Poetry | Backend services | Yes |
| Docker | Containerization | Yes |
| Kubernetes tools | Deployment | Optional* |
*Required for Modules 12-13
1. Rust Installation¶
Rust is the primary language for Solana smart contracts.
Expected Output¶
2. Solana CLI Installation¶
The Solana CLI allows you to interact with Solana clusters.
# Open PowerShell as Administrator
cmd /c "curl -sSfL https://release.solana.com/v1.18.0/solana-install-init-x86_64-pc-windows-msvc.exe --output solana-install-init.exe"
.\solana-install-init.exe v1.18.0
# Add to PATH (adjust version if needed):
$env:PATH += ";$HOME\.local\share\solana\install\active_release\bin"
# Make permanent by adding to system environment variables
Configure Solana CLI¶
# Generate a new keypair (for development only)
solana-keygen new --no-bip39-passphrase
# Set to devnet for development
solana config set --url devnet
# Verify configuration
solana config get
Expected Output¶
Config File: /home/user/.config/solana/cli/config.yml
RPC URL: https://api.devnet.solana.com
WebSocket URL: wss://api.devnet.solana.com/
Keypair Path: /home/user/.config/solana/id.json
Commitment: confirmed
Get Devnet SOL¶
3. Anchor Framework¶
Anchor provides high-level abstractions for Solana program development.
Install Anchor Version Manager (AVM)¶
cargo install --git https://github.com/coral-xyz/anchor avm --locked --force
avm install latest
avm use latest
# Verify
anchor --version
Expected Output¶
4. Node.js and pnpm¶
Node.js is required for frontend development and Anchor testing.
Expected Output¶
5. Python and Poetry¶
Python is used for FastAPI backend services.
# Using pyenv (recommended)
curl https://pyenv.run | bash
# Add to shell config (.bashrc/.zshrc):
export PATH="$HOME/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
# Install Python
pyenv install 3.11
pyenv global 3.11
# Install Poetry
curl -sSL https://install.python-poetry.org | python3 -
python --version
poetry --version
Expected Output¶
6. Docker¶
Docker is required for local development and Kubernetes deployment.
Download and install Docker Desktop for Windows
Download and install Docker Desktop for Mac
7. Kubernetes Tools (Optional)¶
Required for Modules 12-13 (deployment).
kubectl¶
Minikube¶
Helm¶
8. IDE Setup¶
VS Code Extensions¶
Install these extensions for the best development experience:
| Extension | ID | Purpose |
|---|---|---|
| rust-analyzer | rust-lang.rust-analyzer | Rust language support |
| Anchor | nickcuthbert.anchor | Anchor syntax highlighting |
| Solana | piotrminkowski.solana-suite | Solana development tools |
| ESLint | dbaeumer.vscode-eslint | JavaScript/TypeScript linting |
| Prettier | esbenp.prettier-vscode | Code formatting |
| Python | ms-python.python | Python support |
| Docker | ms-azuretools.vscode-docker | Docker integration |
# Install via command line
code --install-extension rust-lang.rust-analyzer
code --install-extension dbaeumer.vscode-eslint
code --install-extension esbenp.prettier-vscode
code --install-extension ms-python.python
code --install-extension ms-azuretools.vscode-docker
VS Code Settings¶
Add to your .vscode/settings.json:
{
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"[rust]": {
"editor.defaultFormatter": "rust-lang.rust-analyzer"
},
"[python]": {
"editor.defaultFormatter": "ms-python.python"
},
"rust-analyzer.check.command": "clippy"
}
9. Environment Validation Script¶
Create and run this script to verify your entire setup:
#!/usr/bin/env python3
"""Validate Solana DApp development environment."""
import subprocess
import sys
import shutil
from dataclasses import dataclass
@dataclass
class Tool:
name: str
command: str
min_version: str = ""
required: bool = True
TOOLS = [
Tool("Rust", "rustc --version", "1.70"),
Tool("Cargo", "cargo --version", "1.70"),
Tool("Solana CLI", "solana --version", "1.16"),
Tool("Anchor", "anchor --version", "0.29"),
Tool("Node.js", "node --version", "18"),
Tool("pnpm", "pnpm --version", "8"),
Tool("Python", "python --version", "3.10"),
Tool("Poetry", "poetry --version", "1.5"),
Tool("Docker", "docker --version", "24", required=False),
Tool("kubectl", "kubectl version --client", "", required=False),
Tool("minikube", "minikube version", "", required=False),
Tool("Helm", "helm version --short", "3", required=False),
]
def check_tool(tool: Tool) -> tuple[bool, str]:
"""Check if a tool is installed and return version."""
try:
result = subprocess.run(
tool.command.split(),
capture_output=True,
text=True,
timeout=10
)
output = result.stdout.strip() or result.stderr.strip()
return True, output.split('\n')[0]
except (subprocess.SubprocessError, FileNotFoundError):
return False, "Not installed"
def main():
print("=" * 60)
print("Solana DApp Development Environment Validator")
print("=" * 60 + "\n")
all_required_ok = True
for tool in TOOLS:
ok, version = check_tool(tool)
status = "[OK]" if ok else ("[WARN]" if not tool.required else "[FAIL]")
print(f"{status:8} {tool.name:15} {version}")
if not ok and tool.required:
all_required_ok = False
print("\n" + "=" * 60)
if all_required_ok:
print("All required tools are installed!")
print("You're ready to start the course.")
sys.exit(0)
else:
print("Some required tools are missing.")
print("Please install them before proceeding.")
sys.exit(1)
if __name__ == "__main__":
main()
Save as scripts/validate-env.py and run:
Expected Output¶
============================================================
Solana DApp Development Environment Validator
============================================================
[OK] Rust rustc 1.75.0
[OK] Cargo cargo 1.75.0
[OK] Solana CLI solana-cli 1.18.0
[OK] Anchor anchor-cli 0.30.0
[OK] Node.js v20.10.0
[OK] pnpm 8.12.0
[OK] Python Python 3.11.6
[OK] Poetry Poetry 1.7.1
[OK] Docker Docker version 24.0.7
[WARN] kubectl Not installed
[WARN] minikube Not installed
[WARN] Helm Not installed
============================================================
All required tools are installed!
You're ready to start the course.
Troubleshooting¶
Common Issues¶
Rust not found after installation
Ensure you've sourced the Rust environment:
Or restart your terminal.Solana CLI installation fails on Windows
Try running PowerShell as Administrator, or use WSL2 for a Linux environment.
Anchor build fails with 'program not found'
Ensure Solana CLI is in your PATH and you've run:
Permission denied when running Docker
On Linux, add your user to the docker group:
Next Steps¶
With your environment ready, proceed to:
Module 1: Blockchain Fundamentals
Need Help?
If you encounter issues not covered here, please open an issue on the GitHub repository.