A comprehensive Next.js application for building, simulating, and learning quantum circuits with AI-powered circuit generation and automatic Qiskit code export.
- Visual Quantum Circuit Builder: Intuitive drag-and-drop interface for building quantum circuits
- Real-time Simulation: Simulate quantum circuits and view measurement probabilities
- Multiple Qubit Support: Build circuits with 1-4 qubits
- Interactive Results: Toggle between simple and technical interpretations
- Natural Language Circuit Generation: Describe circuits in plain English
- Google Gemini AI Integration: Advanced AI-powered circuit creation
- Smart Circuit Analysis: AI analysis of circuit behavior and properties
- Example Query Library: Pre-built examples for common quantum algorithms
- Automatic Code Generation: Convert visual circuits to executable Python code
- Qiskit Export: Download or copy generated Qiskit code
- Syntax Highlighting: Beautiful code display with Python syntax highlighting
- Circuit Statistics: Gate counts, depth analysis, and performance metrics
- Installation Instructions: Built-in setup guides for Qiskit
- Algorithm Templates: Pre-built circuits for common quantum algorithms
- Grover's Search: Interactive implementation of quantum search
- Quantum Gate Library: Complete set of fundamental quantum gates
- Learning Resources: Explanations and interpretations for all results
- Node.js 18+
- Gemini API key from Google AI Studio
- Clone the repository:
git clone <your-repo-url>
cd SpurHacks- Install dependencies:
npm install- Set up environment variables:
npm run setup-envThis creates a .env.local file with your Gemini API key. The file is automatically excluded from version control.
If the setup script doesn't work, create a .env.local file manually:
# Gemini API Configuration
NEXT_PUBLIC_GEMINI_API_KEY=your_actual_api_key_herenpm run devOpen http://localhost:3000 to start building quantum circuits!
- Switch to the "Manual" tab
- Drag quantum gates from the palette to the circuit grid
- Adjust qubit count using the dropdown
- Click "Run Quantum Circuit" to simulate
- View results and generated Qiskit code
- Switch to the "AI" tab
- Type a description of your desired circuit
- Click the "β¨" button or press Enter
- AI generates and displays the circuit automatically
- Run simulation to see results
- Build any circuit (manual or AI-generated)
- Scroll to the "Qiskit Code" section
- Copy the code to clipboard or Download as
.pyfile - Run the code in any Python environment with Qiskit installed
- "Create a quantum coin flip"
- "Show me quantum entanglement"
- "Build a quantum search algorithm"
- "Demonstrate quantum interference"
- "Create a Bell state circuit"
- "Show me quantum teleportation"
- "Build a quantum random number generator"
- "Demonstrate quantum phase estimation"
| Gate | Symbol | Description | Qiskit Method |
|---|---|---|---|
| Hadamard | H | Creates superposition | qc.h(qubit) |
| Pauli-X | X | Bit flip (NOT gate) | qc.x(qubit) |
| Pauli-Y | Y | Y rotation | qc.y(qubit) |
| Pauli-Z | Z | Phase flip | qc.z(qubit) |
| CNOT | β | Controlled NOT | qc.cx(control, target) |
| Toffoli | CCβ | Controlled-Controlled-NOT | qc.ccx(control1, control2, target) |
| RX | RX | X rotation | qc.rx(angle, qubit) |
| RY | RY | Y rotation | qc.ry(angle, qubit) |
| Measure | π | Measure qubit | qc.measure(qubit, qubit) |
# Quantum Circuit: Bell State Circuit
# Generated from visual circuit builder
from qiskit import QuantumCircuit, Aer, execute
from qiskit.visualization import plot_histogram
import matplotlib.pyplot as plt
import numpy as np
# Create quantum circuit with 2 qubits and 2 classical bits
qc = QuantumCircuit(2, 2)
# Circuit gates:
# Step 1:
qc.h(0) # Hadamard gate on qubit 0
# Step 2:
qc.cx(0, 1) # CNOT: control=0, target=1
# Measure all qubits
qc.measure_all()
# Execute the circuit
backend = Aer.get_backend('qasm_simulator')
job = execute(qc, backend, shots=1000)
result = job.result()
# Get the results
counts = result.get_counts(qc)
print("Measurement Results:")
print(counts)
# Plot the histogram
plot_histogram(counts)
plt.show()- API keys are stored in environment variables and never committed to version control
.env.localfile is automatically excluded via.gitignore- Server-side validation ensures secure API calls
- Production deployment should use server-side only environment variables
See ENVIRONMENT_SETUP.md for detailed configuration information.
// Test AI integration
await window.testAI();
// Test Qiskit code generation
await window.testQiskit();
// Generate Qiskit code for current circuit
await window.generateQiskitCode(circuit, numQubits);
// Debug circuit data
window.debugCircuit(circuit);GET /api/test-qiskit- Test Qiskit code generationPOST /api/qiskit-code- Generate Qiskit code from circuitPOST /api/ai-circuit- AI-powered circuit generation
- AI Integration Guide - Detailed AI features and configuration
- Qiskit Integration Guide - Qiskit code generation and export
- Environment Setup Guide - Environment variable configuration
- Setup Instructions - Step-by-step setup guide
- Push your code to GitHub
- Connect to Vercel
- Add
NEXT_PUBLIC_GEMINI_API_KEYenvironment variable - Deploy automatically
- Netlify: Add environment variables in dashboard
- Railway: Use Railway's environment variable system
- Docker: Build with environment variables
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This project is open source and available under the MIT License.
- Google Gemini AI for powerful circuit generation
- IBM Qiskit for quantum computing framework
- Next.js for the amazing React framework
- Quantum Computing Community for educational resources
Ready to explore quantum computing? π Start building circuits at http://localhost:3000!