OpenBinding is a QoS-aware service composition gateway and solver engine framework. It provides a unified interface to model and solve service composition problems using various underlying optimization engines.
flowchart TD
U[User / Frontend]:::client
U -->|HTTP POST /v1/solve| G[OpenBinding Gateway]:::gateway
G --> V0[Validate request envelope]:::step
V0 --> V1[Validate basic composition schema]:::schema
V1 --> R{Root router: route by engine_id}:::router
R -->|minizinc-csp| SZ_MZ[Validate specialization schema: MiniZinc]:::schema
R -->|random-search| SZ_RS[Validate specialization schema: Random Search]:::schema
R -->|many-heuristic| SZ_MH[Validate specialization schema: Many-Heuristic]:::schema
SZ_MZ --> MZ[MiniZinc CSP engine]:::engine
SZ_RS --> RS[Random Search engine]:::engine
SZ_MH --> MH[Many-Heuristic engine]:::engine
MZ -->|solve| SOL[(Solution)]:::solution
RS -->|solve| SOL
MH -->|solve| SOL
SOL --> G
G -->|HTTP 200 result| U
-
OpenBinding Gateway (
openbinding-gateway):- Python FastAPI service acting as the central entry point.
- Handles schema validation (General & Specialization).
- Routes requests to appropriate engines.
- Provides analysis and diagnostics tools.
-
MiniZinc CSP Engine (
engines/minizinc-csp):- TypeScript/Node.js service.
- Transforms problems into MiniZinc models.
- Solves using the Gecode constraint solver.
- Best for exact solutions to smaller/medium problems.
-
Random Search Engine (
engines/random-search):- Java service.
- Uses random search.
- Best for exploring large solution spaces.
-
Many-Heuristic Engine (
engines/many-heuristic):- Java service (extends Random Search).
- Specialized for Many-Objective problems (3+ objectives).
- Returns a Pareto front of non-dominated solutions.
-
Frontend (
frontend):- React + Vite web UI for modeling and submitting problems.
- Multi-page SPA with professional design inspired by modern developer tools.
- Features:
- Home: Landing page showcasing OpenBinding features and engines
- Playground: Interactive workspace with JSON editor, engine selector, and result visualization
- Engines Explorer: Browse and compare solver engines with capabilities
- Schema Explorer: Interactive JSON schema viewer with search and navigation
- Light/Dark Theme: System-aware theme with persistence
OpenBinding validates incoming requests against two schema layers:
-
General schema (engine-agnostic):
- JSON Schema (structural validation):
schemas/general/schema.json - Visual model (Mermaid):
schemas/general/schema.mermaid - Specification / semantics (human-readable):
schemas/general/schema.specification.md
The specification document explains the intent and semantics behind the JSON Schema, including:
- The instance model (tasks, candidates, providers, features)
- Workflow modeling (
compositionas structured tree or DAG) - QoS aggregation and normalization (
aggregation_policies) - Constraints and objectives, plus invariants that require a second validation pass
- JSON Schema (structural validation):
-
Specialization schemas (engine-specific constraints):
schemas/specializations/minizinc-csp.schema.jsonschemas/specializations/random-search.schema.jsonschemas/specializations/many-heuristic.schema.json
Specializations can also include a visual model in Mermaid format (recommended):
schemas/specializations/minizinc-csp.schema.mermaidschemas/specializations/random-search.schema.mermaidschemas/specializations/many-heuristic.schema.mermaid
Mermaid models are used by the frontend Schema Explorer in the Model tab. If a specialization does not provide
.schema.mermaid, the JSON schema workflow remains fully functional.
Example payloads that follow these schemas live in examples/.
- Docker and Docker Compose
- (Optional) Python 3.11+ for local development
-
Configure environment variables:
cp .env.example .env
-
Start development stack:
COMPOSE_PROFILES=dev docker compose up --build
Development services:
- Nginx (local): http://localhost:80
- Frontend dev server: http://localhost:5173
- Gateway API docs: http://localhost:8000/docs
-
Start production stack:
COMPOSE_PROFILES=prod docker compose up --build -d
Production notes:
- Nginx listens on ports 80/443.
frontend-prodgenerates static assets; only Nginx serves them publicly.- Place TLS files in
nginx/ssl/(or overrideNGINX_SSL_DIR) with names:fullchain.pemprivkey.pem
- Gateway is exposed only internally behind Nginx.
- Take into account that the production environment is currently configured for
openbinding.score.us.esandopenbinding.us.esdomains (the domains where we are hosting the service in production). You may need to manually adjust nginx and docker compose configurations for your own domain or local testing.
-
Stop the Stack:
docker compose down
If you have the necessary runtimes installed (Python 3.11+, Node.js 20.19+, Java 17+, and Maven), you can run the components locally for faster development:
-
Gateway (Python):
cd openbinding-gateway # Install dependencies with 'test' extras uv pip install -e ".[test]" # Run the gateway uvicorn openbinding_gateway.main:app --host 0.0.0.0 --port 8000
-
Frontend (React + Vite):
cd frontend # Install dependencies (requires Node.js 20.19+ or 22.12+) pnpm install # Set API URL (optional, defaults to http://localhost:8000) echo "VITE_API_BASE_URL=http://localhost:8000" > .env # Run development server pnpm run dev -- --host 0.0.0.0 --port 80
The frontend will be available at http://localhost:5173
-
MiniZinc CSP Engine (Node.js + MiniZinc):
- Requirements: MiniZinc installed and in system PATH.
cd engines/minizinc-csp npm install npm run dev -
Random Search Engine (Java + Maven):
cd engines/random-search # Build and run mvn compile exec:java -Dexec.mainClass="es.us.isa.qosawarewsbinding.Controller"
OpenBinding implements a rigorous multi-stage validation process:
- General Schema: Ensures the input adheres to the simplified QoS specification structure.
- Specialization Schema: Enforces engine-specific constraints (e.g., supported composition types, constraints).
- Semantic/Logic: Checks for consistency (e.g., undefined tasks, valid IDs).
- Analysis: Computes binding space cardinality and generates warnings for potential issues.
The gateway now returns structured validation errors and warnings:
/v1/analyze: Returns detailed warnings withcode,message, anddetails(includingpath,constraint_id,stage)/v1/solve: Returns HTTP 422 on validation failure with structured violations in the same format
To run the complete test suite in the Docker environment:
# 1. Ensure stack is running
COMPOSE_PROFILES=dev docker compose up -d
# 2. Run all tests
docker compose exec gateway-dev test
# 3. Run specific test file
docker compose exec gateway-dev test tests/test_analysis.py -vIf running locally without Docker:
cd openbinding-gateway
pytest
# Or run with verbose output
pytest -v
# Or run specific tests
pytest tests/test_validation_comprehensive.py -vTest Coverage: 60 tests covering validation, analysis, routing, and integration with engines.
Submit a problem to the MiniZinc engine:
curl -X POST "http://localhost:8000/v1/solve" \
-H "Content-Type: application/json" \
-d '{
"engine_id": "minizinc-csp",
"verbose": true,
"instance": { ... JSON content ... }
}'See examples/ directory for sample payloads.
If you are adding a new engine, see docs/ENGINE_INTEGRATION_GUIDE.md.
See docs/CONTRIBUTING.md for branch and PR rules.
This project is licensed under the Creative Commons Attribution 4.0 International (CC BY 4.0). See the LICENSE file for details.