Skip to content

Getting Started with LinkedQL ​

This guide takes you from installation to your first query with LinkedQL. No database connection is required, as LinkedQL runs entirely in memory too.

If you're totally new here, you may want to meet LinkedQL.


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.

Installation ​

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.

Initialization ​

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:

Run Locally with FlashQL ​

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 a Database ​

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();

Supported Dialects ​

DialectImport PathGuide
PostgreSQL@linked-db/linked-ql/postgresPostgreSQL β†’
MySQL@linked-db/linked-ql/mysqlMySQL β†’
MariaDB@linked-db/linked-ql/mariadbMariaDB β†’
FlashQL (In-Memory)@linked-db/linked-ql/flashqlFlashQL β†’

The Query Interface ​

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 β†’

Troubleshooting ​

  • Connection refused β€” Check your database credentials and network access.
  • Unexpected syntax β€” Review LinkedQL’s Language Guide for supported SQL extensions.
  • Lost data (FlashQL) β€” Remember FlashQL runs in memory; data resets when the process exits. Persistent storage options planned.

If you encounter a reproducible issue, please open a ticket on GitHub β€Ί LinkedQL Issues and include a concise code sample, dialect, and environment details.

Next Steps ​

MIT Licensed