NeccessoryNeccessory
Web SDK

Installation

Add the Neccessory Web SDK to your web app with npm or a script tag.

The Web SDK runs camera measurements in the browser, in cloud mode or on-device mode, from one package.

npm

The package @neccessory/web-sdk is available on request. Write to support@neccessory.com to get access, then install it:

npm install @neccessory/web-sdk
import { createMeasurement } from '@neccessory/web-sdk';

TypeScript types are included.

For React, import the hook from the second entry point. React 18 or later is required — see React.

import { useNeccessoryMeasurement } from '@neccessory/web-sdk/react';

Script tag

Without a bundler, load the SDK from neccessory.com. It defines the global neccessory with the same exports as the npm package:

<script src="https://neccessory.com/neccessory-sdk/neccessory-sdk.js"></script>
<script>
  const { createMeasurement } = window.neccessory;
</script>

The React hook is available only in the npm package. If your page sets a Content Security Policy, add https://neccessory.com to script-src.

Requirements

  • Secure context. Serve the page over HTTPS. During development, localhost works too — see Browser support for the local setup.
  • Browser. A recent version of Chrome, Edge, Firefox or Safari, including iOS Safari and Chrome on Android — see Browser support.
  • Network and CSP. The page loads SDK files from neccessory.com and cdn.jsdelivr.net. Allow both hosts in your firewall and Content Security Policy — see Requirements.
  • Server helpers. signAndSubmit() and signAndFetchMeasurement() run in Node.js 20 or later.