How premchandyadav369/quantapath works
Project type and purpose
• QuantaPath is a full-stack web application (Next.js + TypeScript + Tailwind CSS) that demonstrates a hybrid quantum-classical approach to solving the Traveling Salesperson Problem (TSP).
• It provides an interactive map UI, calls serverless API routes (OpenRouteService for distances/geocoding and a mock “optimize” API), compares classical and quantum-simulated solvers, and visualizes performance analytics.
File structure
• Top-level
• next.config.mjs, tsconfig.json, package.json, README.md
• public/ (static assets)
• styles/ (global CSS)
• .github/workflows (CI/CD)
• app/ (Next.js 13+ App Router)
• layout.tsx, page.tsx, globals.css
• api/ – serverless functions for directions, distance matrix, geocode, optimize
• components/ – React UI subcomponents (maps, controls, visualization, theme provider)
• components/ui/ – shared UI primitives (buttons, inputs, cards, etc.)
• lib/services/ – client-side adapters and solver wrappers
• api-client.ts (OpenRouteService wrapper)
• classical-service.ts (Nearest Neighbor, Simulated Annealing, 2-opt, 3-opt)
• quantum-service.ts (TypeScript simulation of HAWS-QAOA)
• scripts/qaoa_solver.py – standalone Python QAOA implementation using Qiskit (optional for deeper runs)
• No persistent database; “Like” feature likely uses browser storage or external persistence stub.
README for architecture insights
• Frontend: Next.js + React + TypeScript + Tailwind
• Serverless API: OpenRouteService integration + mock optimize endpoint
• Core solvers:
– Classical (Nearest Neighbor, Simulated Annealing, 2-opt, 3-opt)
– Quantum (HAWS-QAOA simulation in TS; optional Python/Qiskit script)
• Deployment on Vercel (serverless functions + static hosting)
Main components and interactions
a. Frontend (Client)
– Next.js pages/React components
– Map UI: components/google-map.tsx, interactive-map.tsx
– Controls & dashboards: simulation-controls.tsx, benchmark-dashboard.tsx, etc.
b. API Layer (Serverless Functions)
– /api/geocode → lib/services/api-client → OpenRouteService
– /api/distance/matrix → OpenRouteService distance matrix
– /api/directions → turn-by-turn directions via OpenRouteService
– /api/optimize → dispatch to classical-service OR quantum-service
c. Solver Services (Business Logic)
– ClassicalService (heuristic and local search)
– QuantumService (TS mock QAOA)
– Python QAOA script (optional offline heavy compute)
d. External Services
– OpenRouteService APIs
– (Optional) Qiskit if using Python script
e. UI State / Storage
– In-memory React state or browser storage for “liked” routes
Architectural patterns and design principles
• Separation of concerns: UI vs. API vs. business logic (“services”)
• Serverless micro–endpoints in Next.js App Router
• Modular React components (atomic design in components/ui)
• Pluggable solver strategy pattern (classical vs. quantum)
• Hybrid compute: client-side TS simulate + optional Python/Qiskit run