https://github.com/omnidotdev/template-solana-anchor
โ Solana Anchor template
https://github.com/omnidotdev/template-solana-anchor
anchor foss mit open-source rust solana template
Last synced: about 2 months ago
JSON representation
โ Solana Anchor template
- Host: GitHub
- URL: https://github.com/omnidotdev/template-solana-anchor
- Owner: omnidotdev
- License: apache-2.0
- Created: 2026-01-25T10:23:48.000Z (4 months ago)
- Default Branch: master
- Last Pushed: 2026-03-31T17:15:41.000Z (2 months ago)
- Last Synced: 2026-04-06T03:37:14.991Z (about 2 months ago)
- Topics: anchor, foss, mit, open-source, rust, solana, template
- Language: Shell
- Homepage:
- Size: 32.2 KB
- Stars: 2
- Watchers: 0
- Forks: 0
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# โ Solana Anchor Template
This is a template repository for a Solana program built with [Anchor](https://www.anchor-lang.com).
## Features
- ๐ **Modern Stack**: Built with [Anchor](https://www.anchor-lang.com) 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](https://squads.so) multisig support for upgrade authority
- Pre-deployment validation checks
- ๐ ๏ธ **Developer Experience**:
- Code quality with [Biome](https://biomejs.dev) for TypeScript linting
- [Changesets](https://github.com/changesets/changesets) for versioning
- Local validator for development
- Easy spin up with [Tilt](https://tilt.dev)
- ๐ข **Production Ready**:
- Automated deployment scripts
- Pre-deploy validation
- Upgrade support
## Prerequisites
- [Rust](https://rustup.rs)
- [Solana CLI](https://docs.solana.com/cli/install-solana-cli-tools)
- [Anchor CLI](https://www.anchor-lang.com/docs/installation)
- [Bun](https://bun.sh)
## Local Development
### Installation
```sh
bun install
tilt up
```
### Building
```sh
bun build
# or
anchor build
```
### Testing
```sh
bun test
# or
anchor test
```
### Local Validator
Start a local Solana validator:
```sh
./scripts/start-validator.sh
```
## Deployment
### Deploy to Devnet
```sh
# Get devnet SOL (repeat 4-5 times)
solana config set --url devnet
solana airdrop 2
# Deploy
./scripts/deploy.sh devnet --new
```
### Deploy to Mainnet
```sh
./scripts/deploy.sh mainnet --new
```
### Upgrade Existing Program
```sh
./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](https://squads.so) to secure upgrade authority:
```sh
solana program set-upgrade-authority \
--new-upgrade-authority
```
## License
The code in this repository is licensed under Apache 2.0, ยฉ [Omni LLC](https://omni.dev). See [LICENSE.md](LICENSE.md) for more information.