---
title: "Bringing psql’s \\d to your web browser"
description: "Neon's web SQL Editor now supports psql backslash introspection commands like \\d, \\l, \\dx and \\sf, which live in psql's C client code rather than the Postgres server."
url: "https://swe.quest/articles/bringing-psql-s-d-to-your-web-browser-032015b940df37e2"
canonical: "https://neon.com/blog/bringing-psqls-d-to-your-web-browser"
source: "Neon"
published: "2024-04-17"
difficulty: "medium"
kind: "Case study"
reading_minutes: 6
tags: ["postgres","javascript","developer-tools"]
---

# Bringing psql’s \\d to your web browser

A post on [Neon](https://swe.quest/sources/neon.md), published 2024-04-17, 6 min read, Case study. Original: [https://neon.com/blog/bringing-psqls-d-to-your-web-browser](https://neon.com/blog/bringing-psqls-d-to-your-web-browser)

## Summary

Neon's web SQL Editor now supports psql backslash introspection commands like \\d, \\l, \\dx and \\sf, which live in psql's C client code rather than the Postgres server. Instead of compiling psql to WASM with emscripten, the C was translated to JavaScript via RegExp search-and-replace, reimplementations of helpers like sprintf, and a test script comparing output against real psql until every command matched; most fixes involved pointer arithmetic. Because backslash commands must be handled separately, SQL is now split client-side with a small open-source lexer using sticky RegExps that understands quoted identifiers, nested comments, escape and dollar-quoted strings, so only significant semicolons terminate statements.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [PostgreSQL](https://swe.quest/tags/postgres.md) (Data & databases)
- [JavaScript](https://swe.quest/tags/javascript.md) (Languages)
- [Developer tools](https://swe.quest/tags/developer-tools.md) (Engineering practices)

## Prerequisites

- psql basics
- PostgreSQL SQL syntax ([easy posts on PostgreSQL](https://swe.quest/tags/postgres.md?difficulty=easy))
- JavaScript regular expressions ([easy posts on JavaScript](https://swe.quest/tags/javascript.md?difficulty=easy))

## Keywords

psql, Neon, Neon serverless driver, emscripten, Zapatos, dollar-quoted strings

## Related posts

- [psql from the browser](https://swe.quest/articles/psql-from-the-browser-f27b7186b8abd76b.md): Neon · 2024-12-11 · Easy · 3 min read · PostgreSQL, Browsers, Developer tools, Open source
  psql.sh is a browser-based emulation of Postgres's psql client, built on Neon's WebSocket proxy and serverless driver because browsers can't open raw TCP connections.
- [Postgres Language Server: Initial Release](https://swe.quest/articles/postgres-language-server-initial-release-4b7148c84b3bcff0.md): Supabase · 2025-03-29 · Medium · 13 min read · PostgreSQL, Developer tools, Rust, SQL, Static analysis
  Postgres Language Server is an LSP implementation for Postgres offering autocompletion, syntax error highlighting, type-checking via PREPARE/EXPLAIN against a live database, and a Squawk-inspired linter, available for VSCode, Neovim and as a CLI.
- [Postgres WASM by Snaplet and Supabase](https://swe.quest/articles/postgres-wasm-by-snaplet-and-supabase-a942df855beab1df.md): Supabase · 2022-10-03 · Medium · 9 min read · PostgreSQL, WebAssembly, Virtualization, Browsers, Networking
  postgres-wasm runs a full PostgreSQL 14 server in the browser by emulating an x86 machine with v86 rather than compiling Postgres to WASM directly.
- [Postgres Language Server: implementing the Parser](https://swe.quest/articles/postgres-language-server-implementing-the-parser-3a3e33745c9c0915.md): Supabase · 2023-12-08 · Hard · 14 min read · PostgreSQL, Compilers, Rust, Developer tools, SQL
  A Postgres language server's parser builds on libpg\_query rather than a custom grammar, and has to work around two gaps in it.
- [Shipping psql without psql: a pure-TypeScript Postgres client in neonctl](https://swe.quest/articles/shipping-psql-without-psql-a-pure-typescript-postgres-client-in-neonctl-621e0ac130c536d1.md): Neon · 2026-06-12 · Medium · 7 min read · PostgreSQL, TypeScript, Testing, AI for coding, Developer tools
  neonctl now embeds a pure-TypeScript reimplementation of psql that activates when no native psql is on the PATH.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
