Get the Code
Download
Download the complete Sansqrit codebase β Rust engine, Python tools, DSL interpreter, 639 blocks, and visual canvas.
Download Options
π¦
FULL ZIP
Complete repository as ZIP. Includes all source files, tests, documentation. ~2 MB.
v3.1.0MIT
π¦
RUST ENGINE
Just the Rust WASM engine. lib.rs + Cargo.toml + build.sh. ~50 KB.
RustWASM
π
PYTHON TOOLS
precompute.py + generated JSON files. 8 data files, ~4 MB total.
Python 3.8+
Clone from Git
# Clone the full repository
git clone https://github.com/your-org/sansqrit.git
cd sansqrit
# Install Node.js dependencies (requires npm)
npm install
# Build Rust WASM engine (requires Rust + wasm-pack)
bash build.sh
# Generate pre-computed tables (requires Python 3.8+)
python3 precompute.py
# Run all tests
npm test # 39 core tests
npm run test:adv # 32 advanced DSL tests
# Start the application
npm start
# Open http://localhost:3000
File Structure
sansqrit/
βββ build.sh β One-command RustβWASM build
βββ package.json β npm configuration
βββ precompute.py β Python pre-computation script (1248 lines)
β
βββ quantum_engine/ β Rust crate
β βββ Cargo.toml
β βββ src/lib.rs β 442 lines, all gates, 12 tests
β
βββ wasm_pkg/ β Generated by wasm-pack (not in git)
β βββ quantum_engine.js
β βββ quantum_engine_bg.wasm β ~178 KB compiled binary
β
βββ src/
β βββ engine/
β β βββ quantum.js β JS engine fallback (798 lines)
β β βββ quantum_wasm.js β WASM bridge (336 lines)
β βββ dsl/
β β βββ interpreter.js β DSL interpreter (1064 lines)
β β βββ stdlib.js β 200+ stdlib functions (1184 lines)
β βββ blocks/
β β βββ registry.js β Blocks 1-180 (1937 lines)
β β βββ registry_extra.js β Blocks 181-360 (1341 lines)
β β βββ registry_extra_b.js β Blocks 361-528 (992 lines)
β βββ server/server.js β Express + WebSocket
β βββ export/circuit_export.jsβ 10 export formats
β
βββ public/ β Web UI
β βββ index.html
β βββ css/style.css
β βββ js/ app.js canvas.js palette.js properties.js
β
βββ tests/
β βββ test.js β 39 core tests
β βββ test_dsl_advanced.js β 32 advanced tests
β
βββ precomputed/ β Generated by precompute.py
βββ gate_matrices.json
βββ qft_matrices.json
βββ ... (8 files total)
Extract Rust Engine
To use only the Rust quantum engine in your own project:
# 1. Copy the quantum_engine folder into your project
cp -r sansqrit/quantum_engine my-project/
# 2. Add to your Cargo.toml:
# [dependencies]
# quantum-engine = { path = "./quantum_engine", features = ["wasm"] }
# 3. Build for WASM
cd quantum_engine
wasm-pack build --target bundler --out-dir ../wasm_pkg --release
// In your Rust code:
use quantum_engine::{QReg, QAlg};
fn main() {
let mut q = QReg::new("q", 4);
q.H_all(); // Hadamard on all 4 qubits
let hist = q.measure_all(1000);
println!("{:?}", hist);
}
Extract Python Tools
# Copy just the Python pre-computation script
cp sansqrit/precompute.py my-project/
# Run it (no dependencies beyond Python stdlib + optional numpy)
python3 precompute.py
python3 precompute.py --check # verify output
# Optional: install numpy for 3x faster QFT matrix generation
pip install numpy
Firebase Hosting
This website is designed for Firebase Hosting. Deploy in 3 commands:
# 1. Install Firebase CLI
npm install -g firebase-tools
# 2. Login to Firebase
firebase login
# 3. Deploy
firebase deploy
# Your site will be live at:
# https://sansqrit.web.app