Seven Bridges of Integrationsburg
Relating with Astro, Next.js, SvelteKit, Observable, react-admin, Phaser, and vanilla JS
Relate runs in a browser as WebAssembly. The packages below handle the rest: where the database file goes, which thread it runs on, what happens to it when a visitor navigates. One core, six ways in.
This question is so banal, but seemed worthy of attention in that neither geometry, nor algebra, nor even a
<script>tag was sufficient to solve it.– (probably) Euler
Vanilla JS
@relate/[email protected] puts a Relate database in any web page.
- The database runs in a dedicated worker, so the page never freezes. If the worker crashes or a query times out, the client replaces it and re-runs your live subscriptions. You write no retry code.
- A D3-compatible graph object of nodes and links, validated in the build and loaded with two fixed statements.
- Two navigation profiles:
client-routingkeeps one instance for the whole visit,multi-pagestarts one per page and restores from a stored copy. - Application graphs are named, durable graphs the visitor writes to, with versioned migrations, export and import.
pnpm add @relate/contrib-web @relate/relate-wasm
Every package below builds on this one. Source.
Astro
@relate/[email protected] turns your content into a graph at build time.
A graph source is a module that may use astro:content. The build validates it and publishes it as static files named by their hash, so a content change invalidates every stored copy. Declare a graph once for the whole site, or inline with <GraphData> for a single recipe, notebook or dashboard. onPage ties a page’s clients to the ClientRouter. For Astro 7, static output. Source.
Next.js
@relate/[email protected] serves graphs built from your content and gives React components hooks to query them.
Next can’t inject routes, so you own one small route file and the package supplies createGraphRoute, a RelateProvider and the hooks. It works with Turbopack and webpack, in a static export or on the Node server, with or without a basePath. The hooks render a placeholder first and read after mount, so hydration stays quiet. For Next 16, app router. Source.
SvelteKit
@relate/[email protected] prerenders graphs and gives components reactive access to a client.
One +server.ts with prerender = true writes the graph into your static output, under adapter-static or adapter-node. Components get RelateProvider, GraphData, useGraph and useQuery, written for Svelte 5 runes. A server-only catalog keeps graph sources out of the browser bundle. For SvelteKit 3. Source.
Observable Framework
@relate/[email protected] makes a graph query a notebook cell.
Framework has no plugin interface, so the package is three entries you call from your own files: loaders that place the database and its worker, open, which ties a client to a cell, and result helpers. Query with the cypher tagged template, and the rows come back shaped for Plot, Inputs, d3 and DuckDB. The client is destroyed when a cell re-runs. There’s a graph shape for force layouts too. For Framework 1.x, in preview and static builds. Source.
react-admin
@relate/[email protected] is a react-admin data provider over the embedded graph. An admin app with no backend.
Declare your resources, with their fields and references, and you get lists, filters, search, paging, edit forms and relation pickers. Each is translated into a parameterised statement. Records persist in the visitor’s browser and survive a reload. The demos/react-admin app shows companies, people and projects, and an onStatement hook logs every statement it runs. For react-admin 5. Source.
Phaser
@relate/[email protected] is for a game whose world is a graph.
A game loop wants an answer every frame, and a worker answers when it’s ready. Four pieces bridge the two: Bridge sends statements in order without the loop awaiting, ReplyCache is the store the loop reads and applies optimistic changes with rollback, createThrowawayClient gives an attract mode or tutorial its own in-memory graph, and versionWatch redraws only when the cache changes. They were lifted out of the path explorer demo, where an explorer extends a thread across a hidden hex map and the world, rules and score all live in the graph. For Phaser 4. Source.
Relatedly,
Archie & The Chords