Replace the README with full project documentation: both run modes, every setting including undocumented ones, production and Docker deployment, architecture and module map, SQLite schema and asset layout, the complete HTTP API, workspace/session rules, quota pruning and mail behaviour, raw and denoise pipelines, development conventions, troubleshooting and limitations. Facts were taken from the source rather than the previous text. 🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
43 KiB
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
- Requirements
- Quick start
- Configuration
- Production deployment
- Docker
- Architecture
- Data model and storage
- HTTP API
- Accounts, sessions and workspaces
- Quotas, warnings and scheduled pruning
- Email setup
- Media Team Hub bridge
- Raw pipeline
- Detail-preserving denoise
- Lens profiles
- Development workflow
- Troubleshooting
- Limitations
- Third-party software 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, exposure, contrast, highlights/shadows/whites/blacks
- texture, clarity, dehaze, vibrance, saturation, black & white mix
- RGB and per-channel tone curves
- 8-band HSL colour mixer, split toning / colour grading
- sharpening, luminance noise reduction
- vignette, grain
- crop with nine aspect ratios, straighten, 90° rotation, flips
- local adjustments (up to four layers): brush, linear gradient and radial masks with feather, invert, luminance/hue/saturation ranges, and per-layer exposure, contrast, highlights, shadows, temperature, tint and saturation. 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 an approximate paper soft-proof preview
- 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. Revoking a link drops its picks and feedback.
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.
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; an
embedded sRGB ICC profile; 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
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_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_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
scryptwith a per-user salt and a 64-byte derived key. - The session cookie is named
lumen_sessionand isHttpOnly; SameSite=Lax. It is markedSecureonly when the request arrives withX-Forwarded-Proto: https. - 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
lumenroomname so older deployments upgrade in place.
Production deployment
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:
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
[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:
- 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-walandlumenroom.db-shmtogether. - 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 withPOST /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.
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:
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:
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
/api/*is matched against an ordered route table (method+/path/:param). Unmatched API paths return a JSON404; everything else is static hosting.currentUser()resolves thelumen_sessioncookie first, then falls back toAuthorization: Bearer <token>. A disabled account or expired session is rejected.- Ownership is enforced per row: events and photos carry
owner_id, and a request for someone else's row returns404rather than403so ids do not leak. Admin routes use a separaterequireAdmin()gate. - Errors are JSON
{ "error": "…" }with400,401,403,404,409,422or500. 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, andLUMINARY_MAX_UPLOADfor image bytes). - Every response gets
X-Frame-Options: SAMEORIGINandReferrer-Policy: same-origin; image responses addX-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/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/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, encrypted-at-rest 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/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, generated in-stream |
| 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/registercreates 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 sharedLUMINARY_INVITEcode.GET /api/healthadvertisesregistrationOpenso the UI can hide the form. - Passwords and sessions. Passwords are hashed with
scryptand 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_idandphotos.owner_idscope every read and write./api/syncreturns only the caller's rows, and the browser tags its IndexedDB records withworkspace: <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().warnturns 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):
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:
- The dashboard signs a short-lived token for a session, event and user, then sends the
browser to
/api/bridge/login?token=…. - 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. - 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. - 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.
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.
Raw pipeline
The browser cannot demosaic camera raw, so the server does it during upload:
- The original file is stored byte-for-byte in
originals/with its real extension. - LibRaw (
libraw-wasm) opens it in a pooled worker with camera white balance, sRGB output and the container's orientation, thensharpencodes an editable JPEG proxy atLUMINARY_RAW_EDGE(6000 px by default). - If LibRaw cannot open the file, the largest JPEG embedded in the container is
extracted and normalised instead. The grid marks such photos
RAWand the Info panel reports which engine produced the proxy, so exotic or very new cameras still import. - Non-raw images are stored untouched and previewed by the browser;
?drop=1forces 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.
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) copied 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.
- 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 includesPIPELINE_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, defaultmin(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 official Lensfun database through
its WebAssembly build (@neoanaloglabkk/lensfun-wasm). Runtime assets are served from
public/lensfun/: the library is LGPL-3.0-or-later and the camera/lens database is
CC BY-SA 3.0; the bundled LICENSE, NOTICE.md, THIRD_PARTY_LICENSES.md and
UPSTREAM.md sit next to the assets.
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:sqliteis deliberate, andsharpmust stay optional. - The client is strict TypeScript with
noEmit; Vite builds onlysrc/andpublic/. - 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 secondRenderer, so anything wired only into the on-screen canvas disappears from exports. - New image stages must be mirrored in both
src/App.tsx(preview) andsrc/lib/export.ts(output), or exported files will silently differ. - Denoise output changes require a
PIPELINE_VERSIONbump inserver/denoise.mjs. - The SQLite schema only grows by idempotent migrations; existing catalogs must keep opening without a manual step.
Tests
npm test runs six Vitest files, all pure-logic:
| 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 |
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, no tethered capture, 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 JPEG proxy (6000 px default), not the sensor mosaic; export size is bounded by the proxy.
- Approximate tools. Temperature/tint are relative to the as-shot white balance. Auto masks are an on-device saliency/colour estimate, not a segmentation model. Soft proofing approximates paper white, black point and print gamut but does not apply a printer ICC profile; use the browser print dialog for final ICC handling. The auto-noise profile is an ISO/camera heuristic over the existing sliders, not a calibrated sensor model.
- 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).
- 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
sizevalues, while the disk also holds previews, thumbnails, proofs and denoise renders, so actual disk use is higher than the quota total.
Third-party software and licences
| Component | Licence / terms |
|---|---|
| Lensfun database and WASM build | Library LGPL-3.0-or-later; database CC BY-SA 3.0. Keep attribution and share-alike terms if reused or redistributed |
LibRaw (libraw-wasm) |
LGPL-2.1 / CDDL-1.0 (LibRaw terms); used for raw demosaic |
sharp / libvips |
Apache-2.0 |
| React, Vite, TypeScript | MIT / Apache-2.0 |
| Luminary application code | Non-commercial project; no licence file is included in this repository |
Lensfun notices and licence texts ship in public/lensfun/ and are served with the
assets, as the database terms require.