Skip to main content

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

quasar init [NAME]
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:
quasar init .

Interactive Prompts vs. --yes Mode

Without any flags, quasar init walks you through a series of prompts:
  1. Project name — pre-filled if you passed NAME
  2. Toolchainsolana (cargo build-sbf) or upstream (cargo +nightly build-bpf)
  3. Test languageNone, Rust, or TypeScript
  4. Rust test frameworkQuasarSVM or Mollusk (only shown for Rust tests)
  5. TypeScript SDKKit or Web3.js (only shown for TypeScript tests)
  6. Package managerpnpm, bun, npm, yarn, or a custom command (only shown for TypeScript tests)
  7. Additional client languages — TypeScript, Go (experimental), Python (experimental); Rust is always included
  8. TemplateMinimal or Full
  9. 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

FlagDescription
NAMEProject name; skips the interactive name prompt
-y, --yesSkip prompts and use saved defaults
--no-gitSkip git init and the initial commit
--template minimal|fullProject template to scaffold
--test-language none|rust|typescriptTest language for the project
--rust-framework quasar-svm|molluskRust test framework (when --test-language rust)
--ts-sdk kit|web3.jsTypeScript SDK (when --test-language typescript)
--toolchain solana|upstreamBuild toolchain to use
--verboseShow 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
FlagDescription
-i NAME, --instruction NAMEAdd a new instruction handler
-s NAME, --state NAMEAdd a new state account struct
-e NAME, --error NAMEAdd 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
SubcommandDescription
listPrint the program ID derived from the keypair file
syncUpdate declare_id!() in src/lib.rs to match the keypair
newGenerate a fresh ed25519 keypair and auto-sync declare_id!()
new --forceOverwrite 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

KeyValid ValuesDescription
defaults.toolchainsolana, upstreamDefault build toolchain for quasar init
defaults.test_languagenone, rust, typescriptDefault test language
defaults.rust_frameworkquasar-svm, molluskDefault Rust test framework
defaults.ts_sdkkit, web3.jsDefault TypeScript SDK
defaults.templateminimal, fullDefault project template
defaults.gitcommit, init, skipDefault git setup behavior
ui.animationtrue, falseShow the init banner animation
ui.colortrue, falseEnable 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.

Build docs developers (and LLMs) love