"The universe is not only stranger than we suppose,
but stranger than we can suppose."
— J.B.S. Haldane
This project implements a fully functional quantum circuit simulator that runs a real Bell State — the quantum computing equivalent of "Hello, World!" — using IBM's Qiskit as the quantum backend and TypeScript as the orchestration layer.
Unlike classical computing where a bit is either 0 or 1, this program creates 2 entangled qubits that exist in superposition until measured. The result is always either |00⟩ or |11⟩ — never |01⟩ or |10⟩ — a direct demonstration of quantum entanglement.
This is not a toy simulation. This is the exact same mathematics that runs on IBM Quantum's real hardware.
| Feature | Description |
|---|---|
| 🔬 Real Quantum Circuit | Bell State Φ⁺ built with Hadamard + CNOT gates |
| 📊 Statistical Analysis | 1024-shot measurement with probability histogram |
| 🖥️ Terminal Interface | Full-color ASCII output with circuit diagram |
| 🌐 Browser Preview | Beautiful dark-mode web dashboard |
| ♻️ Live Re-simulation | Click a button to re-run the quantum circuit |
| 🔗 TypeScript ↔ Python | Clean inter-process bridge architecture |
| ⚡ Zero Config | Auto-installs Qiskit if not present |
┌───┐ ┌─┐
q_0: ┤ H ├──■──┤M├
└───┘┌─┴─┐└╥┘
q_1: ─────┤ X ├─╫─
└───┘ ║
c: ════════════╩══
1. Initial state — Both qubits start at |0⟩:
|Ψ⟩ = |00⟩
2. Hadamard gate (H) — Qubit 0 enters superposition:
|Ψ⟩ = (1/√2)|0⟩ ⊗ |0⟩ + (1/√2)|1⟩ ⊗ |0⟩
= (1/√2)(|00⟩ + |10⟩)
3. CNOT gate (CX) — Qubit 1 flips when qubit 0 is |1⟩:
|Ψ⟩ = (1/√2)|00⟩ + (1/√2)|11⟩ ← Bell State Φ⁺
4. Measurement — The wave function collapses:
|00⟩with probability 50%|11⟩with probability 50%|01⟩and|10⟩— impossible
This impossibility of opposite outcomes across 1024 trials is proof of entanglement.
- Python 3.9+ — python.org
- Node.js 18+ — nodejs.org
# 1. Clone the repository
git clone https://github.com/YOUR_USERNAME/quantum-hello-world.git
cd quantum-hello-world
# 2. Install Python dependencies (Qiskit)
pip install qiskit qiskit-aer
# 3. Install Node.js dependencies
npm install
# 4. Compile TypeScript
npx tscnode dist/main.jsnode server.js
# Open http://localhost:3741Tip: The TypeScript runtime auto-installs Qiskit if it's missing on your machine.
quantum-hello-world/
│
├── quantum_circuit.py # 🐍 Qiskit quantum circuit (Python backend)
├── main.ts # 🔷 Terminal orchestrator (TypeScript)
├── server.js # 🌐 Web dashboard server (Node.js)
├── tsconfig.json # TypeScript compiler config
├── package.json # Node.js dependencies
│
├── dist/ # Compiled TypeScript output
│ └── main.js
│
└── docs/
└── assets/
└── preview.png # Preview screenshot
┌────────────────────────────────────────────┐
│ TypeScript Orchestrator │
│ (main.ts / server.js) │
│ │
│ • Checks Qiskit availability │
│ • Spawns Python subprocess │
│ • Parses JSON result │
│ • Renders terminal / HTML output │
└─────────────────┬──────────────────────────┘
│ stdin/stdout (JSON)
▼
┌────────────────────────────────────────────┐
│ Python / Qiskit Backend │
│ (quantum_circuit.py) │
│ │
│ • Builds QuantumCircuit(2, 2) │
│ • Applies H + CX gates │
│ • Simulates with AerSimulator │
│ • Returns counts + circuit diagram │
└────────────────────────────────────────────┘
╔══════════════════════════════════════════════════════════╗
║ ⚛ SIMULADOR QUANTICO — HELLO WORLD ⚛ ║
║ TypeScript + Qiskit (Python) ║
╚══════════════════════════════════════════════════════════╝
┌─ CIRCUITO QUANTICO ──────────────────────────────────────┐
│ ┌───┐ ┌─┐
│ q_0: ┤ H ├──■──┤M├───
│ └───┘┌─┴─┐└╥┘┌─┐
│ q_1: ─────┤ X ├─╫─┤M├
│ └───┘ ║ └╥┘
│ c: 2/═══════════╩══╩═
└──────────────────────────────────────────────────────────┘
┌─ HISTOGRAMA DE MEDICOES ─────────────────────────────────┐
│ |00⟩ ████████████████████████████████ 514 shots (50.2%)
│ |11⟩ ████████████████████████████████ 510 shots (49.8%)
└──────────────────────────────────────────────────────────┘
Quantum computing is not just a faster computer — it's a fundamentally different way of processing information. While a classical computer with n bits can represent one of 2ⁿ states at a time, a quantum computer with n qubits can represent all 2ⁿ states simultaneously.
This Bell State program is the "Hello World" of this new computing paradigm because it demonstrates the two properties that make quantum computers powerful:
- Superposition — A qubit can be 0 AND 1 at the same time
- Entanglement — Two qubits can be correlated across any distance, instantly
Applications currently being developed with these principles:
- 🔐 Quantum Cryptography — Unbreakable encryption
- 💊 Drug Discovery — Simulating molecular interactions
- 🏦 Financial Optimization — Portfolio optimization at scale
- 🤖 Quantum ML — Next-generation AI algorithms
Contributions are welcome! Here are some ideas to extend this project:
- Add more quantum gates (Toffoli, S, T, Rx, Ry, Rz)
- Implement Grover's search algorithm
- Add Bloch sphere visualization
- Support running on real IBM Quantum hardware via API
- Add quantum teleportation circuit demo
- WebSocket-based live simulation updates
- Qiskit Documentation — Official IBM quantum docs
- Quantum Computing: An Applied Approach — Excellent textbook
- IBM Quantum Learning — Free interactive courses
- Quirk Quantum Simulator — Visual circuit builder
MIT License — see LICENSE for details.
Built with ⚛ by Itamar Iliuk
If this project sparked your curiosity about quantum computing, give it a ⭐!
