Skip to content

Server edition: a read-only mode that serves a slim viewer (look, measure, section; no modelling code) #24393

Backlog

Description

@nomadsgalaxy

What are you trying to do

Someone asked for a "view only" SolidCraft: open a design to look at it (orbit, select, measure, section, maybe leave a note) without the modelling tools. I'd like that as part of the server edition in #19199. You run solidcraft-cli serve in a read-only mode, and it serves a small viewer app that has only the view controls and none of the modelling code. The server already has the whole kernel, so it can open and evaluate the design and send the browser just what it needs to draw it.

Today every way of looking at a design in the browser downloads the whole app:

The full web build is big, and that's what keeps phones and tablets out. On upstream main at e060398 the main wasm is 183 MB (156 MB of code) plus a 141 MB compute worker. #23933 brought it down by about a quarter, but it's still well over 100 MB (#21085). I tried it on an old 2 GB Android tablet (NVIDIA Shield, Chromium 119):

  • With the stock build the tab dies about 25 s into startup, while V8 is still compiling. Renderer memory hits about 750 MB.
  • With everything built at opt-level = "z" (113 MB of code) it only starts once the service worker isn't there to precache the 104 MB compute worker at the same moment. Startup still peaks at 550 to 680 MB.
  • Once it's running, idle is about 300 MB. One session died about 10 s into Extrude with what looks like an out-of-memory kill.

Someone who only wants to look at a part doesn't need any of the code that fills that memory: solidcore, the feature ops, the sketch solver, the cadmpeg codecs, the compute worker.

Who this helps:

How you imagine it working

Three parts, all building on #19199.

1. serve --read-only (or a read-only token)

This is open question 3 in docs/server-edition.md on #19199 ("a second, read-only token ... would cover viewers"). In read-only mode:

2. A display-data endpoint

GET /api/display?path=part.sc opens the design on the server, evaluates it and answers with what a viewer draws: per-body triangle meshes with normals and colours, edges, a face and body id for each triangle (for picking), body and component names, the browser tree with visibility, and the bounding box. The server caches the result per document digest, so a second visitor doesn't evaluate the design again.

There's a good starting point already. file.save {preview: true} writes display meshes into the container (cache/preview.json and cache/preview.bin, solidcraft-preview/1). crates/design-preview reads them with no kernel, and the macOS Quick Look extension already orbits them (docs/design-container.md, "Provisional saved display"). The viewer needs a bit more than that cache keeps: edges, face ids for picking, and more than 100,000 triangles. So I'd treat this as a richer sibling of solidcraft-preview/1, with the same bounded, untrusted, display-only rules.

The native model cache (cache/model.json) isn't the right thing to send. It's exact B-rep that needs solidcore to tessellate, and it's tied to the build that wrote it.

Measuring goes back to the server as a read-only call, so distances and angles come from the exact geometry, not from triangles. Sections can be drawn on the client with a clipping plane.

3. A slim viewer app

A new web app, something like apps/solidcraft-viewer, built on ui-kit, viewport-egui and viewport-gpu. None of those depend on the engine, doc, kernel or solidcore. It has orbit, select, section, show and hide, measure through the server, and a link to open the design in the full app. Later it could also show markups (#18800).

From the per-crate sizes of the current main wasm (code before wasm-opt, about 200 MB in total), leaving out solidcore (65.8 MB), engine (17.7), doc (16.1), ui-egui (11.4), cadmpeg (about 16) and most of serde/schemars and solidcore's ops leaves something like 40 to 65 MB of code before wasm-opt. That's roughly 30 to 50 MB shipped, with no compute worker. Today it's 156 MB of code plus a 130 MB worker. That's an estimate from the name section, not a build, and I haven't checked how much of the 26 MB data section a viewer would keep.

The same app could open a .sc file from disk or from an ?open= link when it was saved with preview: true, using crates/design-preview. That gives a serverless, look-only fallback.

The open question is how much of the viewport interaction in ui-egui (selection, picking, the section tool) can move down into ui-kit and viewport-egui without pulling the engine along. Navigation already lives in ui-kit.

The cheaper alternative

A read-only UI flag in the full app means extending the ?embed viewer to hide every modelling tool. It's cheap to build, but it downloads exactly as much as the editor, so it doesn't help the devices that need this most. I'd only fall back to it if the slim viewer turns out to be too much work.

Activity

  1. added
    needs-triage
    on Nov 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions