A comprehensive quantum computing platform that provides unified simulation, circuit conversion, and visualization capabilities across multiple quantum frameworks using a hybrid Next.js and FastAPI architecture.
QCanvas is a modern, web-based quantum computing platform that bridges the gap between different quantum computing frameworks. It provides a unified interface for simulating quantum circuits, converting between different quantum programming languages, and visualizing quantum states and operations.
- Multi-Framework Support: Convert circuits between Cirq, Qiskit, and PennyLane
- Hybrid CPU–QPU Model: QCanvas orchestrates; QSim executes (simulator-first, pluggable QPU later)
- Real-Time Simulation: Execute quantum circuits with statevector, density matrix, or stabilizer backends
- OpenQASM 3.0 (Rosetta Stone): Universal intermediate representation across frameworks
- Smart Conversion Engine: AST-based parsing, intelligent gate mapping, built-in validation, instant analytics
- Interactive Visualization: Circuit rendering, histograms, and results analysis
- Shared TypeScript Types: Type safety across frontend and backend services
- Extensible Architecture: Plugin-based system for adding new frameworks
QCanvas/
├── frontend/ # Next.js-based web interface
│ ├── app/ # App Router pages and layouts
│ ├── components/ # Reusable UI components
│ ├── lib/ # Utility functions and state management
│ └── public/ # Static assets (images, icons)
│
├── backend/ # FastAPI REST API and WebSocket server
│ ├── app/ # Main application logic
│ │ ├── api/ # API routes and endpoints
│ │ ├── models/ # Database models and Pydantic schemas
│ │ └── services/ # Business logic services
│ └── alembic/ # Database migration scripts
│
├── quantum_converters/ # Framework conversion modules
│ ├── qiskit/ # Qiskit to OpenQASM converters
│ ├── cirq/ # Cirq to OpenQASM converters
│ └── pennylane/ # PennyLane to OpenQASM converters
│
├── quantum_simulator/ # Quantum simulation engine
│ ├── backends/ # Simulation backends (statevector, density matrix)
│ └── core/ # Core simulation logic
│
├── examples/ # Sample circuits and tutorials
│
├── docs/ # Project documentation
│
├── tests/ # Comprehensive test suite
│
└── scripts/ # Helper scripts for setup and maintenance
- QCanvas (Compilation/Orchestration): AST parsing, QASM generation, validation, hybrid scheduling
- QSim (Execution): High-performance simulation backends and result aggregation
- Next.js Frontend: UI components, routing, and simple operations
- FastAPI Backend: API, WebSockets, and heavy computations
- Shared TypeScript Types: Type safety across frontend and backend
- Python 3.9+
- Node.js 18+ (for Next.js)
- Docker & Docker Compose (for PostgreSQL, Redis, SonarQube)
- Git
git clone https://github.com/Umer-Farooq-CS/QCanvas.git
cd QCanvaspython -m venv qcanvas_env
.\qcanvas_env\Scripts\activatepip install -r requirements.txtdocker-compose up -dVerify services are running:
docker-compose psYou should see:
- qcanvas_postgres (port 5433)
- qcanvas_redis (port 6379)
- qcanvas_sonarqube (port 9000)
# Set Python path
$env:PYTHONPATH="d:\path\to\QCanvas\backend"
# Run database migrations
python -m alembic upgrade headpython backend/create_user.pyFollow prompts to create an admin account.
python backend/create_demo_account.pyThis creates a demo account (demo@qcanvas.dev / demo123) for testing. Demo data is cleared on logout.
python backend/verify_database.py📚 For detailed information about database architecture, security (CIA principles), and troubleshooting, see docs/db_setup.md
$env:PYTHONPATH="d:\path\to\QCanvas\backend"
python backend/start.pyBackend will run on http://localhost:8000
- API Docs:
http://localhost:8000/docs - Health Check:
http://localhost:8000/api/health
cd frontend
npm install
npm run devFrontend will run on http://localhost:3000
For a fresh Linux machine, you can install all requirements and start QCanvas using the provided scripts:
-
Clone the repository
git clone https://github.com/Umer-Farooq-CS/QCanvas.git cd QCanvas -
Run first‑time setup
# Installs system packages, creates venv, installs backend + frontend deps bash setup.sh -
Configure environment
cp environment.env.example environment.env # Edit environment.env with your configuration -
Start/stop QCanvas in the background
# Start Next.js frontend and FastAPI backend in background ./run.sh start # Stop all QCanvas services (kills node/next/uvicorn and clears PID files) ./run.sh stop
- Background logs are written to
logs/frontend.logandlogs/backend.log. - PID files
frontend.pidandbackend.pidare used to avoid double‑starting services.
- Background logs are written to
Endpoint: POST /api/converter/convert
Convert quantum circuit code from a specific framework to OpenQASM 3.0.
{
"source_code": "from qiskit import QuantumCircuit\nqc = QuantumCircuit(2)\nqc.h(0)\nqc.cx(0, 1)",
"source_framework": "qiskit",
"conversion_type": "classic"
}Response:
{
"success": true,
"qasm_code": "OPENQASM 3.0;...",
"framework": "qiskit",
"conversion_stats": { ... }
}Endpoint: POST /api/simulator/execute
Execute OpenQASM 3.0 code using the QSim engine with various backends.
{
"qasm_code": "OPENQASM 3.0; include \"stdgates.inc\"; qubit[2] q; bit[2] c; h q[0]; cx q[0], q[1]; c = measure q;",
"backend": "cirq", // Options: "cirq", "qiskit", "pennylane"
"shots": 1024
}Response:
{
"success": true,
"counts": { "00": 512, "11": 512 },
"metadata": { ... }
}DATABASE_URL: PostgreSQL connection stringREDIS_URL: Redis connection string for cachingSECRET_KEY: Application secret keyDEBUG: Enable debug mode (True/False)ALLOWED_HOSTS: Comma-separated list of allowed hostsNEXT_PUBLIC_API_URL: Frontend API endpoint for Next.js
# Run all tests
pytest
# Run specific test categories
pytest tests/unit/
pytest tests/integration/
pytest tests/e2e/
# Run frontend tests
cd frontend
npm test
# Run with coverage
pytest --cov=quantum_converters --cov=quantum_simulator --cov=backendWe welcome contributions! Please see our Contributing Guide for details.
This project is licensed under the Open Quantum Workbench Proprietary License. See the LICENSE file for details.
- Umer Farooq
- Hussan Waseem Syed
- Muhammad Irtaza Khan
- Aneeq Ahmed Malik
- Abeer Noor
- Abdullah Mehmood
- Dr. Imran Ashraf (Project Supervisor)
- Dr. Muhammad Nouman Noor (Co-Supervisor)
Built under Open Quantum Workbench: A FAST University Initiative