Documentation Index
Fetch the complete documentation index at: https://mintlify.com/blueshift-gg/quasar/llms.txt
Use this file to discover all available pages before exploring further.
quasar init is the starting point for every Quasar Solana program. It creates a complete project directory with a configured Quasar.toml, a Cargo.toml, a generated program keypair, and your choice of test framework and template. By default the command walks you through a short interactive menu; pass --yes to skip every prompt and use your saved defaults instead.
Basic Usage
If you provide NAME, that value is used as the project directory and crate name. If you omit it, you are prompted to enter one interactively. Project names must be valid Rust crate identifiers — lowercase ASCII letters, digits, hyphens, and underscores — and must not start with a digit (e.g. my-program, vault_v2).
To scaffold inside the current directory instead of creating a subdirectory, pass . as the name:
Interactive Prompts vs. --yes Mode
Without any flags, quasar init walks you through a series of prompts:
- Project name — pre-filled if you passed
NAME
- Toolchain —
solana (cargo build-sbf) or upstream (cargo +nightly build-bpf)
- Test language —
None, Rust, or TypeScript
- Rust test framework —
QuasarSVM or Mollusk (only shown for Rust tests)
- TypeScript SDK —
Kit or Web3.js (only shown for TypeScript tests)
- Package manager —
pnpm, bun, npm, yarn, or a custom command (only shown for TypeScript tests)
- Additional client languages — TypeScript, Go (experimental), Python (experimental); Rust is always included
- Template —
Minimal or Full
- Git setup — initialize and commit, initialize only, or skip
Pass -y / --yes to accept all saved defaults without prompting. This mode requires a NAME argument:
quasar init my-program --yes
Your choices are saved to ~/.quasar/config.toml after each run so that --yes reflects what you last selected.
Flags
| Flag | Description |
|---|
NAME | Project name; skips the interactive name prompt |
-y, --yes | Skip prompts and use saved defaults |
--no-git | Skip git init and the initial commit |
--template minimal|full | Project template to scaffold |
--test-language none|rust|typescript | Test language for the project |
--rust-framework quasar-svm|mollusk | Rust test framework (when --test-language rust) |
--ts-sdk kit|web3.js | TypeScript SDK (when --test-language typescript) |
--toolchain solana|upstream | Build toolchain to use |
--verbose | Show each scaffold step as it runs |
All --yes flag values are validated before scaffolding begins. Passing an unrecognized value (e.g. --template invalid) produces a clear error with the list of valid options.
Templates
minimal
The minimal template keeps everything in src/lib.rs. It generates a single initialize instruction inline and has no subdirectory structure. This is the best starting point for simple programs or learning the framework.
my-program/
├── Cargo.toml
├── Quasar.toml
├── .gitignore
├── target/
│ └── deploy/
│ └── my-program-keypair.json
└── src/
└── lib.rs
full
The full template separates instructions, state, and errors into their own modules, matching the layout used by larger production programs:
my-program/
├── Cargo.toml
├── Quasar.toml
├── .gitignore
├── target/
│ └── deploy/
│ └── my-program-keypair.json
└── src/
├── lib.rs
├── state.rs
├── errors.rs
└── instructions/
├── mod.rs
└── initialize.rs
src/state.rs contains an example MyAccount struct with a discriminator, and src/errors.rs contains an example MyError enum. Both use quasar_lang::prelude::*.
Generated src/lib.rs (minimal template)
#![cfg_attr(not(test), no_std)]
use quasar_lang::prelude::*;
declare_id!("<generated-program-id>");
#[derive(Accounts)]
pub struct Initialize {
pub payer: Signer,
pub system_program: Program<SystemProgram>,
}
impl Initialize {
#[inline(always)]
pub fn initialize(&self) -> Result<(), ProgramError> {
Ok(())
}
}
#[program]
mod my_program {
use super::*;
#[instruction]
pub fn initialize(ctx: Ctx<Initialize>) -> Result<(), ProgramError> {
ctx.accounts.initialize()
}
}
A fresh ed25519 keypair is generated during scaffolding, the public key is written into declare_id!(), and the 64-byte keypair is saved to target/deploy/<name>-keypair.json.
quasar add — Add Instructions, State, and Errors
After your project is created, use quasar add to extend it without writing boilerplate manually. You can pass multiple flags in a single invocation.
quasar add --instruction transfer
quasar add --state vault
quasar add --error vault_error
# Or combine them:
quasar add -i transfer -s vault -e vault_error
| Flag | Description |
|---|
-i NAME, --instruction NAME | Add a new instruction handler |
-s NAME, --state NAME | Add a new state account struct |
-e NAME, --error NAME | Add a new error enum |
At least one of these flags must be provided.
What Gets Generated
--instruction NAME creates src/instructions/<name>.rs with an Accounts struct and an impl block, updates src/instructions/mod.rs, and inserts a new #[instruction] entry in the #[program] block of src/lib.rs. If the instructions/ directory does not yet exist (minimal template), it is created and wired into src/lib.rs automatically.
--state NAME appends a new #[account(discriminator = N)] struct to src/state.rs, auto-incrementing the discriminator from the highest existing value. If src/state.rs does not exist, it is created with discriminator 1.
--error NAME appends a new #[error_code] enum to src/errors.rs. If src/errors.rs does not exist, it is created fresh.
quasar keys — Manage the Program Keypair
The program keypair determines the on-chain address of your deployed program. quasar keys provides three subcommands for working with it.
quasar keys list # Print the current program ID (public key)
quasar keys sync # Update declare_id!() to match the keypair file
quasar keys new # Generate a new program keypair
quasar keys new --force # Overwrite an existing keypair
| Subcommand | Description |
|---|
list | Print the program ID derived from the keypair file |
sync | Update declare_id!() in src/lib.rs to match the keypair |
new | Generate a fresh ed25519 keypair and auto-sync declare_id!() |
new --force | Overwrite an existing keypair (changes the program address) |
Running quasar keys new --force generates a completely new program address. Any previously deployed version of the program will no longer be upgradeable from this keypair.
quasar config — Global CLI Settings
quasar config reads and writes the global configuration file at ~/.quasar/config.toml. It supports four subcommands:
quasar config list # Print all settings
quasar config get defaults.toolchain # Read a single key
quasar config set defaults.toolchain upstream # Write a value
quasar config reset # Restore factory defaults
Running quasar config with no subcommand opens an interactive menu.
Available Config Keys
| Key | Valid Values | Description |
|---|
defaults.toolchain | solana, upstream | Default build toolchain for quasar init |
defaults.test_language | none, rust, typescript | Default test language |
defaults.rust_framework | quasar-svm, mollusk | Default Rust test framework |
defaults.ts_sdk | kit, web3.js | Default TypeScript SDK |
defaults.template | minimal, full | Default project template |
defaults.git | commit, init, skip | Default git setup behavior |
ui.animation | true, false | Show the init banner animation |
ui.color | true, false | Enable colored terminal output |
Example ~/.quasar/config.toml
[defaults]
toolchain = "solana"
test_language = "rust"
rust_framework = "quasar-svm"
template = "minimal"
git = "commit"
[ui]
animation = false
color = true
After your first quasar init, the CLI saves your chosen options as the new defaults and sets ui.animation = false so the banner only appears once.