Skip to content

Installation

Add NMRLink to an npm project or use it directly from static HTML without a build step.

On this page

Requirements

  • Actual measurements require a compatible educational NMR apparatus and a PC connected to it by USB.
  • For direct hardware access, use the latest desktop Chrome or Edge, or Firefox 151 or later. Safari cannot connect directly.
  • Open your page over HTTPS or localhost on the PC connected to the device. Do not open the HTML file through a file: URL.

You can try simulated graphs and analyze saved data without hardware. See supported browsers and tested configurations for details.

Choose an installation method

If you only want to measure with an existing interface, open the standard Web UI.

Install with npm

Run this in your own project:

sh
npm install nmrlink

Import the features you need in your JavaScript:

js
import { NMRController, analyzeMeasurement } from "nmrlink";
import { NMRGraphs } from "nmrlink/graphs";
import { saveMeasurement } from "nmrlink/browser";

The package uses ES modules and has no runtime dependencies. TypeScript declarations are not included.

Build your first Web UI →

Use static HTML

No npm installation or build step is required.

  1. Download a ZIP from the Code menu on GitHub and extract it.
  2. Copy the entire packages/nmrlink/src folder into your working directory and rename it nmrlink.
  3. Create example.html in the same working directory.
text
my-nmr-ui/
├── example.html
└── nmrlink/       ← all files from packages/nmrlink/src

Set type="module" in your HTML and use relative URLs:

html
<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>NMRLink</title>
</head>
<body>
  <script type="module">
    import { NMRController, analyzeMeasurement } from "./nmrlink/index.js";
    import { NMRGraphs } from "./nmrlink/graphs.js";
    import { saveMeasurement } from "./nmrlink/browser.js";

    // Add your interface and measurement code here.
  </script>
</body>
</html>

Serve the working directory with VS Code Live Server or another web server, then open it in your browser. Use localhost for local hardware access.

Adjust the imports if you change the file layout. This also applies when moving example code into your own directory.

View the minimal direct-connection example (Japanese) →

Connection troubleshooting

For Node.js, see Use from Node.js. For AI-assisted implementation, see Build with AI.