A query client that extends standard SQL with new syntax sugars and enables auto-versioning capabilities on any database
npm install @linked-db/linked-ql_A modern take on SQL and SQL databases_
[![npm version][npm-version-src]][npm-version-href]
[![npm downloads][npm-downloads-src]][npm-downloads-href]
[![bundle][bundle-src]][bundle-href]
[![License][license-src]][license-href]

_Simplify and unify your entire database layer in a single interface_ πΈ
LinkedQL is a database client (client.query()) for PostgreSQL and MySQL/MariaDB, but more broadly, an idea: SQL reimagined for modern apps β.
LinkedQL solves reactivity, relationships, JSON, schemas, embedding, federation & sync, and more in under 80 KiB min | zip.
---
> [!NOTE]
> Youβre viewing @linked-db/linked-ql β the newest iteration.
> For the prev 0.3.x branch, see linked-db/linked-ql@0.3.*.
> [!IMPORTANT]
> π LinkedQL is in active development and evolving daily. Current status = alpha.
> Youβre welcome to experiment, but itβs not yet suited for production apps.
---
| Guide | Explore | Project |
|:------------------------------------------|:----------------------------------------------|:----------------------------------|
| Installation | Capabilities | Status |
| Clients & Dialects | Features | Contributing |
| Query Interface | Documentation | License |
---
LinkedQL is distributed as an npm package. Install it with:
``bash`
npm install @linked-db/linked-ql
The package provides clients for all supported SQL dialects β including FlashQL, the in-memory SQL engine for local or offline use.
Import and initialize the client for your use case. You can run either fully in-memory or with a database.
Here are two quick examples:
FlashQL lets you run SQL queries entirely in memory β with zero setup.
`js
import { FlashQL } from '@linked-db/linked-ql/flashql';
const client = new FlashQL();
await client.query(CREATE TABLE users (id INT PRIMARY KEY, name TEXT));
const result = await client.query(
INSERT INTO users (id, name) VALUES (1, 'Ada'), (2, 'Linus');
SELECT * FROM users;);
console.log(result.rows);
// [{ id: 1, name: 'Ada' }, { id: 2, name: 'Linus' }]
`
FlashQL is ideal for:
* Local-first and offline-first apps
* Running SQL over runtime data
* Testing and prototyping
Connect to your database from the list of supported dialects below.
Hereβs an example using PostgreSQL:
`js
import { PGClient } from '@linked-db/linked-ql/postgres';
const client = new PGClient({
host: 'localhost',
port: 5432,
user: 'postgres',
password: 'password',
database: 'myapp',
});
await client.connect();
const result = await client.query(SELECT 10 AS value);
console.log(result.rows); // [{ value: 10 }]
await client.disconnect();
`
| Dialect | Import Path | Guide |
| :------------------ | :----------------------------- | :--------------------------------- |
| PostgreSQL | @linked-db/linked-ql/postgres | PostgreSQL β |@linked-db/linked-ql/mysql
| MySQL | | MySQL β |@linked-db/linked-ql/mariadb
| MariaDB | | MariaDB β |@linked-db/linked-ql/flashql
| FlashQL (In-Memory) | | FlashQL β |
LinkedQL maintains a unified and familiar interface across all dialects β whether remote or local.
Method signatures and return values are consistent and documented in the
Client API Reference β
---
| Capability | Description |
| :---------------------------- | :----------------------------------------------------------------------------------------------------------------------------- |
| β‘ Live Queries | Turn on reactivity over any SQL query with { live: true }. No extra infrastructure required. |~>
| π DeepRef Operators | Traverse relationships using simple path notation ( / <~). Insert or update nested structures using same notation. |
| π§© JSON Literals | Bring JSON-like clearity to your queries with LinkedQL's first-class support for JSON notation. |
| πͺ Upserts | Do upserts with a literal UPSERT statement. |
| π§ Schema Versioning | (Coming soon) Get automatic schema versioning on your database: automatic snapshots and historical introspection. |
| πΎ Edge & Offline Runtime | (FlashQL) Run or embed SQL locally β in browsers, workers, or edge devices β for local-first and offline-first applications. |
| π Federation & Sync | (Alpha) Unify remote databases, REST endpoints, and local stores into a single relational graph with seamless synchronization. |
| Feature | Description |
| :---------------------------------------- | :------------------------------------------------------------------------------------------------------ |
| π» Classic client.query() Interface | Same classic client interface; advanced capabalities for modern applications. |
| π Multi-Dialect Support | A universal parser that understands PostgreSQL, MySQL, MariaDB, and FlashQL β one client, many dialects. |
| π‘ Lightweight Footprint | A full reactive data layer in one compact library β under 80 KiB (min/zip). |
| π― Automatic Schema Inference | No upfront schema work. LinkedQL auto-discovers your schema and stays schema-driven across complex tasks. |
| πͺ Diff-Based Migrations | (Coming soon) Evolve schemas declaratively through change detection instead of hand-written migration scripts. |
Visit the LinkedQL documentation site β
| Jump to | |
|:--|:--|
| Getting Started β | Get started with LinkedQL in under three minutes. No database required |
| Capabilities Overview β | Jump to the Capabilities section. |
| Meet FlashQL β | Meet FlashQL β LinkedQL's embeddable SQL engine. |
| Engineering Deep Dive β | Dig into LinkedQL's engineering in the engineering section. |
---
| Component | Status | Note |
| :----------------- | :-------- | :-------------------- |
| Parser & Compiler | π© 100% | Stabilizing |100%
| Transform Engine | π© | Stabilizing |97%
| Drivers (PG/MySQL) | π© | Stabilizing; MySQL nearing parity |99%
| FlashQL Engine | π© | Expanding |99%
| Realtime Engine | π© | Stabilizing |20%
| Timeline Engine | π¨ | Planned |10%
| Migration Wizard | β¬ | Planned |5%
| IDE Tooling | β¬ | Early hooks |99%
| Docs (vNext) | π© | Expanding |
> Status Legend:
> π© Complete | π¨ In Progress | β¬ Not Started
LinkedQL is in active development β and contributions are welcome!
Hereβs how you can jump in:
- Issues β Spot a bug or have a feature idea? Open an issue.
- Pull requests β PRs are welcome for fixes, docs, or new ideas.
- Discussions β Not sure where your idea fits? Start a discussion.
β€· clone β install β test
`bash`
git clone https://github.com/linked-db/linked-ql.git
cd linked-ql
git checkout next
npm install
npm test
- Development happens on the next branch β be sure to switch to it as above after cloning.next
- Consider creating your feature branch from before making changes (e.g. git checkout -b feature/my-idea).npm test` before submitting a PR.
- Remember to
- Check the Progress section above to see where help is most needed.
MIT β see LICENSE
[npm-version-src]: https://img.shields.io/npm/v/@linked-db/linked-ql?style=flat&colorA=18181B&colorB=F0DB4F
[npm-version-href]: https://npmjs.com/package/@linked-db/linked-ql
[npm-downloads-src]: https://img.shields.io/npm/dm/@linked-db/linked-ql?style=flat&colorA=18181B&colorB=F0DB4F
[npm-downloads-href]: https://npmjs.com/package/@linked-db/linked-ql
[bundle-src]: https://img.shields.io/bundlephobia/minzip/@linked-db/linked-ql?style=flat&colorA=18181B&colorB=F0DB4F
[bundle-href]: https://bundlephobia.com/result?p=@linked-db/linked-ql
[license-src]: https://img.shields.io/github/license/linked-db/linked-ql.svg?style=flat&colorA=18181B&colorB=F0DB4F
[license-href]: https://github.com/linked-db/linked-ql/blob/master/LICENSE