Skip to content

Latest commit

 

History

176 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JOpt.TourOptimizer — Angular Demo Application

DNA Evolutions

A map-based Angular demo application for DNA Evolutions' JOpt.TourOptimizer — a reactive Spring WebFlux route optimization service. Configure nodes and resources on a Leaflet map, run optimizations against the TourOptimizer REST API, and watch results appear in real time via Server-Sent Events.

Open in StackBlitz


Overview


What this application does

Angular Demo Application Preview

The demo walks through a complete JOpt optimization cycle:

  1. Load precoded example data or place nodes and resources freely on the map.
  2. Configure optimization options (time windows, capacities, constraints).
  3. Submit the optimization via POST /api/v1/runs and receive a runId.
  4. Stream live progress updates via SSE (GET /api/v1/runs/{runId}/stream/progress).
  5. Retrieve and display the result — routes are drawn as polylines on the map with full solution details.

A video walkthrough is available on YouTube:

Tutorial — How to use the Demo Application


Versions

Dependency Version
Angular 21.2.7
Angular Material / CDK 21.2.5
TypeScript 5.9.3
RxJS 7.8.2
Leaflet 1.9.4
Bootstrap 5.3.8
ngx-charts 20.5.0
zone.js 0.16.1
Node (Docker build) 22.12-alpine
nginx (Docker runtime) 1.27.4-alpine

App version: 3.0.0-alpine
Compatible with TourOptimizer spec: 1.3.5-SNAPSHOT or higher

Changelog

April 2026: Updated to Angular 21.2. Compatible with TourOptimizer 1.3.5+.

February 2026: Updated to Angular 21.1. Multiple dependency upgrades.

January 2025: Updated to Angular 19.1. Compatible with TourOptimizer 1.3.0+.

July 2024: Updated to Angular 18. Compatible with TourOptimizer 1.2.7+.

January 2024: Updated to Angular 17. Compatible with TourOptimizer 1.2.6+. Added free-moving example — nodes and resources can be repositioned via drag and drop.


Run with Docker (recommended)

Docker is the fastest way to get started — no Node.js or Angular CLI installation required.

Prerequisites

  • Docker installed and available in your terminal.
  • A running JOpt.TourOptimizer instance. Start one with:
docker run -d --rm --name jopt-touroptimizer \
  -p 8081:8081 \
  -e SPRING_PROFILES_ACTIVE=cors \
  dnaevolutions/jopt_touroptimizer:latest

The cors profile is required so the browser can reach the optimizer from the demo app.

Start the demo application

docker run -d --rm \
  --name jopt-demo \
  -p 3000:80 \
  -e JOPT_SWAGGER_HOST="http://localhost" \
  -e JOPT_SWAGGER_PORT="8081" \
  dnaevolutions/jopt_demoapplication

Then open http://localhost:3000.

Environment variables

Variable Default Description
JOPT_SWAGGER_HOST http://localhost Base URL of the TourOptimizer instance.
JOPT_SWAGGER_PORT 8081 Port of the TourOptimizer instance.
INPRODUCTION false When true, the app uses the public DNA Evolutions endpoint. Avoid in production — the public endpoint limits requests and enforces a 20-element cap regardless of your license.

Run both containers on the same Docker network

If TourOptimizer is also running in Docker, use a shared network instead of relying on localhost:

docker network create jopt-network

docker run -d --rm --name jopt-touroptimizer \
  --network jopt-network \
  -e SPRING_PROFILES_ACTIVE=cors \
  dnaevolutions/jopt_touroptimizer:latest

docker run -d --rm \
  --name jopt-demo \
  --network jopt-network \
  -p 3000:80 \
  -e JOPT_SWAGGER_HOST="http://jopt-touroptimizer" \
  -e JOPT_SWAGGER_PORT="8081" \
  dnaevolutions/jopt_demoapplication

Run without Docker

Prerequisites

  1. Node.js / npm installed.
  2. Angular CLI installed: npm install -g @angular/cli
  3. A running TourOptimizer instance (see prerequisites above).

Serve locally

npm install
ng serve

