JS9JS9 Docs GitHub

Deployment Modes: Client-side vs. Server Helper

JS9 can run in two different modes, and you choose which one by a single preference setting. Both modes display and analyze FITS images; they differ only in where the heavier, optional work happens.

The short version

  • Client-side (static) — everything runs in the browser. Deploy the files to any static host (GitHub Pages, S3, a plain web server, even a file:// path with a local server). No back end. This is the default.
  • Server helper — a small Node.js program (js9Helper.js) runs alongside the static files and adds server-side capabilities.

How the analysis actually works

JS9's FITS engine is astroem — CFITSIO, WCS and related libraries compiled to WebAssembly. It runs inside the browser. That means the core of JS9, including a large amount of analysis, needs no server at all:

  • load and display FITS (images, tables, cubes, multi-extension files)
  • colormaps, scaling, zoom/pan, RGB, blending
  • WCS: pixel ↔ world coordinates, changing WCS system/units
  • regions, including the boolean selection parser and grouping
  • region statistics, counts in regions, radial profiles, histograms, encircled energy, pixel tables, projections (the imexam plugins)
  • image arithmetic, gaussian blur, filtering, binning, reprojection, rotation

What the helper adds (and how to live without it)

CapabilityHelperStatic alternative
Server-side analysis tasks (run external programs, e.g. funtools) yes write client-side "local" tasks in JavaScript
Proxy load of remote FITS from a non-CORS server yes host the FITS yourself, or use a CORS-enabled archive (direct URL loads work)
Saving files / per-user work directories on the server yes browser downloads

Choosing a mode

The mode is set by globalOpts.helperType in js9prefs.js (loaded by your web page):

  // client-side / static (default): no back end
  "helperType": "none",
  "loadProxy":  false,

  // server helper: adds server-side analysis + proxy
  "helperType": "nodejs",
  "loadProxy":  true,

See Preferences for the full list of options and Server-side Analysis and The JS9 Helper for the helper details.

Running each mode

  • Static: build the site and serve the output directory — npm run serve for local preview, or publish the built _site/ directory to any static host.
  • Helper: set helperType: "nodejs", then start the Node helper (node server/js9Helper.js) so the page can connect to it on its configured port.

If you deploy the static files but leave helperType: "nodejs", the page will try (and fail) to reach a helper that isn't there — harmless, but it logs a connection error. Set helperType: "none" for a pure static site.