logoalt Hacker News

nthypesyesterday at 7:08 PM1 replyview on HN

This is an backend library? How to enable Live queries in the frontend?


Replies

phrasecodeyesterday at 9:23 PM

Author here — thanks for checking it out.

Short answer: the core LinkedQL live query engine runs on the backend today, and there’s an embeddable variant (FlashQL) that runs directly in the frontend with the same LinkedQL capabilities – live queries, DeepRefs, etc.

1. Pure frontend / local data

For data that can live entirely on the client, you can spin up an in-browser FlashQL instance:

const client = new FlashQL(); // runs in the page / worker

await client.query(` CREATE TABLE users ( id UUID PRIMARY KEY, name TEXT ) `);

// Live query works the same way as on the backend: const result = await client.query( 'SELECT * FROM users', { live: true } );

From there, result is a live result set: inserts/updates/deletes that match the query will show up in the rows, and all the same features (live queries, DeepRefs, etc.) behave as they do on a backend instance.

At the moment FlashQL is in-memory only; persistence backends like IndexedDB / LocalStorage are on the roadmap.

2. Remote database from the frontend

If your source of truth is a remote Postgres/MySQL instance, the model we’re building is:

a LinkedQL engine next to the database, and

a FlashQL instance in the frontend that federates/syncs with that backend engine.

That federation/sync path is in alpha right now (early docs here: https://linked-ql.netlify.app/flashql/foreign-io ), so today the “stable” story is:

run LinkedQL on the backend against Postgres/MySQL,

expose whatever API you like to the frontend,

and use FlashQL locally where a client-side store makes sense.

The goal is that the frontend doesn’t need a special framework — just a LinkedQL/FlashQL client wherever JavaScript runs.