Welcome to the backend repository of QuantumCrypto! This project serves as the backend for the QuantumCrypto web application, which gamifies quantum key distribution (QKD) protocols for quantum computing education. The backend is built with Django REST Framework.
QuantumCrypto is an open-source web framework designed to provide an intuitive interface for experimenting with QKD protocols. By gamifying QKD protocols, users can simulate and explore quantum cryptography concepts in real-time interactions.
Ensure the following tools are installed on your machine: -Python (preferably with a virtual environment like Miniconda) -Docker -Docker Desktop (optional, but recommender for managing Docker containers)
To run the QuantumCrypto backend locally, follow these steps:
-
Clone this repository to your local machine:
-
Navigate to the project directory:
cd quantumcrypto-backend -
Set up a virtual environment (optional but recommended):
python -m venv venv -
Activate the virtual environment:
- On Windows:
venv\Scripts\activate - On macOS and Linux:
source venv/bin/activate
- On Windows:
-
Install dependencies:
pip install -r requirements.txt -
Run migrations to create the database schema:
python manage.py makemigrations python manage.py migrate --run-syncdb -
Start Redis — do this before the server. Django Channels uses it as the message broker for WebSockets, so multiplayer will not work without it:
docker run --rm -p 6379:6379 -d redis:5 -
Start the development server. It serves both the REST API and the WebSockets —
channelsreplacesrunserverwith an ASGI server, so no separate process is needed:python manage.py runserver -
Open your browser and visit
http://localhost:8000to access the QuantumCrypto backend API.
Note: Make sure to also run the frontend server locally for full functionality. You can find the frontend repository here.
Connecting the frontend: set these in the frontend's .env.local:
NEXT_PUBLIC_API_URL=http://localhost:8000
NEXT_PUBLIC_WEBSOCKET_URL=ws://localhost:8000/wsThe /ws suffix is required — WebSocket routes are registered under ws/ (see
bb84/routing.py), and nginx uses that same prefix in production to apply the WebSocket
upgrade headers. Without it the URL matches no route and multiplayer silently fails.
Please refer to install_on_linux_server.md document for instructions on how to install and run the QuantumCrypto backend on a remote server.
We welcome contributions from the community to help improve QuantumCrypto. If you'd like to contribute, please follow these guidelines:
-
Fork the repository and create a new branch for your feature or fix.
-
Make your changes and ensure that the code follows the project's coding standards.
-
Write tests for your changes to maintain code quality.
-
Submit a pull request with a clear description of your changes and their purpose.
-
Your pull request will be reviewed by the project maintainers, and any necessary feedback will be provided.
Thank you for contributing to QuantumCrypto! We appreciate your support in making quantum computing education accessible and engaging for all.