This example uses OpenLayers v10.9.0. The latest is v.
Edit

#### JSTS Integration

vector 86 jsts 1 buffer 1

#####

Example on how to use JSTS with OpenLayers.

Example showing the integration of JSTS with OpenLayers.

##### main.js

    import OL3Parser from 'jsts/org/locationtech/jts/io/OL3Parser.js';
    import BufferOp from 'jsts/org/locationtech/jts/operation/buffer/BufferOp.js';
    import Map from 'ol/Map.js';
    import View from 'ol/View.js';
    import GeoJSON from 'ol/format/GeoJSON.js';
    import LineString from 'ol/geom/LineString.js';
    import LinearRing from 'ol/geom/LinearRing.js';
    import MultiLineString from 'ol/geom/MultiLineString.js';
    import MultiPoint from 'ol/geom/MultiPoint.js';
    import MultiPolygon from 'ol/geom/MultiPolygon.js';
    import Point from 'ol/geom/Point.js';
    import Polygon from 'ol/geom/Polygon.js';
    import TileLayer from 'ol/layer/Tile.js';
    import VectorLayer from 'ol/layer/Vector.js';
    import {fromLonLat} from 'ol/proj.js';
    import OSM from 'ol/source/OSM.js';
    import VectorSource from 'ol/source/Vector.js';

    const source = new VectorSource();
    fetch('data/geojson/roads-seoul.geojson')
      .then(function (response) {
        return response.json();
      })
      .then(function (json) {
        const format = new GeoJSON();
        const features = format.readFeatures(json, {
          featureProjection: 'EPSG:3857',
        });

        const parser = new OL3Parser(undefined, undefined);
        parser.inject(
          Point,
          LineString,
          LinearRing,
          Polygon,
          MultiPoint,
          MultiLineString,
          MultiPolygon,
        );

        for (let i = 0; i < features.length; i++) {
          const feature = features[i];
          // convert the OpenLayers geometry to a JSTS geometry
          const jstsGeom = parser.read(feature.getGeometry());

          // create a buffer of 40 meters around each line
          const buffered = BufferOp.bufferOp(jstsGeom, 40);

          // convert back from JSTS and replace the geometry on the feature
          feature.setGeometry(parser.write(buffered));
        }

        source.addFeatures(features);
      });
    const vectorLayer = new VectorLayer({
      source: source,
    });

    const rasterLayer = new TileLayer({
      source: new OSM(),
    });

    const map = new Map({
      layers: [rasterLayer, vectorLayer],
      target: document.getElementById('map'),
      view: new View({
        center: fromLonLat([126.979293, 37.528787]),
        zoom: 15,
      }),
    });

##### index.html

    <!DOCTYPE html>
    <html lang="en">
      <head>
        <meta charset="UTF-8">
        <title>JSTS Integration</title>
        <link rel="stylesheet" href="node_modules/ol/ol.css">
        <style>
          .map {
            width: 100%;
            height: 400px;
          }
        </style>
      </head>
      <body>
        <div id="map" class="map"></div>

        <script type="module" src="main.js"></script>
      </body>
    </html>

##### package.json

    {
      "name": "jsts",
      "dependencies": {
        "ol": "10.9.0",
        "jsts": "^2.11.3"
      },
      "devDependencies": {
        "vite": "^3.2.3"
      },
      "scripts": {
        "start": "vite",
        "build": "vite build"
      }
    }