Glaze
| (require glaze) | package: glaze |
Glaze builds desktop applications with a Racket backend and a Web frontend rendered inside a native OS window. Windows uses WebView2, macOS uses WKWebView, and Linux uses WebKitGTK.
The (require glaze) facade re-exports the stable surface. The 0.18.0 deprecation shims were removed after 0.19.0; the removed-shim register in "docs/api-stability.md" names each canonical owner. New code should prefer the primary modules named there.
Human-first. Agent-native. Local by design. New projects include an agent instruction contract and native-window verification script. The CLI exposes machine-readable project inspection and runtime diagnostics without changing Glaze’s human-readable workflow.
1 Quick Start
$ raco pkg install --auto glaze |
$ raco glaze init myapp |
$ cd myapp |
$ raco glaze inspect --json |
$ raco glaze doctor --json |
$ raco glaze verify |
$ racket main.rkt |
# or: raco glaze dev |
A Glaze application is native-GUI only. If its native WebView cannot start, application startup fails with platform-specific installation or repair guidance. Glaze never substitutes a system-browser tab for the desktop window.
The canonical first-app guide covers the generated "glaze.rktd", typed Racket route, generated JavaScript caller, schema baseline, native-window verification and build. Generated startup belongs inside module+ main, not at the top level. The 0.x scaffold defaults to the HTTP adapter within a native WebView; packaged apps can opt into native GLZ1 transport.
2 Application Lifecycle
| (require glaze/app) | package: glaze |
When the native window closes, the local server is stopped and the procedure returns (values 'webview shutdown). If native WebView startup fails, Glaze first stops the local server and then propagates an actionable startup error. There is intentionally no browser-fallback option.
The bridge is token-protected by default: #:api-token defaults to #t, which generates a random capability token and uses a one-time bootstrap URL to set an HttpOnly cookie for the embedded frontend, so a loopback port is never an open API for other local processes or web pages. Pass an explicit string to choose the token, or #:api-token #f to opt out (dev tooling, trusted kiosk setups). #:max-body-size caps the request body the server will buffer (413 above the limit). #:on-error receives API handler failures. Update checks are the backend’s job over an Ed25519-signed feed (Update Checks); run-app never polls an unsigned manifest.
#:transport 'native serves the page and API entirely inside the WebView’s process boundary (Native Transport): the page loads from the controlled glaze://app/ origin, invokes ride the WebView’s message handler, no TCP port is bound, and no token is minted — the message handler is the trust boundary. #:port is an error in this mode. The default 'http transport keeps the loopback server and is the development vehicle.
The lifecycle is exception-safe: an #:on-ready callback that raises tears the window and the server down before propagating, and an #:on-close hook that raises is reported through #:on-error while the close still completes — a callback bug can neither leak the server nor wedge the application.
When #:capability is supplied, run-app automatically creates an API token if necessary. Every API route then requires a declared and granted permission; this mode is default-deny.
With #:window-state #t, #:app-id selects a platform config path where Glaze saves outer position, size, and maximized state at close and restores them on the next launch. An explicit path may be supplied instead. Stale geometry is clamped to the current virtual desktop so a disconnected monitor cannot strand the window.
parameter
(current-api-token token) → void? token : string?
The application is a state machine over a custodian: 'starting → 'ready → 'running → 'stopping → 'stopped. Every app owns a custodian, so resources spawned for it (background threads such as the update check) are reaped deterministically at quit. State transitions broadcast an 'app-state event on the bus when one is wired. With #:quit-on-last-window? #f the app survives its last window closing (tray-resident mode) and ends only when app-quit! is called; additional windows attach through open-app-window.
parameter
(current-app app) → void? app : (or/c #f glaze-app?)
procedure
(open-app-window url [ #:title title #:width width #:height height #:window-state window-state #:on-close on-close]) → webview? url : string? title : string? = "Glaze" width : exact-positive-integer? = 1024 height : exact-positive-integer? = 768 window-state : (or/c #f path-string?) = #f on-close : (-> any) = (lambda () (void))
3 Local Server
| (require glaze/server) | package: glaze |
| (require glaze/browser) | |
procedure
(start-server [ #:port port #:public-dir public-dir #:api api #:events events #:api-token api-token #:capability capability #:serve-api-client? serve-api-client? #:max-body-size max-body-size])
→
exact-nonnegative-integer? procedure? port : exact-nonnegative-integer? = 8080 public-dir : (or/c string? path?) = "public" api : (listof route?) = '() events : (or/c #f event-bus?) = #f api-token : (or/c #f string?) = #f capability : (or/c #f capability?) = #f serve-api-client? : boolean? = #t max-body-size : exact-nonnegative-integer? = 8388608
The low-level server requires an explicit, non-empty #:api-token whenever #:capability is supplied, keeping runtime authority bound to the embedded WebView rather than an unauthenticated loopback caller.
Every request passes a Host-header check (DNS rebinding), a request-body limit, and — for API routes and the event stream — a cross-site guard: a foreign Origin header or a Sec-Fetch-Site value other than "same-origin"/"none" is rejected with 403, which stops other web pages from posting to the loopback bridge. Static file serving is contained to #:public-dir, including through percent-encoded .. segments and symlinks; route names that cannot be expressed in the generated JavaScript client (collisions, invalid identifiers) fail at startup. Handler exceptions answer a generic 500 body — the full exception goes to the current-glaze-error-reporter, never to the page.
4 JavaScript Bridge
| (require glaze/api) | package: glaze |
| (require glaze/api-macros) | |
The embedded frontend calls Racket through ordinary same-origin HTTP requests. This keeps the bridge easy to inspect and test with normal developer tools.
procedure
(GET path handler [ #:permission permission #:resource resource]) → route? path : string? handler : procedure? permission : (or/c #f symbol? string?) = #f resource : (or/c #f procedure?) = #f
procedure
(POST path handler [ #:permission permission #:resource resource]) → route? path : string? handler : procedure? permission : (or/c #f symbol? string?) = #f resource : (or/c #f procedure?) = #f
procedure
(PUT path handler [ #:permission permission #:resource resource]) → route? path : string? handler : procedure? permission : (or/c #f symbol? string?) = #f resource : (or/c #f procedure?) = #f
procedure
(DELETE path handler [ #:permission permission #:resource resource]) → route? path : string? handler : procedure? permission : (or/c #f symbol? string?) = #f resource : (or/c #f procedure?) = #f
The resource procedure receives the same request and captured path parameters as the route handler. Its result is checked against the active scoped permission before the handler can run. define-api-routes accepts the same #:permission and #:resource options after its route path.
5 Runtime Capabilities
| (require glaze/capability) | package: glaze |
procedure
id : (or/c symbol? string?) authorize : procedure?
procedure
(path-permission id #:allow allow-roots [ #:deny deny-roots]) → any/c id : (or/c symbol? string?) allow-roots : list? deny-roots : list? = '()
procedure
(url-permission id #:allow allowed-patterns [ #:deny denied-patterns]) → any/c id : (or/c symbol? string?) allowed-patterns : list? denied-patterns : list? = '()
procedure
(command-permission id #:allow allow-programs [ #:deny deny-programs #:arguments arguments-ok?]) → any/c id : (or/c symbol? string?) allow-programs : list? deny-programs : list? = '() arguments-ok? : procedure? = (lambda (arguments) #t)
procedure
program : path-string? arguments : list?
procedure
(accelerator-permission id #:allow allowed-patterns #:deny denied-patterns) → any/c id : (or/c symbol? string?) allowed-patterns : list? denied-patterns : '()
procedure
(capability-authorized? capability permission [ resource]) → boolean? capability : capability? permission : (or/c symbol? string?) resource : any/c = #f
parameter
(current-capability-id id) → void? id : (or/c #f string?)
parameter
(current-capability-authorizer authorize) → void? authorize : (or/c #f procedure?)
procedure
(current-capability-authorized? permission [ resource]) → boolean? permission : (or/c symbol? string?) resource : any/c = #f
6 Scoped Filesystem
| (require glaze/filesystem) | package: glaze |
The default prefix generates client functions such as glaze.api.fsReadText, glaze.api.fsWriteFile, and glaze.api.fsMove. Binary payloads use base64 strings in JSON.
procedure
(fs-create-dir! path [ #:recursive? recursive?]) → void? path : path-string? recursive? : boolean? = #t
procedure
path : path-string? recursive? : boolean? = #f
procedure
(fs-copy! source destination [ #:replace? replace?]) → void? source : path-string? destination : path-string? replace? : boolean? = #f
7 Scoped Shell and Child Processes
| (require glaze/shell) | package: glaze |
procedure
(make-shell-routes [ #:prefix prefix #:max-output max-output #:max-processes max-processes #:cwd-roots cwd-roots #:allow-environment allowed-environment #:retention-seconds retention-seconds]) → (listof route?) prefix : string? = "api/shell" max-output : exact-positive-integer? = (* 1024 1024) max-processes : exact-positive-integer? = 32 cwd-roots : (listof path-string?) = '() allowed-environment : list? = '() retention-seconds : positive-real? = 300
The default prefix generates glaze.api.shellOutput, shellSpawn, shellStatus, shellWrite, shellCloseStdin, and shellKill. Completed handles remain available for retention-seconds.
procedure
(shell-output program [ arguments #:cwd cwd #:env environment #:timeout timeout #:max-output max-output]) → hash? program : path-string? arguments : (listof string?) = '() cwd : (or/c #f path-string?) = #f environment : (or/c #f hash?) = #f timeout : (or/c #f positive-real?) = 30 max-output : exact-positive-integer? = (* 1024 1024)
procedure
(shell-spawn! program [ arguments #:cwd cwd #:env environment #:max-output max-output]) → shell-process? program : path-string? arguments : (listof string?) = '() cwd : (or/c #f path-string?) = #f environment : (or/c #f hash?) = #f max-output : exact-positive-integer? = (* 1024 1024)
procedure
child : shell-process? data : (or/c string? bytes?)
8 Persistent JSON Store
| (require glaze/store) | package: glaze |
procedure
(make-store-routes #:root root [ #:prefix prefix #:defaults defaults #:auto-save auto-save #:events events]) → (listof route?) root : path-string? prefix : string? = "api/store" defaults : hash? = (hasheq) auto-save : (or/c boolean? nonnegative-real?) = 100 events : (or/c #f event-bus?) = #f
The generated client includes storeLoad, storeGet, storeSet, storeHas, storeDelete, storeClear, storeReset, storeKeys, storeValues, storeEntries, storeLength, storeSave, storeReload, and storeClose.
procedure
(load-store path [ #:defaults defaults #:auto-save auto-save #:create-new? create-new? #:override-defaults? override-defaults?]) → store? path : path-string? defaults : hash? = (hasheq) auto-save : (or/c boolean? nonnegative-real?) = 100 create-new? : boolean? = #f override-defaults? : boolean? = #f
procedure
storage : store? key : (or/c string? symbol?) default : any/c = #f
procedure
storage : store? key : (or/c string? symbol?) value : jsexpr?
9 Capability-Gated System Plugins
| (require glaze/system) | package: glaze |
The default prefix generates systemClipboardRead, systemClipboardWrite, systemNotificationSend, systemOpenerOpenPath, systemOpenerRevealPath, systemOpenerOpenUrl, systemOsInfo, and systemOsHostname.
10 Global Shortcuts
| (require glaze/global-shortcut) | package: glaze |
System-wide hotkeys with Tauri-style accelerators such as CmdOrCtrl+Shift+D. The native backends are Win32 RegisterHotKey on Windows, Carbon RegisterEventHotKey on macOS, and X11 XGrabKey on Linux (XWayland sessions included; a Wayland session without X fails registration rather than raising). Linux grabs use exact modifiers, so pressed lock keys such as Caps Lock suppress the event there.
procedure
(make-global-shortcut-routes [ #:prefix prefix #:backend backend #:events event-bus]) → (listof route?) prefix : string? = "api/global-shortcut" backend : hotkey-backend? = default-hotkey-backend event-bus : (or/c event-bus? #f) = #f
11 Structured Logging
| (require glaze/log) | package: glaze |
Tauri-plugin-log-style logging: one logger fans structured records out to sinks with per-sink minimum levels, keeps a bounded in-memory history, and pushes records to the page as log SSE events when an event bus is attached.
procedure
(make-glaze-logger [ #:min-level min-level #:sinks sinks #:file-root file-root #:events event-bus #:history history-limit]) → glaze-logger? min-level : symbol? = 'info sinks : list? = '() file-root : (or/c #f path-string?) = #f event-bus : (or/c event-bus? #f) = #f history-limit : (or/c #f exact-positive-integer?) = 1000
procedure
(glaze-logger-history logger [limit]) → (listof log-record?)
logger : glaze-logger? limit : exact-positive-integer? = 100
procedure
(make-file-log-sink root [ #:name name #:max-bytes max-bytes #:keep keep #:min-level min-level]) → log-sink? root : path-string? name : string? = "glaze.log" max-bytes : exact-positive-integer? = (* 1024 1024) keep : exact-nonnegative-integer? = 3 min-level : symbol? = 'trace
procedure
(make-log-routes logger [#:prefix prefix]) → (listof route?)
logger : glaze-logger? prefix : string? = "api/log"
12 Application and Resource Paths
| (require glaze/path) | package: glaze |
procedure
(make-path-resolver app-id #:resource-root resource-root [ #:app-directories-override overrides]) → path-resolver? app-id : string? resource-root : path-string? overrides : (or/c #f path-string? hash?) = #f
procedure
(make-path-routes #:app-id app-id #:resource-root resource-root [ #:app-directories-override overrides #:prefix prefix]) → (listof route?) app-id : string? resource-root : path-string? overrides : (or/c #f path-string? hash?) = #f prefix : string? = "api/path"
procedure
resolver : path-resolver? relative-path : path-string?
13 Scoped HTTP Client
| (require glaze/http) | package: glaze |
procedure
(http-request url [ #:method method #:headers headers #:body body #:timeout timeout #:max-request-bytes max-request-bytes #:max-response-bytes max-response-bytes #:max-redirects max-redirects #:authorize-url? authorize-url?]) → hash? url : string? method : (or/c string? symbol? bytes?) = "GET" headers : hash? = (hasheq) body : (or/c #f string? bytes?) = #f timeout : real? = 30 max-request-bytes : exact-positive-integer? = (* 10 1024 1024)
max-response-bytes : exact-positive-integer? = (* 10 1024 1024) max-redirects : exact-nonnegative-integer? = 5 authorize-url? : procedure? = (lambda (candidate) #t)
procedure
(make-http-routes [ #:prefix prefix #:max-request-bytes max-request-bytes #:max-response-bytes max-response-bytes #:timeout timeout #:max-redirects max-redirects]) → (listof route?) prefix : string? = "api/http" max-request-bytes : exact-positive-integer? = (* 10 1024 1024)
max-response-bytes : exact-positive-integer? = (* 10 1024 1024) timeout : real? = 30 max-redirects : exact-nonnegative-integer? = 5
14 Scoped SQLite
| (require glaze/sql) | package: glaze |
procedure
(open-sqlite-database path [ #:busy-retry-limit busy-retry-limit]) → sql-database? path : path-string? busy-retry-limit : exact-nonnegative-integer? = 1000
procedure
(sql-select database statement [ parameters #:max-rows max-rows #:max-cell-bytes max-cell-bytes]) → (listof hash?) database : sql-database? statement : string? parameters : list? = '() max-rows : exact-positive-integer? = 10000 max-cell-bytes : exact-positive-integer? = (* 10 1024 1024)
procedure
database : sql-database? statement : string? parameters : list? = '()
procedure
(make-sql-routes #:root root [ #:prefix prefix #:max-connections max-connections #:max-rows max-rows #:max-cell-bytes max-cell-bytes #:busy-retry-limit busy-retry-limit]) → (listof route?) root : path-string? prefix : string? = "api/sql" max-connections : exact-positive-integer? = 16 max-rows : exact-positive-integer? = 10000 max-cell-bytes : exact-positive-integer? = (* 10 1024 1024) busy-retry-limit : exact-nonnegative-integer? = 1000
A route handler receives the web-server request followed by any captured :param path values. Returning a jsexpr produces a JSON 200 response; a full response value may also be returned, including a streaming response (streaming-response / event-stream-response below).
procedure
status : exact-nonnegative-integer? message : string?
procedure
(streaming-response writer [ #:mime mime #:headers headers]) → response? writer : (-> output-port? any) mime : bytes? = #"application/octet-stream" headers : (listof header?) = '()
A handler that raises before returning still maps to a 500 JSON (nothing is on the wire yet); an exception inside the writer closes the connection mid-stream, so wrap your own errors there if truncation is unacceptable. The typical use is proxying a streaming LLM endpoint — tokens reach the page as they arrive, API keys stay in Racket, and the page never makes a cross-origin call:
(GET "api/llm/chat" (lambda (req) (streaming-response #:mime #"application/x-ndjson" (lambda (out) (for ([delta (in-llm-deltas (request-json-body req))]) (displayln (jsexpr->string (hasheq 'delta delta)) out) (flush-output out))))))
procedure
(event-stream-response sender [ #:headers headers]) → response? sender : procedure? headers : (listof header?) = '()
event: name\ndata: <json> |
(GET "api/sse/demo" (lambda (req) (event-stream-response (lambda (send) (send 'delta (hasheq 'text "Hel")) (send 'delta (hasheq 'text "lo")) (send 'done (hasheq 'ok #t))))))
(define-api-routes api [(POST "api/counter/bump") (bump [delta exact-nonnegative-integer? 1]) (hasheq 'count (add1 delta))])
The generated /glaze/api.js exposes route-specific functions plus glaze.call(...) and glaze.on(...).
15 Event Push
| (require glaze/events) | package: glaze |
Glaze uses same-origin Server-Sent Events for backend-to-frontend push.
procedure
bus : event-bus? name : (or/c symbol? string?) data : jsexpr?
parameter
→ (-> exact-nonnegative-integer? (or/c symbol? string?) any) (current-event-drop-reporter reporter) → void? reporter : (-> exact-nonnegative-integer? (or/c symbol? string?) any)
16 GLZ1 Bridge Protocol
| (require glaze/bridge) | package: glaze |
GLZ1 is Glaze’s versioned bridge protocol: a request envelope with an id, a closed typed-error taxonomy, cancellation, and timeouts, wrapped around the registered routes. The HTTP endpoints are GET /glaze/hello, POST /glaze/invoke, and POST /glaze/cancel; the generated api.js exposes glaze.hello() / glaze.invoke(path, args, opts) / glaze.cancel(id). The envelope layer is transport-agnostic — the native message-handler transport (Native Transport) dispatches the same envelopes through the WebView’s message handler, with no TCP port.
The protocol is aligned with keel, the transport-neutral application contract shared with Rivet: every invoke response names its terminal 'outcome ("succeeded" / "failed" / "cancelled" / "timed-out"); the error object is keel-shaped (kebab-case code, message, data); /glaze/hello carries a keel app-schema rendering of the route surface; and the app lifecycle state machine validates every transition against keel’s lifecycle contract.
procedure
code : bridge-error-code? message : (or/c #f string?) = #f data : any/c = #f
struct
(struct exn:fail:glaze:bridge (code data))
code : bridge-error-code? data : any/c
16.1 Streaming responses
A streaming handler (streaming-response / event-stream-response) cannot be one invoke envelope — its bytes arrive over time. GLZ1 delivers it as a frame sequence on the same channel: an open frame marks the request id as a stream, one chunk frame carries each piece of decoded text (window.__glz1Chunk(id, text)), and a terminal frame (window.__glz1End(id)) settles the invoking promise with the full joined text. A handler that fails before returning the streaming response still answers a normal typed-error envelope, so both terminal shapes resolve the same page-side promise.
The page client exposes glaze.invokeStream(path, args, opts): opts.onDelta fires per chunk as it arrives, and opts.signal (an AbortSignal) rejects the promise immediately and sends the cancel op, which closes the stream’s pipe server side. Streams carry no timeout — they settle when the writer finishes. Chunk boundaries respect UTF-8: a multi-byte character split across internal reads is held back until it completes rather than delivered corrupted. A writer exception truncates the stream (the terminal frame still arrives), mirroring the HTTP adapter’s connection close.
Every frame travels in both carriers like a full response: a self-contained JavaScript snippet for evaluateJavaScript-style hosts (WKWebView, WebKitGTK), and a {glz, stream, id[, text]} JSON object for PostWebMessageAsJson-style hosts (WebView2).
17 Layer Modules
Beyond the curated glaze/core face, every facade name is reachable through its aggregation layer. Applications that want one surface without the full glaze facade require the layer directly; each layer’s export set is guarded by CI, so drift fails instead of widening silently.
| (require glaze/window) | package: glaze |
| (require glaze/window-state) | package: glaze |
struct
(struct window-state (x y width height maximized?))
x : real? y : real? width : real? height : real? maximized? : boolean?
struct
(struct screen-area (x y width height))
x : real? y : real? width : real? height : real?
procedure
state : window-state? area : screen-area?
| (require glaze/services) | package: glaze |
| (require glaze/distribution) | package: glaze |
| (require glaze/devtools) | package: glaze |
| (require glaze/experimental) | package: glaze |
18 Typed Command Declarations
| (require glaze/types) | package: glaze |
Typed declarations give a route’s parameters and results one expression that both types them in the keel command schema and validates the wire value — the declaration is the validation. Descriptors are accepted anywhere define-api-routes takes a predicate:
(define Item (grecord 'Item "id" GInt64 "name" GString)) (define-api-routes api [(POST "api/counter/bump") (bump [delta GInt64 1]) (begin (bump! delta) (hasheq 'count (unbox count)))] [(GET "api/items/:id" #:returns Item) (item id) (hasheq 'id id)])
The scalar descriptors are GNull, GBool, GInt64, GFloat64, GString, GBytes (a base64 string on the wire), and GValue (any jsexpr). Combinators are glist, goptional, and gmap. Named types — (grecord 'Item "id" GInt64 ...) and (genum 'Color 'red 'green 'blue) — are referenced by value: using Item inside another declaration is the reference, and named types render as TypeScript interfaces and unions.
Wire conventions: null is JSON null, unknown object keys are tolerated so newer clients keep working against older apps, and a wire value that fails its descriptor is a typed invalid-args error naming the parameter — both transports share the same validator (validate-type / validate-jsexpr).
procedure
name : symbol? field : string? type : type-descriptor?
procedure
(validate-type descriptor value) →
boolean? any/c descriptor : type-descriptor? value : jsexpr?
Declared types surface in three places automatically: /glaze/hello carries real keel types for every typed command, /glaze/api.d.ts (served by both transports) carries the generated TypeScript client declaration — generate-ts-declarations renders it — and glaze/schema-compat classifies an old app-schema against a new one:
| (require glaze/schema-compat) | package: glaze |
19 Native Transport
| (require glaze/native-transport) | package: glaze |
The native transport serves the app’s page and API entirely inside the WebView’s process boundary: the page loads from a controlled origin (glaze://app/ on macOS and Linux, http://glaze.localhost/ on Windows, because WebView2 refuses top-level navigation to custom schemes) and invokes the backend through the WebView’s message handler — production binds no TCP port. GLZ1 envelopes ride the message handler in both directions, so typed errors, timeouts, cancellation, capability checks, and streaming work identically on both transports; the HTTP adapter remains the development vehicle, and an app’s existing <script src="/glaze/api.js"> works unchanged because the scheme handler serves the native client at the same path.
procedure
(start-native-transport #:api routes [ #:authority authority #:events bus #:public-dir public-dir]) → native-transport? routes : (listof route?) authority : (or/c #f capability?) = #f bus : (or/c #f event-bus?) = #f public-dir : path-string? = "public"
struct
(struct native-delivery (js json))
js : string? json : string?
procedure
t : native-transport? deliver! : (-> native-delivery? any)
procedure
→ (hash/c symbol? exact-nonnegative-integer?) t : native-transport?
20 Native WebView
| (require glaze/webview/main) | package: glaze |
The native WebView is an application prerequisite, not an optional rendering mode. The backends are WebView2 on Windows, WKWebView on macOS, and WebKitGTK on Linux.
procedure
(open-window url [ #:title title #:width width #:height height #:devtools? devtools? #:window-state window-state #:on-close on-close]) → webview? url : string? title : string? = "Glaze" width : exact-positive-integer? = 1024 height : exact-positive-integer? = 768 devtools? : boolean? = #f window-state : (or/c #f path-string?) = #f on-close : (-> any) = (lambda () (void))
There is no #:fallback-browser? keyword.
procedure
(open-webview url [ #:title title #:width width #:height height #:devtools? devtools? #:window-state window-state #:on-close on-close]) → webview? url : string? title : string? = "Glaze" width : exact-positive-integer? = 1024 height : exact-positive-integer? = 768 devtools? : boolean? = #f window-state : (or/c #f path-string?) = #f on-close : (-> any) = (lambda () (void))
procedure
webview : webview? path : path-string?
procedure
wv : webview? dest : (or/c #f string? path?) = #f
procedure
wv : webview? width : exact-positive-integer? height : exact-positive-integer?
20.1 Startup Dependency Feedback
When native startup fails, Glaze reports the backend error and remediation. Typical guidance includes:
Windows: install or repair Microsoft Edge WebView2 Runtime (Evergreen), with a winget command and Microsoft’s official download page.
Debian/Ubuntu: sudo apt install libgtk-3-0 libwebkit2gtk-4.1-0.
Fedora: sudo dnf install gtk3 webkit2gtk4.1.
Arch: sudo pacman -S gtk3 webkit2gtk-4.1.
macOS: WKWebView is built in; use a logged-in graphical session and report the preserved backend error if initialization still fails.
Set environment variable GLAZE_NO_STARTUP_DIALOG to 1 to suppress the interactive error dialog while retaining the exception. Dialogs are also suppressed automatically under common CI environments.
21 System Integrations
| (require glaze/sys) | package: glaze |
procedure
title : string? body : string? = "" subtitle : string? = ""
These helpers are best-effort integrations. Their failure semantics are separate from the WebView startup contract: the WebView is required for the application itself, while an optional integration may report failure without changing the application’s rendering model.
22 System Tray
| (require glaze/tray) | package: glaze |
procedure
(make-tray #:icon icon #:tooltip tooltip #:menu menu [ #:on-event on-event]) → tray? icon : any/c tooltip : string? menu : list? on-event : procedure? = (lambda (e) (void))
The tray remains an optional capability. If its native backend is unavailable, Glaze may use an inert tray stub; this does not weaken the mandatory native WebView contract for the main window.
23 Security
The local server binds to loopback and validates Host headers against 127.0.0.1, localhost, and [::1] to reduce DNS rebinding risk.
With #:api-token, API routes and the SSE stream require a capability. run-app opens the native WebView at a one-time bootstrap URL; the server exchanges the token for an HttpOnly cookie and redirects to the clean path. Programmatic clients may use the X-Glaze-Token header.
With #:capability, the server additionally enforces named permissions and resource scopes. Routes without #:permission, routes whose permission is absent, and resources outside a granted scope return 403 before the handler runs. Grant 'glaze:events to authorize the SSE endpoint.
This is defense in depth against casual local callers, not isolation from other processes running as the same OS user.
24 Update Checks
| (require glaze/update) | package: glaze |
procedure
path : (or/c string? path?) expected-hex : string?
For installed applications, the signed updater is the preferred path. An update-manifest binds the application id, SemVer version, release channel, minimum supported version, staged rollout percentage, and a set of platform/architecture update-artifact values into one Ed25519-signed payload. Artifact records include a bounded size, SHA-256 digest, installer kind and arguments, and an optional second Ed25519 signature.
procedure
(fetch-update-manifest manifest-url public-key [ #:key-id key-id #:maximum-bytes maximum-bytes]) → update-manifest? manifest-url : string? public-key : path-string? key-id : (or/c #f string?) = #f maximum-bytes : exact-positive-integer? = (* 1024 1024)
procedure
(select-update config manifest) → (or/c #f update-candidate?)
config : updater-config? manifest : update-manifest?
procedure
(download-update config candidate destination) → path? config : updater-config? candidate : update-candidate? destination : path-string?
procedure
(make-install-plan candidate downloaded-path [ #:backup-path backup-path] #:install install [ #:restart restart #:rollback rollback]) → install-plan? candidate : update-candidate? downloaded-path : path-string? backup-path : (or/c #f path-string?) = #f install : procedure? restart : procedure? = void rollback : procedure? = void
procedure
(make-replace-install-plan candidate downloaded-path target-path #:backup-path backup-path [ #:restart restart]) → install-plan? candidate : update-candidate? downloaded-path : path-string? target-path : path-string? backup-path : path-string? restart : procedure? = void
Release automation can validate and sign a payload with raco glaze manifest-sign, then verify the wrapper and pinned key id with raco glaze manifest-verify.
25 File Dialogs
| (require glaze/dialogs) | package: glaze |
procedure
(pick-file [ #:title title #:directory directory #:filters filters]) → (or/c #f path?) title : (or/c #f string?) = #f directory : (or/c #f path-string?) = #f filters : list? = '()
procedure
(pick-files [ #:title title #:directory directory #:filters filters]) → (listof path?) title : (or/c #f string?) = #f directory : (or/c #f path-string?) = #f filters : list? = '()
procedure
(pick-folder [ #:title title #:directory directory]) → (or/c #f path?) title : (or/c #f string?) = #f directory : (or/c #f path-string?) = #f
procedure
(save-file-dialog [ #:title title #:default-name default-name #:directory directory #:filters filters]) → (or/c #f path?) title : (or/c #f string?) = #f default-name : (or/c #f string?) = #f directory : (or/c #f path-string?) = #f filters : list? = '()
procedure
title : string? body : string? = "" kind : symbol? = 'info
procedure
title : string? body : string? = "" kind : symbol? = 'info
Dialogs are modal on the calling thread: while one is open, other Racket-side request handling waits (the WebView itself stays responsive in its own native loop).
procedure
(make-dialog-routes [ #:prefix prefix #:backend backend]) → (listof route?) prefix : string? = "api/dialog" backend : dialog-backend? = default-dialog-backend
26 Deep Links and Launch at Login
| (require glaze/deeplink) | package: glaze |
| (require glaze/autolaunch) | |
procedure
(ensure-url-scheme! scheme [ #:app-name app-name]) → any/c scheme : string? app-name : string? = scheme
27 Packaging
| (require glaze/build) | package: glaze |
procedure
(build-app [ #:entry entry #:name name #:version version #:publisher publisher #:identifier identifier #:icon icon #:out-dir out-dir #:embed-dlls? embed-dlls? #:installer? installer? #:sign sign #:entitlements entitlements #:no-hardened-runtime? no-hardened-runtime? #:timestamp-url timestamp-url #:notarize-profile notarize-profile #:url-schemes url-schemes]) → path? entry : (or/c string? path?) = "main.rkt" name : (or/c #f string?) = #f version : (or/c #f string?) = #f publisher : (or/c #f string?) = #f identifier : (or/c #f string?) = #f icon : any/c = #f out-dir : (or/c string? path?) = "dist" embed-dlls? : boolean? = #f installer? : boolean? = #f sign : (or/c #f string?) = #f entitlements : any/c = #f no-hardened-runtime? : boolean? = #f timestamp-url : (or/c #f string?) = #f notarize-profile : (or/c #f string?) = #f url-schemes : list? = '()
Installer-toolchain absence may degrade an installer request to an archive with a loud warning. That packaging fallback is unrelated to runtime startup: the built application still requires its native WebView.
The publisher is written to native installer metadata. Keep the identifier stable across releases: it deterministically defines the WiX UpgradeCode and the NSIS Add/Remove Programs identity.
–replace-upgrade-code "<guid>" (repeatable, Windows MSI only) names the UpgradeCode of a product from another installer family, typically the previous packaging stack. Installing the MSI uninstalls that product first; without the flag the two coexist and share one install directory.
28 CLI Commands
The command list below mirrors "glaze-cli/cli.rkt"’s dispatch table and raco glaze help; it must not shrink below the shipped commands.
raco glaze init <name> Create a native desktop project |
raco glaze dev Run the project's native main.rkt |
raco glaze inspect --json Inspect project paths and verification map |
raco glaze doctor --json Diagnose package/WebView readiness |
raco glaze compliance --json SBOM, third-party notices, and license audit |
raco glaze support-bundle Collect a redacted diagnostic ZIP |
raco glaze acceptance --json Bounded headless acceptance evidence |
raco glaze matrix <report>... Fold per-platform acceptance reports |
raco glaze check-release-version Preflight release version alignment |
raco glaze verify-release-assets Offline gate for signed release assets |
raco glaze schema check --json Check API compatibility |
raco glaze schema write Explicitly update API baseline |
raco glaze verify Verify real native window |
raco glaze measure Report packaged-app size/startup against budgets |
raco glaze build Build a distributable / installer |
raco glaze clean Remove build artifacts (dist; --out DIR --compiled --dry-run --json) |
raco glaze updater-keygen Create an Ed25519 keypair for update signing |
raco glaze update-sign Sign an update artifact (Ed25519 over its sha256) |
raco glaze update-verify Verify an update artifact signature |
raco glaze manifest-sign Sign a validated update manifest |
raco glaze manifest-verify Verify a signed update manifest |
raco glaze install Pin the glaze package to a revision and link it |
raco glaze help Show help |
There is intentionally no browser-mode dev or serve command. Development and production use the same native WebView startup path.
29 The stable facade
| (require glaze/core) | package: glaze |
glaze/core is the stable tier-1 facade named by "docs/api-stability.md": it exports the primary application surface — run-app, app-quit!, open-app-window, the HTTP API builders (define-api-routes, GET, POST, api-response), window operations, and the platform capability modules — with one stability contract. glaze re-exports it as the legacy compatibility facade (the 0.18.0 deprecation shims were removed after 0.19.0).
30 Signing and hashing
| (require glaze/signing) | package: glaze |
Update artifacts, manifests, and release evidence are signed with Ed25519 through OpenSSL. These are the same primitives the raco glaze updater-keygen / update-sign / update-verify / manifest-sign / manifest-verify commands drive.
procedure
(signing-keygen #:out-dir out-dir #:key-id key-id [ #:password password]) → void? out-dir : path-string? key-id : string? password : (or/c string? #f) = #f
procedure
public-key : any/c data : bytes? signature : bytes?
procedure
public-key : any/c path : path-string? signature : bytes?
31 Version comparisons
| (require glaze/semver) | package: glaze |
Update channels and update manifests compare versions with these helpers; prerelease identifiers sort by SemVer 2.0 rules.
procedure
left : string? right : string?
procedure
left : string? right : string?
procedure
left : string? right : string?
procedure
left : string? right : string?
procedure
left : string? right : string?
32 Frontend assets
| (require glaze/assets) | package: glaze |
procedure
(resolve-public-dir #:project-dir project-dir [ #:public-dir public-dir]) → path? project-dir : path-string? public-dir : (or/c path-string? #f) = #f
33 FFI discovery
| (require glaze/ffi-discovery) | package: glaze |
Every native-library load in Glaze goes through ffi-lib* rather than raw ffi-lib: it searches the platform-specific directories and records the failure reason so capabilities that depend on an optional native library can degrade with guidance instead of an unexplained crash.
procedure
name : string? versions : (listof (or/c string? (listof string?) #f)) = '()
34 WebView startup failure feedback
| (require glaze/webview/startup-feedback) | package: glaze |
Index
|
accelerator-permission |
35 Further reading
"docs/api-stability.md" owns the stability tiers and the deprecation shim ledger; "docs/README.md" routes the canonical guides; github.com/turlamai/glaze hosts the source and the issue tracker.