0c113e7a91
Camera profiles, proofing tables and the half-float sidecar all have to agree with the pixels the editor actually grades, so they land together with the preset filter menu that was unusable while thumbnails streamed in. 🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
1141 lines
64 KiB
Markdown
1141 lines
64 KiB
Markdown
# Luminary
|
||
|
||
A browser-based photo catalog and non-destructive editor built for a small team:
|
||
event organisation, culling, ratings and flags, client proofing, and a RAW-capable
|
||
develop module with lens correction, local masks, HDR/panorama/focus merges and
|
||
print/export.
|
||
|
||
The app runs in two modes. With no server it is a private, offline catalog stored in
|
||
IndexedDB. With the included team server it gains accounts, a shared SQLite catalog,
|
||
RAW decoding, client galleries, storage quotas and email notifications.
|
||
|
||
| Mode | How to run | Catalog storage | RAW files | Accounts / galleries |
|
||
| --- | --- | --- | --- | --- |
|
||
| Browser only | `npm run dev` | IndexedDB on this device | No — raw needs the server | No |
|
||
| Team server | `npm run server` + `npm run dev` (or `npm start` behind a build) | SQLite + files under `server/data` | Yes — LibRaw demosaic | Yes |
|
||
|
||
Everything edits the same `Edits` JSON document, so a photo edited locally keeps its
|
||
look when it is later uploaded to a server workspace.
|
||
|
||
---
|
||
|
||
## Contents
|
||
|
||
- [Feature tour](#feature-tour)
|
||
- [Requirements](#requirements)
|
||
- [Quick start](#quick-start)
|
||
- [Configuration](#configuration)
|
||
- [Production deployment](#production-deployment)
|
||
- [Docker](#docker)
|
||
- [Architecture](#architecture)
|
||
- [Data model and storage](#data-model-and-storage)
|
||
- [HTTP API](#http-api)
|
||
- [Accounts, sessions and workspaces](#accounts-sessions-and-workspaces)
|
||
- [Quotas, warnings and scheduled pruning](#quotas-warnings-and-scheduled-pruning)
|
||
- [Email setup](#email-setup)
|
||
- [Media Team Hub bridge](#media-team-hub-bridge)
|
||
- [Raw pipeline](#raw-pipeline)
|
||
- [Detail-preserving denoise](#detail-preserving-denoise)
|
||
- [Lens profiles](#lens-profiles)
|
||
- [Development workflow](#development-workflow)
|
||
- [Troubleshooting](#troubleshooting)
|
||
- [Limitations](#limitations)
|
||
- [Third-party attribution and licences](#third-party-attribution-and-licences)
|
||
|
||
---
|
||
|
||
## Feature tour
|
||
|
||
**Library.** Events in a sidebar (create, rename, delete, drag to reorder; drop photos
|
||
onto an event to move them), drag to reorder photos inside a view, star ratings,
|
||
pick/reject flags, five colour labels, and filters over rating, unrated, flag, labels,
|
||
"edited only" and free text (name, camera, lens, keywords). Sort by capture date,
|
||
import date, name, rating or manual order. Multi-select with shift-ranges and bulk
|
||
actions; rubber-band selection by dragging on empty space. Right-click any photo for
|
||
rating, flags, labels, open, copy/paste settings, export and delete. Deleted photos go
|
||
to Trash with restore, permanent delete and empty-all. Select 2–4 photos and press
|
||
**C** for a full-screen compare survey; double-click a frame to develop it. Selected
|
||
photos can be grouped into a stack that collapses to one card with a count badge.
|
||
**⌘K / Ctrl+K** opens a command palette that searches the whole catalog without
|
||
changing the current filters.
|
||
|
||
**Develop.** A WebGL2 multi-pass pipeline (`src/gl/renderer.ts`), per photo,
|
||
non-destructive:
|
||
|
||
- white balance as a relative Temp/Tint offset or an absolute Kelvin value with a
|
||
5500 K daylight reference, exposure, contrast, and hue-preserving
|
||
highlights/shadows/whites/blacks
|
||
- per-channel highlight recovery, texture, clarity, per-pixel dehaze, vibrance,
|
||
saturation, black & white mix
|
||
- input levels (black point, white point, midtone gamma), RGB and per-channel tone
|
||
curves
|
||
- 8-band HSL colour mixer evaluated in OkLCh (hue and chroma changes keep their
|
||
perceived lightness), split toning / colour grading
|
||
- sharpening, luminance noise reduction
|
||
- vignette, grain
|
||
- crop with nine aspect ratios, straighten, 90° rotation, flips
|
||
- local adjustments (up to eight layers): brush, linear gradient and radial masks
|
||
with feather, invert, luminance/hue/saturation ranges, and per-layer exposure,
|
||
contrast, highlights, shadows, whites, blacks, temperature, tint, saturation,
|
||
vibrance, hue, texture, clarity, dehaze and sharpening. Masks follow crops, zoom,
|
||
healing and lens correction; Copy mask / Paste mask move one layer between photos
|
||
- full Lensfun profiles: distortion, transverse chromatic aberration and vignetting
|
||
from the official database, with manual lens search, "Match EXIF lens"
|
||
auto-detection, per-correction switches and automatic edge scaling. Read the focal
|
||
length and aperture from each photo, save a profile as the default for a camera +
|
||
EXIF lens pair, and matching imports apply it automatically
|
||
- manual perspective correction: vertical/horizontal keystone, fine rotation and
|
||
scale, applied while sampling the source
|
||
- spot healing brush (**Q**): click a blemish, drag to move it, Alt-drag the sample,
|
||
adjustable size and feather
|
||
- scroll-wheel zoom with a Fit / 100% readout, drag to pan, double-click to toggle;
|
||
right-click the canvas for zoom, crop, copy/paste and export
|
||
- histogram, built-in and saved presets, history with undo/redo, selective
|
||
copy/paste and batch sync, named snapshots, virtual copies, before/after (**\**)
|
||
- on-device auto subject, sky and background masks (no model download), an
|
||
ISO/camera-aware noise starting point, edge-aware lens-softness compensation, and soft
|
||
proofing through a loaded printer ICC profile (or a paper simulation when none is)
|
||
- HDR merge with alignment, horizontal panorama stitching and focus stacking; each
|
||
result is added to the catalog as a new editable photo
|
||
- browser print layouts (A4, Letter, 5×7) rendered through the develop pipeline
|
||
|
||
**Proofing galleries.** Turn an event into a public link (`/g/<token>`) from **Share**.
|
||
Clients need no account: they see that event's live photos, heart favourites, leave
|
||
per-photo comments, mark a photo approved or needing changes, and download proofs
|
||
individually or as one ZIP. Feedback shows up on the library grid and in the "Client
|
||
picks", "Approved" and "Changes" filters. Each link can carry a password, a closing
|
||
date, a download cap or downloads switched off, and a watermark that is rendered into
|
||
newly published proofs. Revoking a link drops its picks, feedback and access settings.
|
||
|
||
**Team accounts.** The first signup becomes the admin. Admins create single-use invite
|
||
links (`/join/<token>`) with an optional email lock and 1–30 day expiry, copy them from
|
||
the admin panel, see who joined, disable or delete accounts, and revoke pending links.
|
||
Accounts are workspaces: each user sees only their own events and photos, while admins
|
||
get an overview of every account, event and byte in the catalog.
|
||
|
||
**Storage quotas.** Every account has a quota (100 GiB by default). At 90% the user is
|
||
warned in the app and by email (at most one reminder per day). Admins can change a
|
||
quota, schedule a 24-hour cleanup of the oldest content, send a warning immediately, or
|
||
cancel a scheduled cleanup. Cleanups stop at a target percentage of the quota instead
|
||
of deleting the whole original plan.
|
||
|
||
**Tethering.** Watch a folder on the server for an event: the editor polls it, pulls
|
||
each new JPEG/TIFF/WebP/raw, imports it through the normal path (raw decode, metadata,
|
||
cloud mirroring) and only then removes the file from the folder. Point a capture app or
|
||
a transfer folder at `<data>/tether/<event>`; nothing is lost if the tab closes.
|
||
|
||
**Cull assist.** Run a focus and duplicate pass over the selection from the command
|
||
palette. Every frame is scored from its own thumbnail with a Laplacian variance, and
|
||
near-duplicates are grouped by 64-bit difference hash, so the sharpest frame of a
|
||
burst can be kept and the alternatives flagged in one action. Nothing is rated or
|
||
rejected without confirmation.
|
||
|
||
**Sidecars.** Export the selected photos' develop settings as Lightroom-style `.xmp`
|
||
sidecars (crs: attributes plus a private payload for the rest of the grade) and import
|
||
a sidecar back onto a photo. Importing keeps the crop, masks and lens profile for every
|
||
field the file does not mention.
|
||
|
||
**Catalog workflow.** Editable title, caption, creator, copyright and keyword chips
|
||
with a keyword library and reusable metadata presets. Save the current filters and sort
|
||
order as a smart collection. Virtual copies share the master file but keep independent
|
||
edits; named snapshots preserve alternative looks.
|
||
|
||
**Export and print.** JPEG, PNG, WebP or uncompressed 16-bit TIFF; quality; resize by
|
||
long edge or percent; filename template (`{name}`, `{date}`, `{time}`, `{index}`); saved
|
||
export recipes; output sharpening; watermark; XMP metadata embedded in JPEGs; sRGB,
|
||
Display P3 or Adobe RGB output with a matching generated ICC profile (JPEG/TIFF); batch
|
||
export as one ZIP or separate files. Full-resolution export runs through the same
|
||
renderer as the screen preview.
|
||
|
||
**Administration.** Users, roles, invites, catalog backup/restore, per-account quotas,
|
||
email settings and a storage relocation tool are all in one panel.
|
||
|
||
---
|
||
|
||
## Requirements
|
||
|
||
| Component | Requirement |
|
||
| --- | --- |
|
||
| Node.js | 24 LTS (what the Docker image uses). `node:sqlite` requires 22.5+, so older releases will not boot |
|
||
| CPU / RAM | 1–2 cores and 1 GB run the app; RAW import wants ~2.5 GB with the default 4 worker pool |
|
||
| Browser | WebGL2-capable Chromium, Firefox or Safari (the Develop module requires WebGL2) |
|
||
| Disk | Originals dominate. Budget several hundred MB per shoot and set quotas accordingly |
|
||
|
||
`sharp` and `libraw-wasm` ship prebuilt binaries for Linux, macOS and Windows; no
|
||
compiler or native toolchain is needed. `sharp` is optional at runtime: without it the
|
||
server encodes proxies as PNG and skips EXIF-aware resizing.
|
||
|
||
---
|
||
|
||
## Quick start
|
||
|
||
```bash
|
||
npm install
|
||
|
||
# Terminal 1 — the team server (creates server/data on first run)
|
||
LUMINARY_INVITE=our-team npm run server # http://localhost:8787
|
||
|
||
# Terminal 2 — the Vite dev server (proxies /api to 8787)
|
||
npm run dev # http://localhost:5173
|
||
```
|
||
|
||
Open <http://localhost:5173>. Until you sign in, the app is a local-only catalog. The
|
||
**Local only / Sign in** pill in the top bar opens the account panel; the first account
|
||
that registers becomes the admin, and later signups need an invite.
|
||
|
||
Browser-only mode is just `npm run dev` with no server running. The catalog then lives
|
||
in IndexedDB under the database name `lumenroom` (the pre-rebrand name is kept so an
|
||
existing catalog opens without a migration).
|
||
|
||
### Everyday scripts
|
||
|
||
| Script | What it does |
|
||
| --- | --- |
|
||
| `npm run dev` | Vite dev server on 5173, proxying `/api` to `127.0.0.1:8787` |
|
||
| `npm run server` | Node server on 8787 (creates and migrates the catalog) |
|
||
| `npm run server:dev` | Same, with `node --watch` restarting on change |
|
||
| `npm run build` | `tsc --noEmit` then `vite build` into `dist/` |
|
||
| `npm start` | One process serving `dist/` and the API (production) |
|
||
| `npm run preview` | Vite preview of the built bundle |
|
||
| `npm run typecheck` | TypeScript check only |
|
||
| `npm test` | Vitest unit suite |
|
||
|
||
The Vite proxy target is hard-coded to port 8787, so leave `PORT` at its default while
|
||
developing with `npm run dev`.
|
||
|
||
### First run
|
||
|
||
On boot the server creates `DATA_DIR` (default `server/data`) and its `originals/`,
|
||
`previews/`, `thumbs/`, `denoised/`, `proofs/` and `proofThumbs/` folders, then opens
|
||
(or creates) the SQLite catalog `lumenroom.db` and applies any schema migrations.
|
||
`GET /api/health` reports `needsSetup: true` while there are no accounts.
|
||
|
||
---
|
||
|
||
## Configuration
|
||
|
||
Settings are read from the environment, with an optional legacy `LUMENROOM_*` fallback
|
||
for deployments that predate the rename (see below). A few settings can also be changed
|
||
at runtime by an admin; the admin panel value wins over the environment for mail and
|
||
storage, while quotas are stored per account in the database.
|
||
|
||
| Variable | Default | Purpose |
|
||
| --- | --- | --- |
|
||
| `PORT` | `8787` | HTTP port (**not** prefixed with `LUMINARY_`) |
|
||
| `HOST` | `0.0.0.0` | Bind address (**not** prefixed) |
|
||
| `LUMINARY_DATA` | `server/data` | Where the database and image folders live |
|
||
| `LUMINARY_SECRET_KEY` | *(auto)* | Key for encrypting the saved SMTP password and bridge service tokens; when empty, a generated key is kept in `<data>/secret.key` — back it up with the database |
|
||
| `LUMINARY_TRUST_PROXY` | *(empty)* | Set to `1` only behind a proxy that overwrites `X-Forwarded-For`; makes login limits and `Secure` cookie detection use the real client address |
|
||
| `LUMINARY_INVITE` | *(empty)* | Shared registration code for teammates; personal invite links work without it |
|
||
| `LUMINARY_MAX_UPLOAD` | `314572800` (300 MB) | Largest accepted upload, in bytes |
|
||
| `LUMINARY_RAW_EDGE` | `6000` | Long edge of the editable JPEG proxy made from a raw |
|
||
| `LUMINARY_16BIT` | `1` | Also keep the decoded samples as a 16-bit PNG beside the raw proxy; `0` saves the disk and download it costs, at the price of grading an 8-bit source |
|
||
| `LUMINARY_RAW_WORKERS` | `min(4, cores−1)` | Concurrent LibRaw decoders; each holds a worker and a few hundred MB |
|
||
| `LUMINARY_RAW_IDLE_MS` | `90000` | Idle decoders are disposed after this to release memory |
|
||
| `LUMINARY_DENOISE_WORKERS` | `min(4, cores−1)` | Concurrent detail-denoise jobs (read directly from the environment) |
|
||
| `LUMINARY_QUOTA_BYTES` | `107374182400` (100 GiB) | Default per-account storage allowance |
|
||
| `LUMINARY_QUOTA_WARN_RATIO` | `0.9` | Fraction of the quota that triggers warnings, clamped to 0.5–0.99 |
|
||
| `LUMINARY_QUOTA_TARGET_RATIO` | `0.8` | Fraction a scheduled cleanup aims to leave behind, clamped to 0.5–0.95 |
|
||
| `LUMINARY_PUBLIC_URL` | *(empty)* | Public app URL used in notification emails; when empty, emails omit links |
|
||
| `LUMINARY_SMTP_HOST` | `smtp.gmail.com` | SMTP host for notifications |
|
||
| `LUMINARY_SMTP_PORT` | `465` | SMTP port |
|
||
| `LUMINARY_SMTP_SECURE` | `true` | Implicit TLS; set `false` for STARTTLS ports |
|
||
| `LUMINARY_SMTP_USER` | *(empty)* | Sending account (Gmail address by default) |
|
||
| `LUMINARY_SMTP_APP_PASSWORD` | *(empty)* | App password for that account, not the normal login password |
|
||
| `LUMINARY_SMTP_FROM` | `SMTP_USER` | Optional From address |
|
||
| `GLENLOCH_URL` | *(empty)* | Media Team Hub dashboard base URL; empty disables the bridge (**not** prefixed) |
|
||
| `BRIDGE_SECRET` | *(empty)* | Shared HMAC secret for bridge tokens (**not** prefixed) |
|
||
| `LUMINARY_BRIDGE_TTL_HOURS` | `12` | How long an imported bridge event survives without being reopened |
|
||
|
||
**Legacy names.** Any setting resolved through the internal `setting()` helper accepts
|
||
`LUMENROOM_<NAME>` as a fallback, e.g. `LUMENROOM_INVITE` or `LUMENROOM_QUOTA_BYTES`.
|
||
`PORT`, `HOST`, `GLENLOCH_URL`, `BRIDGE_SECRET` and `LUMINARY_DENOISE_WORKERS` are read
|
||
directly and have no legacy alias.
|
||
|
||
**Non-obvious defaults.**
|
||
|
||
- Sessions last 30 days and are stored server-side; passwords use `scrypt` with a
|
||
per-user salt and a 64-byte derived key.
|
||
- The session cookie is named `lumen_session` and is `HttpOnly; SameSite=Lax`. It is
|
||
marked `Secure` only when the request arrives with `X-Forwarded-Proto: https`.
|
||
- Responses carry `X-Content-Type-Options: nosniff` and a self-only CSP, and stored
|
||
photo MIME types are limited to raster images. A member cannot make a gallery link
|
||
serve HTML or SVG, even by uploading a file with that content.
|
||
- Sign-in is throttled per account and address (8 failures per account per 15 minutes;
|
||
50 per client address, or 500 when a proxy's address is shared). Set
|
||
`LUMINARY_TRUST_PROXY=1` behind a proxy so `X-Forwarded-For` identifies the caller.
|
||
Gallery writes are limited to 120 per minute per link.
|
||
- Uploads are streamed to disk and charged to the uploader's quota before their catalog
|
||
row exists, so an interrupted import cannot leave unbilled files behind.
|
||
- There is no TLS in the server. Terminate HTTPS at a reverse proxy.
|
||
- The SQLite file, the IndexedDB database and the Compose volume all keep the
|
||
`lumenroom` name so older deployments upgrade in place.
|
||
|
||
---
|
||
|
||
## Production deployment
|
||
|
||
```bash
|
||
npm ci
|
||
npm run build # type-checks and bundles dist/
|
||
npm start # serves dist/ and /api from one Node process
|
||
```
|
||
|
||
The server serves the built UI with an SPA fallback (unknown non-API paths return
|
||
`index.html`), caches `/assets/*` for a year as immutable, and returns `503` with a
|
||
build hint if `dist/index.html` is missing. JSON responses are `no-store`; image bytes
|
||
are private and cacheable for an hour by default.
|
||
|
||
### Reverse proxy
|
||
|
||
Forward the original scheme so session cookies are marked `Secure`:
|
||
|
||
```nginx
|
||
server {
|
||
listen 443 ssl;
|
||
server_name photos.example.org;
|
||
|
||
# Uploads default to a 300 MB ceiling; keep the proxy above it.
|
||
client_max_body_size 320m;
|
||
|
||
location / {
|
||
proxy_pass http://127.0.0.1:8787;
|
||
proxy_set_header Host $host;
|
||
proxy_set_header X-Forwarded-Proto $scheme;
|
||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||
# RAW import uploads can take a while on a small box.
|
||
proxy_read_timeout 300s;
|
||
}
|
||
}
|
||
```
|
||
|
||
### Run as a service
|
||
|
||
```ini
|
||
[Unit]
|
||
Description=Luminary photo catalog
|
||
After=network.target
|
||
|
||
[Service]
|
||
WorkingDirectory=/srv/luminary
|
||
Environment=NODE_ENV=production
|
||
Environment=LUMINARY_DATA=/srv/luminary-data
|
||
Environment=LUMINARY_PUBLIC_URL=https://photos.example.org
|
||
ExecStart=/usr/bin/node server/index.mjs
|
||
User=luminary
|
||
Restart=on-failure
|
||
RestartSec=3
|
||
|
||
[Install]
|
||
WantedBy=multi-user.target
|
||
```
|
||
|
||
### Backups
|
||
|
||
Two independent things to back up:
|
||
|
||
1. **The catalog plus originals** — copy the whole data directory (or the Docker
|
||
volume). Stop the server, or accept that SQLite is in WAL mode and copy
|
||
`lumenroom.db`, `lumenroom.db-wal` and `lumenroom.db-shm` together. Keep
|
||
`secret.key` with it (unless `LUMINARY_SECRET_KEY` is set): without it the saved
|
||
SMTP password and bridge tokens cannot be decrypted.
|
||
2. **A logical catalog export** — an admin can download a JSON backup (events, photo
|
||
records, presets and key/value settings) from the admin panel, or via
|
||
`GET /api/admin/catalog`, and restore it with `POST /api/admin/catalog`. This does
|
||
not include image bytes; keep a file-level backup for those.
|
||
|
||
---
|
||
|
||
## Docker
|
||
|
||
The image is a multi-stage build on `node:24-bookworm-slim`: dependencies, a Vite
|
||
build, production-only `node_modules`, then a runtime layer that runs as the
|
||
unprivileged `node` user. It installs the UI and the API in one container, verifies
|
||
`dist/index.html` and the bundled user guide exist, exposes 8787 and defines a
|
||
`HEALTHCHECK` against `/api/health`. Only `/data` needs to persist.
|
||
|
||
```bash
|
||
docker build -t luminary .
|
||
|
||
docker run -d --name luminary \
|
||
-p 8787:8787 \
|
||
-e LUMINARY_INVITE=our-team \
|
||
-e LUMINARY_PUBLIC_URL=https://photos.example.org \
|
||
-v lumenroom-data:/data \
|
||
luminary
|
||
```
|
||
|
||
The default data directory inside the image is `/data`; the volume is deliberately
|
||
named `lumenroom-data` so an existing catalog upgrades in place.
|
||
|
||
Compose wires up the volume, environment and restart policy:
|
||
|
||
```bash
|
||
LUMINARY_INVITE=our-team docker compose up -d --build
|
||
```
|
||
|
||
Compose reads `LUMINARY_PORT` for the published port and passes through the invite,
|
||
upload, RAW, quota, mail, public-URL and bridge settings. The container port is always
|
||
8787.
|
||
|
||
Back up the volume without stopping the service:
|
||
|
||
```bash
|
||
docker run --rm -v lumenroom-data:/data -v "$PWD":/backup alpine \
|
||
tar czf /backup/luminary-$(date +%F).tar.gz -C /data .
|
||
```
|
||
|
||
---
|
||
|
||
## Architecture
|
||
|
||
One Node process serves the SPA and the API. There is no framework and no native
|
||
database dependency: the HTTP layer is `node:http` with a small hand-rolled router, and
|
||
the catalog is `node:sqlite` in WAL mode.
|
||
|
||
```
|
||
Browser
|
||
React 18 + Vite, WebGL2 develop pipeline
|
||
IndexedDB cache (offline library and local-only mode)
|
||
│ fetch /api/* (same-origin cookie session)
|
||
▼
|
||
Node server (node:http, port 8787)
|
||
index.mjs routes, auth gate, uploads, static hosting, SPA fallback
|
||
db.mjs SQLite schema, migrations, prepared statements
|
||
auth.mjs scrypt hashes, sessions, cookie/Bearer resolution
|
||
storage.mjs image folders, safe ids, relocation with rollback
|
||
raw.mjs LibRaw demosaic, embedded-preview fallback
|
||
libraw-*.mjs Node <-> browser shim and decoder worker pool
|
||
imaging.mjs sharp encode/resize, dependency-free PNG fallback
|
||
denoise.mjs job queue and on-disk render cache
|
||
quota.mjs usage accounting, prune plans, warnings, worker
|
||
mail.mjs nodemailer transport, admin-editable settings
|
||
bridge.mjs dashboard token verification and metadata import
|
||
zip.mjs stored-ZIP writer for gallery downloads
|
||
▼
|
||
Data directory
|
||
lumenroom.db SQLite (WAL) — accounts, catalog, feedback, quotas
|
||
originals/ uploaded files, byte-for-byte, original extension kept
|
||
previews/ editable JPEG proxies (raw) and normalised previews
|
||
thumbs/ grid thumbnails (server-rendered proofs are 560 px)
|
||
denoised/ full-strength denoise renders keyed by pipeline version
|
||
proofs/ rendered proofs for client galleries
|
||
proofThumbs/ thumbnails of those proofs
|
||
```
|
||
|
||
### Request flow
|
||
|
||
1. `/api/*` is matched against an ordered route table (`method` + `/path/:param`).
|
||
Unmatched API paths return a JSON `404`; everything else is static hosting.
|
||
2. `currentUser()` resolves the `lumen_session` cookie first, then falls back to
|
||
`Authorization: Bearer <token>`. A disabled account or expired session is rejected.
|
||
3. Ownership is enforced per row: events and photos carry `owner_id`, and a request for
|
||
someone else's row returns `404` rather than `403` so ids do not leak. Admin routes
|
||
use a separate `requireAdmin()` gate.
|
||
4. Errors are JSON `{ "error": "…" }` with `400`, `401`, `403`, `404`, `409`, `422` or
|
||
`500`. Bodies are parsed with per-route limits (64 KB for auth and admin user
|
||
calls, 256 KB for events, 512 KB for presets, 8 MB for photo records and JSON, and
|
||
`LUMINARY_MAX_UPLOAD` for image bytes).
|
||
5. Every response gets `X-Frame-Options: SAMEORIGIN` and `Referrer-Policy: same-origin`;
|
||
image responses add `X-Content-Type-Options: nosniff`.
|
||
|
||
### Client structure
|
||
|
||
| Path | Responsibility |
|
||
| --- | --- |
|
||
| `src/App.tsx` | Catalog state, filtering, sorting, sync, drag-and-drop, shortcuts |
|
||
| `src/components/` | Library grid, develop view, panels, modals, admin, galleries |
|
||
| `src/gl/renderer.ts` | WebGL2 grade → blur → finish passes, crop/geometry sampling |
|
||
| `src/gl/masks.ts` | Local adjustment mask generation and masking signatures |
|
||
| `src/lib/api.ts` | Typed client for every endpoint |
|
||
| `src/lib/db.ts` | IndexedDB stores for photos, assets, events and key/value state |
|
||
| `src/lib/edits.ts` | Edit document model, defaults, section copy, local layers |
|
||
| `src/lib/import.ts` | File ingest, EXIF read, preview/thumb creation, upload scheduling |
|
||
| `src/lib/export.ts` | Renderer-driven export, recipes, watermark, filenames, ZIP |
|
||
| `src/lib/tiff.ts`, `icc.ts` | Dependency-free 16-bit TIFF writer and sRGB profile |
|
||
| `src/lib/preview16.ts` | 16-bit raw-proxy PNG parser, camera matrix and half-float conversion for the RGBA16F source texture |
|
||
| `src/lib/softProof.ts` | ICC parsing (lut8/lut16/mAB), printer A2B/B2A round trip and the 3D proof cube |
|
||
| `src/lib/dcp.ts` | DCP tag reader and the camera-to-sRGB matrix recipe |
|
||
| `src/lib/lensfun.ts`, `lensNames.ts`, `lensDefaults.ts` | Lensfun client, EXIF matching, saved defaults |
|
||
| `src/lib/merge.ts` | HDR / panorama / focus-stack composition |
|
||
| `src/lib/autoMask.ts`, `noiseProfile.ts` | On-device masks and ISO-aware noise starting points |
|
||
| `src/lib/xmp.ts` | Lightroom-compatible XMP sidecar reader/writer |
|
||
| `src/lib/cull.ts` | Focus scoring and duplicate hashing for cull assist |
|
||
| `src/lib/curves.ts`, `whiteBalance.ts`, `clipPreview.ts`, `presets.ts` | Curve sampling, WB maths, clipping display, presets |
|
||
| `docs/user-guide/` | Source of the in-app user guide (`guide.html`), also shipped as PDF |
|
||
|
||
The built guide is served from `/luminary-user-guide.pdf` and linked from the top bar.
|
||
|
||
---
|
||
|
||
## Data model and storage
|
||
|
||
SQLite is created and migrated at boot. All statements are prepared once in `db.mjs`.
|
||
|
||
| Table | Contents |
|
||
| --- | --- |
|
||
| `users` | id, email (unique), name, scrypt `pass_hash`, `role`, `disabled`, `created_at` |
|
||
| `sessions` | token (primary key), user, created/expiry; purged when a session is created |
|
||
| `events` | id, `owner_id`, sort index, creation time, JSON `data` (name, notes, share token) |
|
||
| `photos` | id, `owner_id`, `event_id`, sort index, `updated_at`, `raw` flag, JSON `data` |
|
||
| `kv` | small key/value settings: presets, storage root, mail settings |
|
||
| `gallery_picks` | per-token, per-photo, per-client favourites |
|
||
| `gallery_comments` | per-token client comments with author name and timestamp |
|
||
| `gallery_reviews` | per-token, per-photo, per-client approved / changes status |
|
||
| `invites` | token, optional email lock, role, expiry, acceptance and revocation |
|
||
| `bridge_events` | imported event id, dashboard session, AES-GCM-sealed service token, TTL |
|
||
| `user_quota` | limit, scheduled prune time/plan, last warning timestamps |
|
||
|
||
Photo and event records are JSON documents with a few extracted columns for ordering,
|
||
ownership and accounting. A photo's `size` drives quota maths and `deletedAt` marks
|
||
Trash. Migrations are additive and idempotent: `disabled`, `owner_id`, `share_token`,
|
||
`prune_plan` and `prune_notified_at` are added to older databases in place, and rows
|
||
that predate workspaces are assigned to the oldest account.
|
||
|
||
### Image files
|
||
|
||
| Folder | Naming | Notes |
|
||
| --- | --- | --- |
|
||
| `originals/` | `<photo id>.<original ext>` | Uploaded bytes, untouched; extension preserved |
|
||
| `previews/` | `<photo id>.jpg` or `.png` | Editable proxies; PNG when `sharp` is unavailable |
|
||
| `thumbs/` | `<photo id>.jpg` | Grid thumbnails; server-rendered proof thumbnails are 560 px |
|
||
| `denoised/` | `<photo id>.<key>.jpg` | Key encodes the pipeline version; old keys are pruned |
|
||
| `proofs/` | `<photo id>.jpg` | Rendered client-gallery proofs |
|
||
| `proofThumbs/` | `<photo id>.jpg` | Thumbnails of those proofs |
|
||
|
||
Asset ids are validated against `^[A-Za-z0-9_-]{1,80}$`; read paths treat an invalid id
|
||
as "no file" instead of throwing. Deleting a photo removes its original, preview,
|
||
thumbnail, proof, proof thumbnail and denoise renders.
|
||
|
||
### Relocating image storage
|
||
|
||
An admin can point image storage at another absolute folder; the SQLite database always
|
||
stays in `LUMINARY_DATA`. The server validates the target, proves it is writable with a
|
||
probe file, moves all six asset folders (rename, falling back to copy across
|
||
filesystems), records the new root in `kv`, and rolls every file back if the move fails
|
||
partway. `GET/PUT /api/admin/storage` expose the same operation.
|
||
|
||
---
|
||
|
||
## HTTP API
|
||
|
||
Conventions: JSON in and out, `{ "error": "…" }` on failure, cookie session or
|
||
`Authorization: Bearer <token>`. "Owner" means the caller must own the event or photo
|
||
(or be finishing an ownerless record created before workspaces existed). Gallery
|
||
routes are public and are gated only by the share token.
|
||
|
||
### Health and auth
|
||
|
||
| Method | Path | Auth | Purpose |
|
||
| --- | --- | --- | --- |
|
||
| GET | `/api/health` | public | Version, setup/registration state, photo count, bytes, storage root, RAW engine status and formats |
|
||
| POST | `/api/auth/register` | public | Create an account; first account becomes admin, later ones need an invite token or `LUMINARY_INVITE` |
|
||
| POST | `/api/auth/login` | public | Email + password, sets the session cookie |
|
||
| POST | `/api/auth/logout` | session | Destroys the session and clears the cookie |
|
||
| GET | `/api/auth/me` | session | Current user, or `401` |
|
||
| GET | `/api/invites/:token` | public | Invite status for the join page (email lock, role, expiry) |
|
||
|
||
### Catalog and assets
|
||
|
||
| Method | Path | Auth | Purpose |
|
||
| --- | --- | --- | --- |
|
||
| GET | `/api/sync` | session | Everything the workspace needs: user, events, photos, presets, proof summary |
|
||
| GET | `/api/proofs` | session | Client pick/comment/review summary for the owner's events |
|
||
| PUT | `/api/events/:id/share/settings` | owner | Password, expiry, watermark, download switch and cap for the proofing link |
|
||
| GET | `/api/galleries/:token/status` | public | Whether the link is locked, its expiry and whether downloads are allowed |
|
||
| POST | `/api/galleries/:token/unlock` | public | Exchange the gallery password for a link-scoped unlock cookie |
|
||
| GET | `/api/events/:id/tether` | owner | Watch-folder path and the frames waiting in it |
|
||
| GET | `/api/events/:id/tether/file?name=` | owner | Stream one waiting frame to the editor |
|
||
| DELETE | `/api/events/:id/tether/file?name=` | owner | Remove a frame after it imported |
|
||
| PUT | `/api/presets` | session | Replace the stored preset library |
|
||
| PUT | `/api/events/:id` | owner | Upsert an event record |
|
||
| DELETE | `/api/events/:id` | owner | Delete an event (photos are handled separately) |
|
||
| PUT | `/api/photos/:id` | owner | Upsert a photo record; accepts a data-URL thumbnail, which is written to `thumbs/` |
|
||
| DELETE | `/api/photos/:id` | owner | Delete a photo record and every asset file |
|
||
| POST | `/api/photos/:id/original?name=&mime=` | owner | Upload the original bytes; raw files are decoded to an editable proxy in the same call |
|
||
| GET | `/api/photos/:id/original` | owner | Stream the original (proxied from the dashboard for bridge photos) |
|
||
| GET | `/api/photos/:id/preview` | owner | Stream the editable proxy |
|
||
| GET | `/api/photos/:id/thumb` | owner | Stream the thumbnail (proof thumbnail first, if present) |
|
||
| POST | `/api/photos/:id/proof` | owner | Store a rendered JPEG proof and its thumbnail from base64 |
|
||
| POST | `/api/photos/:id/denoise` | owner | Queue a full-strength denoise render; returns a job id |
|
||
| GET | `/api/denoise/jobs/:id` | session | Job state: running/done/error, timing, stats, cache hit |
|
||
| GET | `/api/photos/:id/denoised?v=<key>` | owner | Stream the cached denoise render |
|
||
| DELETE | `/api/photos/:id/denoised` | owner | Drop all denoise renders for the photo |
|
||
| GET | `/api/quota` | session | The caller's quota state |
|
||
|
||
### Proofing galleries
|
||
|
||
| Method | Path | Auth | Purpose |
|
||
| --- | --- | --- | --- |
|
||
| GET | `/api/events/:id/share` | owner | Share token, picks and recent feedback |
|
||
| POST | `/api/events/:id/share` | owner | Create (or return) the public token |
|
||
| DELETE | `/api/events/:id/share` | owner | Revoke the link and clear its picks, comments and reviews |
|
||
| GET | `/api/galleries/:token` | public | Event header plus live photos, pick counts and per-client feedback |
|
||
| GET | `/api/galleries/:token/photos/:id/thumb` | public | Gallery thumbnail |
|
||
| GET | `/api/galleries/:token/photos/:id/preview` | public | Gallery preview |
|
||
| GET | `/api/galleries/:token/photos/:id/download` | public | Download one proof |
|
||
| GET | `/api/galleries/:token/download-all?client=` | public | ZIP of the event's proofs; at most 400 files / 512 MB, one archive at a time |
|
||
| POST | `/api/galleries/:token/picks` | public | Add or remove a client favourite |
|
||
| POST | `/api/galleries/:token/comments` | public | Append a client comment |
|
||
| POST | `/api/galleries/:token/reviews` | public | Set approved / changes / none |
|
||
|
||
### Administration
|
||
|
||
| Method | Path | Purpose |
|
||
| --- | --- | --- |
|
||
| GET | `/api/admin/overview` | Users, events with owner and totals, invites, catalog totals, storage, quotas, mail status |
|
||
| POST | `/api/admin/users` | Create an account directly (no invite needed) |
|
||
| PATCH | `/api/admin/users/:id` | Rename, change role, disable/enable, reset password |
|
||
| DELETE | `/api/admin/users/:id` | Delete an account (the last active admin is protected) |
|
||
| POST | `/api/admin/invites` | Create a single-use invite with optional email lock, role and 1–30 day expiry |
|
||
| DELETE | `/api/admin/invites/:token` | Revoke a pending invite |
|
||
| PUT | `/api/admin/events/:id` | Rename any account's event |
|
||
| DELETE | `/api/admin/events/:id` | Delete any account's event |
|
||
| GET | `/api/admin/catalog` | Logical catalog backup (events, photos, presets, kv) |
|
||
| POST | `/api/admin/catalog` | Restore a backup produced by the GET |
|
||
| GET | `/api/admin/storage` | Current and default storage roots, custom flag |
|
||
| PUT | `/api/admin/storage` | Move image storage to another absolute path |
|
||
| PATCH | `/api/admin/quotas/:id` | Set an account's byte limit |
|
||
| POST | `/api/admin/quotas/:id/prune` | Compute the oldest-first plan and schedule it 24 h out |
|
||
| DELETE | `/api/admin/quotas/:id/prune` | Cancel a scheduled cleanup |
|
||
| POST | `/api/admin/quotas/:id/warn` | Send the quota warning now |
|
||
| GET | `/api/admin/mail` | Mail status (never returns the password) |
|
||
| PUT | `/api/admin/mail` | Save SMTP sender settings |
|
||
| POST | `/api/admin/mail/test` | Send a test message |
|
||
|
||
### Bridge
|
||
|
||
| Method | Path | Auth | Purpose |
|
||
| --- | --- | --- | --- |
|
||
| GET | `/api/bridge/login?token=…` | signed token | Verify the dashboard token, link/create the account, import the event, redirect into the app |
|
||
| POST | `/api/bridge/export` | owner | Render and save an edited JPEG back to the dashboard event |
|
||
|
||
---
|
||
|
||
## Accounts, sessions and workspaces
|
||
|
||
- **Registration.** With zero accounts, `/api/auth/register` creates the first user as
|
||
admin and opens registration. After that, registration needs either a pending invite
|
||
token (`/join/<token>`, single-use, optionally email-locked and expiring in 1–30 days)
|
||
or the shared `LUMINARY_INVITE` code. `GET /api/health` advertises
|
||
`registrationOpen` so the UI can hide the form.
|
||
- **Passwords and sessions.** Passwords are hashed with `scrypt` and a 16-byte salt, and
|
||
compared in constant time. Sessions are random 32-byte tokens stored server-side with a
|
||
fixed 30-day lifetime; logout deletes the row. Deleting or disabling a user invalidates
|
||
their sessions.
|
||
- **Workspaces.** `events.owner_id` and `photos.owner_id` scope every read and write.
|
||
`/api/sync` returns only the caller's rows, and the browser tags its IndexedDB records
|
||
with `workspace: <user id>`, so signing into a different account does not leak cached
|
||
photos into that account's library. When a signed-in account has no remote data, the
|
||
library built on that device while signed out can be claimed by it once.
|
||
- **Admins** see every account and event through `/api/admin/overview`, can rename or
|
||
delete any event, reset passwords, disable accounts and restore a catalog backup. The
|
||
last active admin cannot be removed or demoted.
|
||
- **Local-only mode.** No session and no server means no API calls: the catalog, assets
|
||
and edits live entirely in IndexedDB. Photos added locally can be claimed by a
|
||
workspace later; nothing is uploaded until then.
|
||
|
||
---
|
||
|
||
## Quotas, warnings and scheduled pruning
|
||
|
||
Usage is the sum of every photo record the account owns, **including Trash** — bytes are
|
||
only released when Trash is emptied or a photo is deleted permanently. The limit comes
|
||
from `user_quota.bytes_limit`, falling back to `LUMINARY_QUOTA_BYTES`.
|
||
|
||
- At `LUMINARY_QUOTA_WARN_RATIO` (default 90%) `quotaState().warn` turns true, the app
|
||
shows the warning, and at most one warning email goes out per 24 hours.
|
||
- An admin can schedule a cleanup. The server computes a plan from the oldest events
|
||
first, then loose photos oldest-first, until projected usage reaches
|
||
`limit × LUMINARY_QUOTA_TARGET_RATIO`. The plan is stored on the quota row, so photos
|
||
uploaded after the warning are never caught by it.
|
||
- The user immediately receives an email listing exactly which events and photos will
|
||
be removed, then the server waits 24 hours. Deleting photos or emptying Trash in that
|
||
window cancels or shrinks the job.
|
||
- At execution the server re-checks usage. If the account is already under target, the
|
||
cleanup is cancelled, the plan is cleared, and the owner gets a "cleanup cancelled"
|
||
email; nothing is deleted. Otherwise it removes photos one by one, stopping as soon as
|
||
usage is back under the target, then reports what was freed.
|
||
- Admins can cancel a scheduled cleanup at any time and can send a warning on demand.
|
||
|
||
Notification emails include an "open Luminary" link only when `LUMINARY_PUBLIC_URL` is
|
||
set; otherwise the link is omitted rather than pointing at `localhost`.
|
||
|
||
---
|
||
|
||
## Email setup
|
||
|
||
Notifications use SMTP through `nodemailer`. The defaults target Gmail with an app
|
||
password (Google requires 2-Step Verification before app passwords can be created):
|
||
|
||
```bash
|
||
LUMINARY_SMTP_USER=studio@gmail.com
|
||
LUMINARY_SMTP_APP_PASSWORD=xxxxxxxxxxxxxxxx
|
||
LUMINARY_PUBLIC_URL=https://photos.example.org
|
||
npm start
|
||
```
|
||
|
||
An admin can also save the same settings in **Administration → Quotas**, plus a custom
|
||
host, port and TLS mode for non-Gmail providers; the saved values take precedence over
|
||
the environment, and **Send test email** verifies the transport. The API never returns
|
||
the stored password — only `hasPassword`. If email is not configured, quota warnings,
|
||
prune notices and cancellations are skipped or fail softly; the catalog keeps working.
|
||
|
||
---
|
||
|
||
## Media Team Hub bridge
|
||
|
||
A separate dashboard can hand an event to Luminary without sharing passwords or copying
|
||
the library:
|
||
|
||
1. The dashboard signs a short-lived token for a session, event and user, then sends the
|
||
browser to `/api/bridge/login?token=…`.
|
||
2. Luminary verifies the HMAC (`g1.<body>.<signature>`, SHA-256, timing-safe), checks the
|
||
expiry, exchanges the login token for a server-side service token, and creates or
|
||
reuses a local account by email.
|
||
3. The event's photo list is mirrored into the catalog as metadata only, with ids prefixed
|
||
`br-`. Previews and thumbnails are fetched from the dashboard on demand and cached;
|
||
originals stay in the dashboard's media storage. Raws are edited on a 4000 px JPEG
|
||
proxy produced upstream, JPEG/PNG originals stream at full size.
|
||
4. The editor shows **Save to event** — which renders the open photo in the browser and
|
||
stores it on the dashboard event as the edited JPEG — and **Back to dashboard**.
|
||
|
||
Bridge accounts get a random password hash, so they can only be reached through the
|
||
dashboard link, not the sign-in form. Imported events expire after
|
||
`LUMINARY_BRIDGE_TTL_HOURS` (default 12) and are swept on the next bridge login.
|
||
|
||
```bash
|
||
GLENLOCH_URL=https://media.example.org \
|
||
BRIDGE_SECRET=<same value as the dashboard> \
|
||
LUMINARY_INVITE=our-team \
|
||
docker compose up -d --build
|
||
```
|
||
|
||
Empty `GLENLOCH_URL` or `BRIDGE_SECRET` disables the bridge entirely.
|
||
|
||
---
|
||
|
||
## Immich album sync
|
||
|
||
Immich support is optional. An administrator can configure one server-wide connection, and
|
||
nothing appears in the app for accounts until that connection is enabled. Per-account
|
||
connections are still supported as a fallback when no shared connection exists.
|
||
|
||
Open **Administration → Immich** as an administrator:
|
||
|
||
1. Enter your Immich server address and an API key from Account Settings → API Keys.
|
||
The key is sealed with AES-256-GCM, stays on the server, and is never returned by the
|
||
API — the browser only ever sees `hasKey`. Back up `LUMINARY_SECRET_KEY` (or the
|
||
generated `<data>/secret.key`) with the database.
|
||
2. Leave **Automatically publish event photos and edits** on and **Test connection**.
|
||
3. Users can then **Refresh albums** in the per-account Immich panel and import one.
|
||
Imports run as a background job with progress.
|
||
|
||
Required key permissions: `album.read`, `album.create`, `albumAsset.create`, `asset.read`,
|
||
`asset.download`, `asset.upload` and `asset.update`. Add `tag.read`, `tag.create` and
|
||
`tag.asset` for keyword sync. Add `asset.delete` only if you intend to move originals to
|
||
the Immich trash after an edit is uploaded.
|
||
|
||
### Pull
|
||
|
||
- Streams each image to disk; raws use the normal LibRaw pipeline, so the editable proxy
|
||
matches an upload exactly.
|
||
- One Luminary event per album, reused on every sync. Every source asset is recorded in
|
||
`immich_assets`, so a re-import adds only missing photos and never duplicates one.
|
||
- Capture date and basic EXIF (camera, lens, ISO, aperture, shutter, focal length) are
|
||
carried across. Ratings, flags, edits and keywords stay Luminary-side.
|
||
- Formats the browser cannot display (for example HEIC) keep their original bytes and get
|
||
a server-rendered JPEG proxy.
|
||
- Uses the account storage quota; a full quota stops the job with a message.
|
||
|
||
### Event galleries
|
||
|
||
When importing into an event, Luminary creates a matching Immich album by default, links
|
||
it to the event, and makes that album the destination for originals and edits. The checkbox
|
||
in the import dialog can turn this off for one import. Unlike an imported album, a gallery
|
||
is never re-imported and is skipped by scheduled sync, so the versions uploaded from
|
||
Luminary do not come back as new photos.
|
||
|
||
Every successful import into an event with a gallery is added automatically: the server
|
||
uploads each original (converting non-JPEG and raw files to JPEG) and the existing checksum
|
||
record prevents a retry from uploading the same file twice. Import failures are reported per
|
||
photo and do not stop the rest of the set.
|
||
|
||
### Push back
|
||
|
||
Edits are saved automatically after you stop adjusting a photo: Luminary waits briefly,
|
||
renders the current edit at full resolution as a JPEG, uploads it to the event's Immich album,
|
||
and uses the checksum record to skip an unchanged render. You can still use **Send edit to
|
||
Immich** from the context menu to send immediately. Luminary:
|
||
|
||
1. Uploads it as a **new** Immich asset — current Immich removed in-place replacement, so
|
||
the original is never overwritten.
|
||
2. Copies album, stack, favourite and sidecar associations from the source asset using the
|
||
version-appropriate copy endpoint, then adds the new asset to the same album explicitly
|
||
as a fallback. Photos without an Immich original go straight into their event's gallery.
|
||
3. Optionally moves the original to the Immich trash (`force: false`, recoverable, never
|
||
a permanent delete). This is off by default and needs `asset.delete`.
|
||
4. Records the checksum in `immich_pushes`, so sending the same render twice returns the
|
||
existing asset instead of uploading a duplicate.
|
||
|
||
The action only appears for accounts that enabled the integration, on photos with an
|
||
Immich source or an event gallery. Select several photos and use **Send to Immich** in the selection
|
||
bar, or the right-click action, to send a queue: each edit is rendered and uploaded in
|
||
turn, with a progress card, per-photo failure isolation and checksum skipping for edits
|
||
that are already there. **Open in Immich** jumps straight to the source asset.
|
||
|
||
### Metadata
|
||
|
||
With **Keep ratings, flags and keywords in sync** enabled (the default), Luminary and
|
||
Immich stay aligned:
|
||
|
||
- Luminary stars map to Immich's 1–5 rating; no stars map to unrated.
|
||
- A rejected flag maps to Immich's −1 rating; a pick maps to the favourite flag.
|
||
- Keywords map to Immich tags; removing a keyword removes that tag from the imported
|
||
asset and any edits pushed from it.
|
||
|
||
Edits made in Luminary are debounced and sent to Immich for the imported original and
|
||
every edit asset pushed from it. Album sync also reconciles in the other direction: a
|
||
rating, favourite or tag changed in Immich is written back to Luminary. Each photo keeps
|
||
a local/remote fingerprint snapshot in `immich_meta`, so only genuinely changed sides are
|
||
acted on; if both changed, the Luminary value wins. Metadata sync needs `asset.update`
|
||
and the tag permissions above, and can be turned off per account.
|
||
|
||
### Scheduled sync
|
||
|
||
Each account can enable **Keep linked albums in sync automatically** and choose 15 minutes
|
||
to once a day. The worker only touches imported albums that account already linked; it
|
||
never imports a new album on its own and never re-imports an event gallery. A sync respects the per-album interval, one job per account, and the
|
||
storage quota. Manual and automatic syncs share the same job path, so re-imports remain
|
||
idempotent. Last run time and the last error are shown in the panel.
|
||
|
||
Version differences are handled at runtime: the client reads `/api/server/version`, asks
|
||
for album assets inline first, retries with `withoutAssets=false`, and falls back to
|
||
`/api/search/metadata` on builds that paginate album contents.
|
||
|
||
---
|
||
|
||
## Raw pipeline
|
||
|
||
The browser cannot demosaic camera raw, so the server does it during upload:
|
||
|
||
1. The original file is stored byte-for-byte in `originals/` with its real extension.
|
||
2. LibRaw (`libraw-wasm`) opens it in a pooled worker with camera white balance and the
|
||
container's orientation and returns the frame **before** any output colourspace
|
||
(`outputColor: 0`). The camera-to-sRGB step is then the body's own `rgb_cam` matrix,
|
||
applied in `server/color.mjs` — the same 3×3 matrix the editor applies to the sidecar,
|
||
so changing the camera profile is a matrix swap rather than a second decode. One
|
||
white point is chosen for the frame from the matrixed pixels (99th percentile, the
|
||
clipping policy LibRaw's auto-bright targets) and baked into both outputs; LibRaw's
|
||
own auto-bright measures each output path separately and would leave the JPEG a third
|
||
of a stop away from the sidecar. `sharp` encodes the editable JPEG proxy at
|
||
`LUMINARY_RAW_EDGE` (6000 px by default). The same decode also writes a 16-bit PNG of
|
||
the camera samples beside it (`previews/<id>.p16.png`, roughly 25× the JPEG) with the
|
||
matrix in a `tEXt` chunk: the editor inflates that sidecar into an `RGBA16F` source
|
||
texture and applies `rgb_cam` in the grade shader, so the grade has 65,536 levels per
|
||
channel instead of 256. A photo without a sidecar — one imported before this existed,
|
||
a non-raw file, or a build with `LUMINARY_16BIT=0` — simply grades the JPEG, so
|
||
nothing breaks either way.
|
||
3. If LibRaw cannot open the file, the largest JPEG embedded in the container is
|
||
extracted and normalised instead. The grid marks such photos `RAW` and the Info panel
|
||
reports which engine produced the proxy, so exotic or very new cameras still import.
|
||
4. Non-raw images are stored untouched and previewed by the browser; `?drop=1` forces
|
||
the server proxy path when needed.
|
||
|
||
Formats: CR2/CR3/CRW, NEF/NRW, ARW/SRF/SR2, ORF, RW2/RWL/RAW, RAF, PEF, DNG, SRW, 3FR,
|
||
FFF, IIQ, X3F, ERF, K25/KDC, DCR, MOS, MRW, MEF, SRAW. Content sniffing checks the
|
||
container signature before wasting a decode attempt.
|
||
|
||
**Camera-native conversion, measured.** `rgb_cam` is applied to the sRGB-decoded camera
|
||
samples; `outputColor: 0` output is sRGB-encoded, not linear (a power curve fits it
|
||
1.8 ΔE worse). Against LibRaw's sRGB + auto-bright output on this repository's test
|
||
raws, the new proxy sits at mean ΔE 0.3–2.4 on normally exposed frames with the same
|
||
~1 % highlight clipping, and 5.5 on one very dark frame where the two auto-bright
|
||
policies disagree most — one shared white point cannot match a per-path heuristic
|
||
exactly. Applying the sidecar's matrix in the shader reproduces the server-encoded
|
||
proxy to within one 8-bit code, so the two outputs cannot drift apart. Deriving the
|
||
same matrix from a DCP `ColorMatrix1` — `inverse(rowNormalise(ColorMatrix · xyz_rgb))`
|
||
— matches LibRaw's `rgb_cam` to 2.2e-5 on a D700 NEF and 2.7e-5 on a 5D Mark II CR2.
|
||
|
||
**Parallel import.** Decoding runs in a bounded pool of LibRaw workers (default
|
||
`min(4, cores−1)`, `LUMINARY_RAW_WORKERS`), and the browser uploads several files at a
|
||
time. Each instance owns one worker thread; extra jobs queue. Idle instances are
|
||
disposed after `LUMINARY_RAW_IDLE_MS` and recreated on demand, so a burst of imports
|
||
does not pin memory forever. A decoder that reports a dead worker is recycled rather
|
||
than returned to the pool. Measured on this repo with 8 mixed raws (20 MP average):
|
||
|
||
| Workers | 8 files | Speedup | Peak memory |
|
||
| --- | --- | --- | --- |
|
||
| 1 (serial) | 19.2 s | 1.0× | — |
|
||
| 4 | 5.2 s | 3.7× | ~2.5 GB |
|
||
| 8 | 3.5 s | 5.4× | ~3.5 GB |
|
||
|
||
Raise the worker count on a big machine; keep it low on a small VPS, where each worker
|
||
can hold a few hundred MB while decoding. `GET /api/health` reports the pool size and
|
||
busy count.
|
||
|
||
---
|
||
|
||
## Detail-preserving denoise
|
||
|
||
`server/denoise/` is a dependency-free pipeline (planes, noise estimation, colour,
|
||
detail, RGB reconstruction) adapted from the `raw-noise` project. It reconstructs each
|
||
pixel as a crossfade between the source and a denoised base, so the result is bounded by
|
||
the original pixels and cannot ring or overshoot: flat noise is replaced, structure is
|
||
handed back verbatim.
|
||
|
||
**Provenance.** `raw-noise` is not published on npm, and no copyright or licence notice
|
||
for it is included in this repository. Before redistributing Luminary, add the origin's
|
||
notice and terms to `server/denoise/`, or replace that folder with an independently
|
||
licensed implementation.
|
||
|
||
- The server always renders the full-strength denoise and the GPU blends it, so the
|
||
Amount slider is instant, one file serves every amount, and the amount cannot be
|
||
applied twice.
|
||
- Renders are cached in `denoised/` under a key that includes `PIPELINE_VERSION`. Bump
|
||
that constant whenever the copied pipeline changes output, or stale renders will be
|
||
served as current.
|
||
- Each run is seconds of CPU, so jobs go through a capped queue
|
||
(`LUMINARY_DENOISE_WORKERS`, default `min(4, cores−1)`). A second request for the same
|
||
photo joins the run already in progress instead of starting an identical one.
|
||
- The job table keeps the newest 40 entries and never drops a queued or running job.
|
||
|
||
---
|
||
|
||
## Lens profiles
|
||
|
||
Lens correction uses the [Lensfun](https://lensfun.github.io/) camera and lens database
|
||
through the [`@neoanaloglabkk/lensfun-wasm`](https://github.com/lexluthor0304/LensfunWasm)
|
||
build. Runtime assets are served from `public/lensfun/`.
|
||
|
||
- **Database** — © Lensfun contributors, licensed
|
||
[CC BY-SA 3.0 Unported](https://creativecommons.org/licenses/by-sa/3.0/), taken from
|
||
Lensfun `data/db` at commit
|
||
[`655a9c4`](https://github.com/lensfun/lensfun/tree/655a9c4e3e53c25bc04843c853e7e7a0121359e7/data).
|
||
It is redistributed as bundled by the wrapper build; Luminary adds no profiles of its
|
||
own.
|
||
- **Library** — Lensfun is LGPL-3.0 (the bundled notice states "or later"), compiled to
|
||
WebAssembly. Corresponding source is the upstream repository at the pinned commit plus
|
||
the wrapper's build scripts.
|
||
- **Bundled files** — `public/lensfun/LICENSE` is the **MIT licence of the WASM
|
||
wrapper**, not of the database or the library. `NOTICE.md`,
|
||
`THIRD_PARTY_LICENSES.md` and `UPSTREAM.md` record the other components and the pin.
|
||
|
||
See [Third-party attribution and licences](#third-party-attribution-and-licences) before
|
||
redistributing the app or its container image.
|
||
|
||
Profiles load lazily the first time the Optics panel needs one, so a library that never
|
||
uses lens correction does not download the ~5 MB database. A profile is built for the
|
||
photo's current focal length and aperture; it is not interpolated between zoom
|
||
positions. Camera-lens defaults require both a normalised camera and lens name to match.
|
||
|
||
---
|
||
|
||
## Development workflow
|
||
|
||
| Command | Use |
|
||
| --- | --- |
|
||
| `npm install` | Install dependencies (prebuilt `sharp`, `libraw-wasm`, Lensfun WASM) |
|
||
| `npm run server:dev` | Server with `node --watch` |
|
||
| `npm run dev` | Vite HMR on 5173 |
|
||
| `npm run typecheck` | `tsc --noEmit` |
|
||
| `npm test` | Vitest, one pass then exit |
|
||
|
||
Conventions worth knowing before changing code:
|
||
|
||
- The server is plain ESM (`.mjs`) with no build step. Keep it framework-free and avoid
|
||
native modules; `node:sqlite` is deliberate, and `sharp` must stay optional.
|
||
- The client is strict TypeScript with `noEmit`; Vite builds only `src/` and `public/`.
|
||
- Edits are data, not pixels: adding a control means extending `src/types.ts`, the
|
||
renderer uniforms/shaders, `normalizeEdits()` defaults, the export path and the panel
|
||
UI. The export path builds a second `Renderer`, so anything wired only into the
|
||
on-screen canvas disappears from exports.
|
||
- New image stages must be mirrored in both `src/App.tsx` (preview) and
|
||
`src/lib/export.ts` (output), or exported files will silently differ.
|
||
- Denoise output changes require a `PIPELINE_VERSION` bump in `server/denoise.mjs`.
|
||
- The SQLite schema only grows by idempotent migrations; existing catalogs must keep
|
||
opening without a manual step.
|
||
|
||
### Tests
|
||
|
||
`npm test` runs the pure-logic Vitest suite:
|
||
|
||
| File | Covers |
|
||
| --- | --- |
|
||
| `src/lib/export.test.ts` | Output dimensions for uncropped, quarter-turn, straightened and cropped frames |
|
||
| `src/lib/tiff.test.ts` | Little-endian 16-bit TIFF layout and the ICC profile tag |
|
||
| `src/lib/icc.test.ts` | The generated sRGB v2 display profile |
|
||
| `src/lib/lensNames.test.ts` | EXIF lens-name normalisation, search variants and match scoring |
|
||
| `src/lib/lensDefaults.test.ts` | Camera + lens default selection and rejection rules |
|
||
| `src/lib/editSections.test.ts` | Selective settings copy and the ISO-aware auto-noise curve |
|
||
| `src/lib/preview16.test.ts` | 16-bit PNG proxy parsing, row flip, half-float encoding and the camera matrix chunk |
|
||
| `src/lib/dcp.test.ts` | DCP tag parsing and the camera matrix recipe against LibRaw's own values |
|
||
| `src/lib/softProof.test.ts` | ICC parsing (including counted lut16 tables), the printer round trip, gamut threshold and CMYK profiles |
|
||
|
||
There are no server integration tests; the API is exercised through the UI.
|
||
|
||
---
|
||
|
||
## Troubleshooting
|
||
|
||
| Symptom | Cause and fix |
|
||
| --- | --- |
|
||
| "Cannot reach the Luminary server" in the app | The Vite dev proxy targets `127.0.0.1:8787`. Start `npm run server`, and do not change `PORT` while using `npm run dev` |
|
||
| `503` "The web build is missing" | `npm start` was run without `dist/`. Run `npm run build` first, or use `npm run dev` |
|
||
| Raw upload returns `422` | LibRaw could not decode the file and no embedded preview was found. Check `GET /api/health` → `raw.libraw`; install dependencies and confirm the camera is supported |
|
||
| Import is slow or the machine swaps | Lower `LUMINARY_RAW_WORKERS`; each decoder holds a worker and a few hundred MB |
|
||
| Emails never arrive | Gmail needs 2-Step Verification and an app password, not the account password. Use **Send test email**; admin-saved settings override the environment |
|
||
| Quota looks wrong after deleting | Trash still counts toward usage. Empty Trash to release the bytes |
|
||
| Cookies not marked `Secure` behind HTTPS | The proxy must forward `X-Forwarded-Proto: https` |
|
||
| Login page hidden after the first account | Registration is closed without an invite. Create an invite link in the admin panel or set `LUMINARY_INVITE` |
|
||
| Images moved but thumbnails 404 | Check the storage root in the admin panel; a moved library needs all six asset folders writable by the server user |
|
||
| Old deployment keeps its config | `LUMENROOM_*` names are still honoured, and the database/volume name `lumenroom` is intentionally unchanged |
|
||
|
||
---
|
||
|
||
## Limitations
|
||
|
||
- **Not a cloud service.** No hosted deployment and no camera driver: tethering is a
|
||
server drop folder, not a PTP/USB connection. No sync client beyond one browser tab's
|
||
whole-record push. The last writer wins per photo; it is
|
||
designed for a handful of people, not concurrent batch workflows.
|
||
- **Per-account catalogs.** Workspaces are private to their owner; there is no shared
|
||
library between two members. Collaboration happens through client proofing links and
|
||
the admin overview.
|
||
- **Proxy-bounded raw.** Raw editing works on the demosaiced proxy (6000 px default),
|
||
not the sensor mosaic; export size is bounded by the proxy. Raw imports keep two
|
||
files: the JPEG proxy every browser can decode, and a 16-bit PNG sidecar of the same
|
||
pixels. The editor grades the sidecar as a half-float source texture when it is
|
||
present, which is what keeps a heavy shadow lift or a 3200 K white balance from
|
||
posterising an 8-bit source; the JPEG and everything derived from it (thumbnails,
|
||
denoise renders, proofs) stay 8-bit. A per-photo DCP profile is applied wherever
|
||
the sidecar is, i.e. the Develop canvas and exports; grid thumbnails and the compare
|
||
view grade the sRGB JPEG, which already has the body matrix baked in, so they do not
|
||
show a different camera profile. The sidecar costs about 25× the JPEG in disk, one download per photo at open time and
|
||
one extra texture in GPU memory (about 8 bytes per pixel), so `LUMINARY_16BIT=0` turns
|
||
it off for libraries that would rather have the space. Either way the 16-bit TIFF export writes 65,536
|
||
samples per channel from the `RGBA16F` render target, so its precision is only more
|
||
than the source's when the sidecar was available; it never invents detail the decode
|
||
did not produce.
|
||
- **Approximate tools.** The relative Temp/Tint sliders and the absolute Kelvin
|
||
control are display-space gains; they are not a camera-specific white-balance
|
||
matrix pair. Raw decode uses the camera's own matrix; a DCP `ColorMatrix` reproduces
|
||
it exactly (`src/lib/dcp.ts` parses the file and derives the matrix), and **Develop →
|
||
Camera profile** loads a `.dcp` per photo, storing the derived 9-number matrix in
|
||
the edit so it follows presets, snapshots and XMP. The picker is available only on
|
||
camera-native sidecars; an older sRGB proxy needs a RAW reprocess first.
|
||
Auto masks are an on-device colour-model segmentation (border histogram, Otsu split,
|
||
connected components), not a trained segmentation network, so a subject that shares
|
||
its colour with the background needs a brush pass. Soft
|
||
proofing applies a printer profile's real A2B/B2A tables when one is loaded
|
||
(**Soft proofing → Load ICC profile**), and falls back to paper white, black point and
|
||
a gamut approximation otherwise. The profile is session state rather than part of the
|
||
edit, and the print dialog still does its own colour management. Both LUT layouts are
|
||
read: v2 `lut16` with fixed 256-entry tables and the counted v4 layout that MOAB/Epson
|
||
paper profiles and Ghostscript's press profiles actually use (4096 entries, counts at
|
||
offsets 48/50). Against LittleCMS on a MOAB/Epson ET-8550 profile the cube agrees to a
|
||
mean 0.97 and p95 3 of 255 per channel. The gamut warning uses a ΔE76 round-trip
|
||
threshold of 2.5 with no endpoint rule: on the repository's photos that flags 6–8 % of
|
||
pixels, the 90th percentile round trip is 1.5 ΔE, and the neutral ramp stays clean. The
|
||
auto-noise profile is an ISO/camera heuristic over the existing sliders, not a
|
||
calibrated sensor model, and sharpening is multi-scale unsharp masking rather than
|
||
deconvolution.
|
||
- **Merge scope.** HDR, panorama and focus stacking are translation-aligned and aimed at
|
||
bracketed, stacked or horizontal sequences, not handheld multi-row composites. They
|
||
compose at a reduced working edge (2600 px).
|
||
- **Compare is a survey.** It shows 2–4 stills side by side, not a synchronised
|
||
zoom/pan view.
|
||
- **No automatic catalog backup.** Trash is a soft delete inside the catalog; the
|
||
database and asset folders are yours to back up (see [Backups](#backups)).
|
||
- **No TLS, 2FA or single sign-on.** Sessions are bearer tokens; serve the app behind
|
||
HTTPS and treat gallery links as public secrets.
|
||
- **Storage accounting is logical.** Quotas count photo-record `size` values, while the
|
||
disk also holds previews, thumbnails, proofs and denoise renders, so actual disk use is
|
||
higher than the quota total.
|
||
|
||
---
|
||
|
||
## Third-party attribution and licences
|
||
|
||
Luminary bundles and links the components below. Versions are those resolved in
|
||
`package-lock.json`; the Lensfun pin is recorded in `public/lensfun/UPSTREAM.md`.
|
||
Consolidated notices for every component, including the licence texts the packages
|
||
ship, are in [`THIRD_PARTY_NOTICES.md`](THIRD_PARTY_NOTICES.md). Licences are named as
|
||
each project declares them — not all of them are OSI-approved "open source" licences,
|
||
and this document does not treat the two as synonyms.
|
||
|
||
### Licence status of this repository
|
||
|
||
The Luminary application code is open source under the [MIT licence](LICENSE) (SPDX
|
||
`MIT`, © 2026 Brian Hursey). You may use, modify and redistribute it, including
|
||
commercially, provided the copyright and permission notices travel with it; there is no
|
||
warranty. Third-party components are unaffected — their terms are in
|
||
[`THIRD_PARTY_NOTICES.md`](THIRD_PARTY_NOTICES.md) and prevail for those components,
|
||
including Lensfun's CC BY-SA 3.0 database, which the MIT licence does not relicense.
|
||
|
||
### Components
|
||
|
||
| Component | Version / pin | Upstream | Licence | Notes |
|
||
| --- | --- | --- | --- | --- |
|
||
| Lensfun library | `655a9c4` | [lensfun/lensfun](https://github.com/lensfun/lensfun) | LGPL-3.0; bundled notices say "or later" | Compiled to WebAssembly; distribution needs the licence text and corresponding source |
|
||
| Lensfun database | `655a9c4` | [lensfun `data/db`](https://github.com/lensfun/lensfun/tree/655a9c4e3e53c25bc04843c853e7e7a0121359e7/data) | CC BY-SA 3.0 Unported | © Lensfun contributors; shipped as `public/lensfun/lensfun-core.data`; attribution and share-alike apply |
|
||
| Lensfun WASM wrapper | 0.1.3 | [lexluthor0304/LensfunWasm](https://github.com/lexluthor0304/LensfunWasm) | MIT | `public/lensfun/LICENSE` is this licence and covers neither the database nor the library |
|
||
| LibRaw | via `libraw-wasm` 1.6.0 | [LibRaw/LibRaw](https://github.com/LibRaw/LibRaw) | LGPL-2.1 **or** CDDL-1.0 (dual) | The decoder compiled into the WASM |
|
||
| `libraw-wasm` | 1.6.0 | [ybouane/LibRaw-Wasm](https://github.com/ybouane/LibRaw-Wasm) | ISC | Binding layer only; its metadata does not replace LibRaw's terms for the compiled library |
|
||
| `sharp` | 0.35.5 | [lovell/sharp](https://github.com/lovell/sharp) | Apache-2.0 | Prebuilt binaries bundle libvips |
|
||
| libvips | bundled by `sharp` | [libvips/libvips](https://github.com/libvips/libvips) | LGPL-2.1-or-later | Applies when distributing binaries or container images |
|
||
| tinyxml2 | bundled in Lensfun WASM | [leethomason/tinyxml2](https://github.com/leethomason/tinyxml2) | zlib | |
|
||
| utf8proc | bundled in Lensfun WASM | [JuliaStrings/utf8proc](https://github.com/JuliaStrings/utf8proc) | MIT | |
|
||
| `exifr` | 7.1.3 | [MikeKovarik/exifr](https://github.com/MikeKovarik/exifr) | MIT | Browser EXIF parsing |
|
||
| `nodemailer` | 10.6.1 | [nodemailer](https://github.com/nodemailer/nodemailer) | MIT-0 | SMTP notifications |
|
||
| React / React DOM | 18.3.1 | [facebook/react](https://github.com/facebook/react) | MIT | |
|
||
| Vite / Vitest / plugin-react | 5.4.21 / 2.1.9 / 4.7.0 | [vitejs/vite](https://github.com/vitejs/vite) | MIT | |
|
||
| TypeScript | 5.9.3 | [microsoft/TypeScript](https://github.com/microsoft/TypeScript) | Apache-2.0 | |
|
||
| Node.js / Debian base image | `node:24-bookworm-slim` | [nodejs.org](https://nodejs.org) / [debian.org](https://www.debian.org) | Node and Debian terms | Only relevant when the container image is redistributed |
|
||
|
||
### Lensfun: attribution and share-alike
|
||
|
||
```text
|
||
Lens database: © Lensfun contributors, CC BY-SA 3.0 Unported
|
||
https://lensfun.github.io/ · https://creativecommons.org/licenses/by-sa/3.0/
|
||
Pinned source: https://github.com/lensfun/lensfun/tree/655a9c4e3e53c25bc04843c853e7e7a0121359e7
|
||
```
|
||
|
||
Keep that attribution with the assets. If you modify the database — for example by
|
||
adding your own lens profiles to the XML — the modified database must be distributed
|
||
under CC BY-SA 3.0 or a compatible licence, and the changes must be indicated. Do not
|
||
describe the database as MIT, public domain, or OSI-approved open source: it is a
|
||
Creative Commons content licence, and it grants neither patent nor trademark rights.
|
||
|
||
### Redistribution checklist
|
||
|
||
`public/lensfun/` currently ships the notices (`NOTICE.md`, `THIRD_PARTY_LICENSES.md`,
|
||
`UPSTREAM.md`) and the wrapper's MIT `LICENSE`, but **not** the full LGPL-3.0 or
|
||
CC BY-SA 3.0 texts. Before distributing Luminary or its container image:
|
||
|
||
1. Add the upstream licence texts beside the assets: Lensfun `COPYING` and
|
||
`COPYING.LESSER` (the LGPL incorporates GPL-3.0 by reference), and
|
||
`data/COPYING.CC_BY-SA_3.0` for the database.
|
||
2. Keep the notices, the pinned commit and the attribution block above in the distributed
|
||
copy, served from `public/lensfun/` as they are today.
|
||
3. Provide corresponding source for the LGPL components: Lensfun and LibRaw at the
|
||
versions actually built, plus tinyxml2 and utf8proc. Leave
|
||
`dist/lensfun/lensfun-core.wasm` and its JS loader replaceable.
|
||
4. When publishing a container image, include the same files and the libvips, Node.js and
|
||
Debian notices.
|
||
5. Do not relicense third-party assets under Luminary's own terms, and do not add
|
||
proprietary profiles to the CC BY-SA database.
|
||
6. Keep the font notices for the user-guide PDF's embedded subsets — Liberation Sans
|
||
(OFL-1.1) and DejaVu Sans Mono (Bitstream Vera licence) — with any redistributed
|
||
copy.
|
||
7. Record the terms of the `server/denoise/` pipeline's `raw-noise` origin; it is not
|
||
published on npm and its licence is currently undocumented here.
|
||
|
||
### No endorsement
|
||
|
||
Lensfun, LibRaw, libvips, sharp and the camera and lens names in profiles are the marks
|
||
of their respective owners. They are used descriptively to identify the software and
|
||
hardware involved. Luminary is not affiliated with, endorsed by, or certified by any of
|
||
them, and its corrections come from the community Lensfun database rather than any
|
||
manufacturer's own profile system.
|