
Pgmicro Postgres Sqlite
Embed PostgreSQL-compatible SQL in apps or CLIs without running a separate database server process.
Overview
pgmicro-postgres-sqlite is an agent skill for the Build phase that guides embedding an in-process PostgreSQL-compatible database backed by SQLite-compatible storage.
Install
npx skills add https://github.com/aradotso/trending-skills --skill pgmicro-postgres-sqliteWhat is this skill?
- Parses PostgreSQL SQL via libpg_query and executes on SQLite-compatible Turso storage
- Single-file or in-memory `.db` format readable by standard SQLite tools
- JavaScript/TypeScript WASM SDK for Node.js and browsers
- Optional PostgreSQL wire-protocol server mode for psql and ORMs
- Dialect switching between PostgreSQL and SQLite syntax on one database
- PostgreSQL system catalog virtual tables (pg_class, pg_attribute, pg_type, etc.)
Adoption & trust: 712 installs on skills.sh; 31 GitHub stars; 3/3 security scanners passed (skills.sh audits).
What problem does it solve?
You need PostgreSQL SQL and tooling ergonomics but do not want to run and operate a separate database server for every app or prototype.
Who is it for?
Solo builders shipping local-first apps, WASM or edge prototypes, and dev fixtures that must speak PostgreSQL without server ops.
Skip if: Teams that require full PostgreSQL extensions, heavy concurrent write workloads, or managed cloud Postgres as the source of truth without compatibility testing.
When should I use this skill?
use pgmicro in my project, embed postgres in my app, in-process postgresql database, pgmicro setup and usage, sqlite backed postgres, run postgresql without a server, pgmicro javascript sdk, embeddable postgres database
What do I get? / Deliverables
After the skill runs, you can install or invoke pgmicro via CLI or SDK, pick embedded vs wire-protocol mode, and store data in a portable single-file database with PG syntax.
- pgmicro install or npx invocation plan
- Embedded or wire-protocol connection configuration
- Single-file or in-memory database setup
Recommended Skills
Journey fit
Canonical shelf is Build because the skill guides choosing, installing, and wiring an embedded datastore into the product backend. Backend fits persistence-layer decisions—local dev DBs, edge workers, and single-file production stores—not UI or distribution work.
How it compares
Use for embedded PG-flavored SQL instead of defaulting to raw SQLite-only APIs or full Docker Postgres for every small project.
Common Questions / FAQ
Who is pgmicro-postgres-sqlite for?
Indie and solo developers embedding databases in Node, Rust, or browser apps who want PostgreSQL syntax and optional psql connectivity without a dedicated server.
When should I use pgmicro-postgres-sqlite?
During Build backend work when you need in-process storage, a portable `.db` file, or triggers like embed postgres in my app, run postgresql without a server, or pgmicro javascript sdk.
Is pgmicro-postgres-sqlite safe to install?
Treat it as documentation for a third-party database stack; review the Security Audits panel on this Prism page and your dependency supply chain before shipping to production.
SKILL.md
READMESKILL.md - Pgmicro Postgres Sqlite
# pgmicro > Skill by [ara.so](https://ara.so) — Daily 2026 Skills collection. pgmicro is an in-process reimplementation of PostgreSQL backed by a SQLite-compatible storage engine. It parses PostgreSQL SQL using the real PostgreSQL parser (`libpg_query`) and compiles it directly to SQLite VDBE bytecode, executed by [Turso](https://github.com/tursodatabase/turso). The result is a fast, embeddable, single-file (or in-memory) database that speaks PostgreSQL — no server process required. ## Key capabilities - Full PostgreSQL SQL syntax (via the actual PG parser) - SQLite-compatible `.db` file format (readable by any SQLite tool) - JavaScript/TypeScript SDK (WASM-based, runs in Node.js and browsers) - PostgreSQL wire protocol server mode (connect with `psql`, ORMs, etc.) - Dialect switching: access the same database with PG or SQLite syntax - PostgreSQL system catalog virtual tables (`pg_class`, `pg_attribute`, `pg_type`, etc.) ## Installation ### CLI (Node.js) ```bash # Run without installing npx pg-micro # Install globally npm install -g pg-micro pg-micro myapp.db ``` ### JavaScript/TypeScript SDK ```bash npm install pg-micro ``` ### From source (Rust) ```bash git clone https://github.com/glommer/pgmicro cd pgmicro cargo build --release ./target/release/pgmicro ``` ## CLI usage ```bash # In-memory database (ephemeral) pgmicro # File-backed database pgmicro myapp.db # PostgreSQL wire protocol server pgmicro myapp.db --server 127.0.0.1:5432 # In-memory server (useful for testing) pgmicro :memory: --server 127.0.0.1:5432 ``` ### CLI meta-commands ``` \? Show help \q Quit \dt List tables \d <table> Describe table schema ``` ## JavaScript/TypeScript SDK ### Basic usage ```typescript import { connect } from "pg-micro"; // In-memory database const db = await connect(":memory:"); // File-backed database const db = await connect("./myapp.db"); // DDL await db.exec(` CREATE TABLE users ( id SERIAL PRIMARY KEY, name TEXT NOT NULL, email TEXT UNIQUE, created_at TEXT DEFAULT CURRENT_TIMESTAMP ) `); // Insert await db.exec(` INSERT INTO users (name, email) VALUES ('Alice', 'alice@example.com') `); // Prepared statement — fetch all rows const stmt = await db.prepare("SELECT * FROM users WHERE name = ?"); const rows = await stmt.all("Alice"); console.log(rows); // [{ id: 1, name: 'Alice', email: 'alice@example.com', created_at: '...' }] // Fetch single row const row = await stmt.get("Alice"); // Execute with bound parameters await db.exec("INSERT INTO users (name, email) VALUES (?, ?)", ["Bob", "bob@example.com"]); await db.close(); ``` ### Parameterized queries ```typescript import { connect } from "pg-micro"; const db = await connect(":memory:"); await db.exec(` CREATE TABLE events ( id SERIAL PRIMARY KEY, type TEXT NOT NULL, payload TEXT, ts TEXT DEFAULT CURRENT_TIMESTAMP ) `); // Positional parameters const insert = await db.prepare( "INSERT INTO events (type, payload) VALUES ($1, $2)" ); await insert.run("user.signup", JSON.stringify({ userId: 42 })); await insert.run("page.view", JSON.stringify({ path: "/home" })); // Query with filter const query = await db.prepare( "SELECT * FROM events WHERE type = $1 ORDER BY id DESC" ); const signups = await query.all("user.signup"); console.log(signups); await db.close(); ``` ### Transactions ```typescript import { connect } from "pg-micro"; const db = await connect(":memory:"); await db.exec("CREATE TABLE accounts (id INT PRIMARY KEY, balance INT)"); await db.