A browser-based quantum computing playground for building circuits, running quantum algorithms, and validating simulations with @nxrix/ketra — a JavaScript quantum computing framework inspired by Qiskit.
What is this? An interactive lab for quantum programming: entanglement, Grover search, VQE, QFT, OpenQASM, noise models, Shor factorization, and a full quantum API test suite — all running in your browser.
After enabling GitHub Pages (see below), the quantum playground opens at:
https://<your-username>.github.io/<repo-name>/
| Tab | Description |
|---|---|
| Quantum demos | 8 live quantum experiments — Bell entanglement, Grover search, VQE, QFT, OpenQASM, noisy simulation, Shor, Bloch sphere |
| Quantum test suite | 367 assertions across 28 sections — full validation of the quantum computing stack |
- Quantum linear algebra — complex amplitudes, Pauli matrices, tensor products
- Quantum circuits — gates, registers, parameterized rotations, multi-controlled ops
- Quantum simulation — statevector & noisy QASM simulators with shot-based measurement
- Quantum information — statevectors, density matrices, Clifford/stabilizer formalism, Schmidt decomposition
- Quantum algorithms — VQE, QAOA, Grover, phase estimation, Shor, HHL
- Quantum noise — depolarizing, bit/phase flip, amplitude damping, readout errors
- Quantum transpiler — gate decomposition, Sabre routing, basis translation, DAG optimization
- Quantum languages — OpenQASM 2 & 3 import/export
- Quantum primitives — Estimator & Sampler (v1 and v2) for expectation values and sampling
- Quantum visualization — circuit diagrams, ASCII histograms, Bloch sphere, state plots
Serve the repository root with any static file server:
# Using npx (Node.js)
npx serve .
# Or Python
python -m http.server 8080Open http://localhost:8080. The playground loads the Ketra quantum SDK from jsDelivr CDN — no build step required.
The quantum playground lives at the repository root (index.html), so the site URL serves it directly.
Option A — GitHub Actions (recommended)
- Push this repository to GitHub.
- Go to Settings → Pages.
- Set Source to GitHub Actions.
- Push to
main— the workflow in.github/workflows/pages.ymldeploys automatically.
Option B — Branch deploy
- Go to Settings → Pages.
- Set Source to Deploy from a branch.
- Choose branch
mainand folder/ (root).
index.html # Quantum playground UI (site entry point)
css/style.css # Styles
js/
├── main.js # App bootstrap & UI wiring
├── runner.js # Test runner with pass/fail tracking
├── demos.js # Quantum computing demo definitions
├── tests.js # Full quantum test suite (adapted from ketra/test.js)
└── tests-source.js # Original upstream test file (reference)
vendor/ # Local copy of @nxrix/ketra npm package (optional)
Install the quantum SDK:
npm install @nxrix/ketraCreate and simulate a Bell state — the canonical entangled quantum circuit:
import { QuantumCircuit, simulate } from "@nxrix/ketra";
const qc = new QuantumCircuit(2, 2);
qc.h(0); // superposition on qubit 0
qc.cx(0, 1); // entangle qubits 0 and 1
qc.measure(0, 0); // measure qubit → classical bit
qc.measure(1, 1);
const result = simulate(qc, 1024); // 1024 measurement shots
console.log(result.get_counts().to_dict()); // { "00": ~512, "11": ~512 }
console.log(qc.draw()); // ASCII circuit diagramOr load the quantum SDK in the browser:
<script type="module">
import * as ketra from "https://cdn.jsdelivr.net/npm/@nxrix/ketra@1.2.2/+esm";
</script>MIT — same as the Ketra library.