Setup
The LEQO-Backend is provided as a docker-image and can be run:
Standalone: for backend-only use
In combination with frontend: for full-stack development
You’ll need:
Docker + Docker Compose installed
Basic terminal access
To get started install Docker Compose and follow the instructions below.
Standalone
Use this for just hosting the backend without frontend (or separate from it). Run the following commands:
cp .env.template .env
docker compose -f compose-dev.yaml up --build
Tip
The commands above use the default configuration that can be changed as described in Configuration
With Frontend
You can host both the frontend and backend together with docker compose.
- Step 1: Create a project directory
mkdir leqo cd leqo
- Step 2: Create a compose.yml file with the following contents:
1name: LEQO 2services: 3 leqo-frontend: 4 image: ghcr.io/leqo-framework/low-code-modeler:main 5 ports: 6 - 127.0.0.1:80:4242 7 leqo-backend: 8 image: ghcr.io/leqo-framework/leqo-backend:main 9 env_file: ".env" 10 restart: unless-stopped 11 depends_on: 12 - postgres 13 ports: 14 - "8000:80" 15 postgres: 16 image: postgres:latest 17 shm_size: 128mb 18 environment: 19 POSTGRES_USER: ${POSTGRES_USER} 20 POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} 21 POSTGRES_DB: ${POSTGRES_DB} 22 restart: unless-stopped 23 volumes: 24 - db-data:/var/lib/postgresql/data 25volumes: 26 db-data:
Download this file:
compose.yml
If you don’t need configuration, you can use this file:
compose.simple.yml
and skip Step 3.
Step 3: Create the .env file according to the instructions in Configuration.
- Step 4: Start the application
docker compose up -d
- Step 5: Open the frontend
Navigate to: localhost:80
Step 6: Configure the backend port in the frontend
Go to Configuration
Set the Low-Code Backend Endpoint to: http://localhost:8000
Insert Implementations into the Database
The backend provides the /insert endpoint for inserting implementations into the database. A simple example of an insert request can be seen here:
1{
2 "inserts": [
3 {
4 "node": { "id": "some-id", "type": "operator", "operator": "+" },
5 "implementation": "OPENQASM 3.0;\ninclude \"stdgates.inc\";\n@leqo.input 0\nqubit[3] q31;\n@leqo.input 1\nqubit[3] q32;\nqubit[2] q33;ccx q31[1], q32[1], q32[2];\ncx q31[1], q32[1];\nccx q31[0], q32[0], q33[1];\ncx q31[0], q32[0];\nccx q33[0], q32[0], q33[1];\nccx q33[1], q32[1], q32[2];\ncx q33[1], q32[1];\nccx q33[0], q32[0], q33[1];\ncx q31[0], q32[0];\nccx q31[0], q32[0], q33[1];\ncx q33[0], q32[0];\ncx q31[0], q32[0];\n@leqo.output 0\nlet out = q32;",
6 "metadata": {
7 "width": 8,
8 "depth": 10
9 }
10 }
11 ]
12}
Download this file: addition_insert.yml
For sending this request, you have two options:
- Use Python: Run the following command in the project directory:
./scripts/request_helper.py ./scripts/addition_insert.json /insert
- Use curl: Run the following command next to the json file:
curl -X POST -H "Content-Type: application/json" --data @./addition_insert.json http://localhost:8000/insert
- Use Powershell: Run the following command next to the json file:
irm -Method Post -Headers @{ "Content-Type" = "application/json" } -Uri http://localhost:8000/insert -InFile ./addition_insert.json