🐘 Query your Postgres Database directly from the Browser.

Overview

Postgres Browser Proxy

Query your Postgres Database directly from the Browser.

Video:
https://youtu.be/ohr9gBPC3cE

Download the latest binaries:
https://github.com/yandeu/postgres-browser-proxy/releases

Add more types to it:
https://docs.rs/postgres/latest/postgres/types/trait.FromSql.html#types

How

The proxy is by default running on port 3000 and is connecting to Postgres on localhost:5432 with user "postgres" and password "mysecretpassword".

# start postgres (using docker)
docker run --name some-postgres -p 5432:5432 -e POSTGRES_PASSWORD=mysecretpassword -d postgres:15-alpine

Windows

 .\postgres-browser-proxy.exe

Linux/MacOS

chmod +x postgres-browser-proxy
./postgres-browser-proxy

CLI Options

Usage: postgres-browser-proxy.exe [OPTIONS]

Options:
      --host <HOST>          [default: localhost]
      --user <USER>          [default: postgres]
      --password <PASSWORD>  [default: mysecretpassword]
      --port <PORT>          [default: 3000]
      --pg-port <PG_PORT>    [default: 5432]
  -h, --help                 Print help information
  -V, --version              Print version information

Example

It looks like this in your client-side javascript.
More examples are in the examples directory.

// @ts-check

// @ts-ignore
import { query } from 'http://localhost:3000/query.js'

// await query(/*sql*/ `DROP TABLE users;`)

await query(/*sql*/ `
  CREATE TABLE IF NOT EXISTS users (
    id SERIAL PRIMARY KEY,
    username VARCHAR(255) NOT NULL,
    age INT,
    created_at TIMESTAMP WITH TIME ZONE DEFAULT now()
  );
`)

await query(/*sql*/ `
  INSERT INTO
    users (username, age)
  VALUES
    ('Macy', 24),
    ('Terry', NULL),
    ('Evan', NULL);
`)

const users = await query(/*sql*/ `SELECT * FROM users;`)
console.log(users)

License

Licensed under GPLv3 Copyright (c) 2022, Yannick Deubel
Please have a look at the LICENSE for more details.

You might also like...
Test the interception/filter of UDP 53 of your local networks or hotspots.

udp53_lookup Test the interception/filter of UDP 53 of your local networks or hotspots. Inspired by BennyThink/UDP53-Filter-Type . What's the purpose?

🔌 A curseforge proxy server, keeping your API key safe and sound.

🔌 CFPROXY - The curseforge proxy server Curseforge has locked down their API and now restricts access without authentification. This spells trouble f

Simple CLI to manage your systemd clash.service and config subscriptions on Linux.
Simple CLI to manage your systemd clash.service and config subscriptions on Linux.

clashrup Simple CLI to manage your systemd clash.service and config subscriptions on Linux. Setup, update, apply overrides, and manage via systemctl.

Easily add metrics to your system -- and actually understand them using automatically customized Prometheus queries
Easily add metrics to your system -- and actually understand them using automatically customized Prometheus queries

Autometrics 📈 ✨ Autometrics is a macro that makes it trivial to add useful metrics to any function in your codebase. Easily understand and debug your

Easily add metrics to your system -- and actually understand them using automatically customized Prometheus queries
Easily add metrics to your system -- and actually understand them using automatically customized Prometheus queries

A Rust macro that makes it easy to understand the error rate, response time, and production usage of any function in your code. Jump from your IDE to

An handy tool that is intended to help your inventory cleanup or dump.

NeosVR Inventory Management Notes to foreign users This readme is written in Japanese. Please use external tool to translate this document into your l

Convert your docker-compose into excalidraw
Convert your docker-compose into excalidraw

excalidocker-rs Rust-based utility to convert docker-compose.yaml files into excalidraw files. Key features Transform your local docker-compose files

Bring the power of pre-signed URLs to your apps. Signway is a gateway for redirecting authentic signed URLs to the requested API
Bring the power of pre-signed URLs to your apps. Signway is a gateway for redirecting authentic signed URLs to the requested API

A gateway that proxies signed requests to other APIs. Check the docs for more info. If you are looking for the managed version checkout this link http

It's like
It's like "docker stats" but with beautiful, real-time charts into your terminal. 📊

📊 ds - Real-time Stats with Terminal Charts Visualize container stats with beautiful, real-time charts directly in your terminal. Why ds? Missing Cha

Owner
Yannick
Building enable3d.io, geckos.io, Nano JSX, Five Server, html2app.dev and node-cli.
Yannick
A simple tool in Rust to split urls in their protocol, host, port, path and query parts.

rexturl A simple tool to split urls in their protocol, host, port, path and query parts. Install cargo install rexturl or clone the source code and r

Volker Schwaberow 3 Oct 22, 2022
SOCKS5 implement library, with some useful utilities such as dns-query, socks5-server, dns2socks, udp-client, etc.

socks5-impl Fundamental abstractions and async read / write functions for SOCKS5 protocol and Relatively low-level asynchronized SOCKS5 server impleme

null 5 Aug 3, 2023
A tool to export TiDB database data to files in cases where the TiDB server can't be restored.

tidb-exporter TiDB uses RocksDB as default storage engine(in fact, TiKV uses it). tidb-exporter can export data from pure RocksDB data files even when

zz 7 Nov 1, 2023
Acts as an IRC server and a nostr client. Connect with your IRC client using your nostr private key as the password.

nostr-irc Acts as an IRC server and a nostr client. Connect with your IRC client using your nostr private key as the password. Experimental code, use

null 11 Dec 26, 2022
Imagine your SSH server only listens on an IPv6 address, and where the last 6 digits are changing every 30 seconds as a TOTP code...

tosh Imagine your SSH server only listens on an IPv6 address, and where the last 6 digits are changing every 30 seconds as a TOTP code... Inspired fro

Mark Vainomaa 409 Oct 23, 2022
A tool to aid in self-hosting. Expose local services on your computer, via a public IPv4 address.

innisfree A tool to aid in self-hosting. Expose local services on your computer, via a public IPv4 address. Why? Most of the data I maintain is local,

Conor Schaefer 7 Mar 19, 2022
Obtain (wildcard) certificates from let's encrypt using dns-01 without the need for API access to your DNS provider.

Agnos Presentation Agnos is a single-binary program allowing you to easily obtain certificates (including wildcards) from Let's Encrypt using DNS-01 c

Arthur Carcano 246 Dec 20, 2022
Automatically updates your Cloudflare DNS records for specific zones. Especially useful if you have dynamic IP address

Cloudflare DNS updater What does it do? Cloudflare DNS updater updates specified dns records for specified zones effortlessly and automatically. It wa

Niko Huuskonen 8 Aug 30, 2022
Userspace libpcap-based tool to mirror your dns traffic

DNS traffic mirroring tool (dns-mirror) Description Userspace libpcap-based tool. dns-mirror sniffs dns packets on the given interface and proxies it

Timofey 1 Mar 15, 2022
[WIP] wadachi scrapes your GitHub Activities.

wadachi wadachi scrapes your GitHub Activities. Usage | Examples | Docs This library is currently under development. Dependencies [dependencies] wadac

Takayuki Maeda 2 Mar 18, 2022