Open http://localhost:5000. The default port is 5000 and can be changed in angular.json.

The TourOptimizer endpoint is configured in src/environments/environment.ts (development) and src/environments/environment.prod.ts (production) under the host and port keys.


Build a custom image

Modify the source code in your IDE, then build and run your own Docker image:

# Build (requires at least 4 GB of RAM for the Node.js build stage)
docker build -t jopt-demo-custom .

# Run
docker run -d --rm \
  --name jopt-demo-custom \
  -p 3000:80 \
  -e JOPT_SWAGGER_HOST="http://localhost" \
  -e JOPT_SWAGGER_PORT="8081" \
  jopt-demo-custom

Open http://localhost:3000.


Regenerate TypeScript models

The TypeScript API client in build/openapi/ is generated from the TourOptimizer OpenAPI spec using the OpenAPI Generator CLI.

Get the spec file

Download the cleaned spec from your running TourOptimizer:

curl http://localhost:8081/v3/api-docs -o ../openapi/touroptimizer_spec.json

Or use the pre-cleaned version from GitHub: Java-REST-Client-Examples — touroptimizer_spec_cleaned.json

Save it as touroptimizer_spec.json in a folder called openapi next to (not inside) the project directory:

parent-directory/
├── openapi/
│   └── touroptimizer_spec.json
└── Angular-Demo-Application-Source/   ← project root
    └── package.json

Run the generator

npm run generate:api

This runs:

openapi-generator-cli generate \
  -g typescript-angular \
  -i ../openapi/touroptimizer_spec.json \
  -o ./build/openapi

The generator can also be run as a Docker container or Maven dependency — see the OpenAPI Generator documentation.


Project structure

touroptimizer-angular-demo/
├── src/
│   ├── app/
│   │   ├── _services/
│   │   │   ├── optimization-wrapper/     # Core optimization orchestration
│   │   │   ├── optimization-event/       # SSE progress and warning streams
│   │   │   ├── load-example-data/        # Precoded example inputs
│   │   │   ├── geo-and-routing/          # Geolocation and routing logic
│   │   │   └── leaflet-map/              # Map marker, polyline, popup services
│   │   ├── component/
│   │   │   ├── consent/                  # Cookie consent page
│   │   │   ├── introduction/             # Intro panel, how-to and video dialogs
│   │   │   ├── example/                  # Main example view
│   │   │   ├── leaflet-map/              # Leaflet map component
│   │   │   ├── optimization-run/         # Prepare, run and progress dialogs
│   │   │   ├── optimization-events/      # Live progress component (SSE)
│   │   │   ├── optimization-elements/    # Node, resource and result dialogs
│   │   │   ├── optimization-elements-selector/
│   │   │   └── custom-date-time-picker/
│   │   └── pipe/
│   │       ├── date/                     # DateFormatPipe
│   │       ├── duration/                 # DurationFormatPipe
│   │       └── distance/                 # DistanceFormatPipe
│   ├── assets/
│   │   ├── env.js / env.template.js      # Runtime environment config (envsubst)
│   │   └── precoded-data/                # Example optimization inputs
│   └── environments/
│       ├── environment.ts                # Dev: localhost:8081
│       └── environment.prod.ts           # Prod: Azure endpoint
├── build/
│   └── openapi/                          # Auto-generated TypeScript API client
│       ├── api/
│       │   ├── optimization.service.ts   # Optimization API calls
│       │   └── stream.service.ts         # SSE streaming API
│       └── model/                        # ~150 TypeScript model interfaces
├── Dockerfile                            # Multi-stage: node build → nginx serve
├── angular.json                          # Angular CLI config (dev port: 5000)
└── package.json

Further links

Documentation

Code and registry

Evaluation license

Get an extended free license designed for small businesses and customers evaluating the product:
DNA Evolutions Portal (sign-in required)

Social


Contact

For help or questions reach us at www.dna-evolutions.com/contact or info@dna-evolutions.com.


Agreement

For license terms and plans please visit www.dna-evolutions.com.


A product by DNA Evolutions GmbH ©

Releases

Packages

Used by

Contributors

Languages