pgweb
Lightweight, web-based PostgreSQL database browser and query tool.
Why consider pgweb?
pgweb is a lightweight, cross-platform web interface for PostgreSQL databases. It runs as a single Go binary with no dependencies, providing schema browsing and SQL query execution.
Learn pgweb by building
Practical setup notes, real use cases, and copy-ready examples in one focused guide.
In this guide11 sections
What is pgweb?
pgweb is an open-source, ultra-lightweight web-based browser for PostgreSQL databases, developed with Go and JavaScript. It operates as a minimal, zero-dependency alternative to heavy database management tools like pgAdmin4 for quick PostgreSQL schema exploration and query execution.
pgweb ships as a single statically compiled Go binary that launches an integrated web server—no Node.js, no Python, no Docker required. Open your browser, and you immediately have a clean PostgreSQL interface for browsing tables, running SQL queries, exporting data, and inspecting schemas.
Who Is It For?
- Developers: Quickly inspecting PostgreSQL schema and data on development servers without installing a full desktop GUI.
- DevOps Engineers: Running a lightweight database browser on cloud servers accessible via SSH port-forwarding.
- Database Administrators: Providing non-technical stakeholders with a simple web interface for read-only database queries.
Key Features
- Single Go binary deployment: No dependencies, runtime, or package manager required.
- Full PostgreSQL compatibility: Connect to any PostgreSQL 9.x+ server including remote production databases.
- Multi-connection bookmarks: Save and switch between multiple database connections.
- SQL query editor with result export: Execute arbitrary SQL and export results as CSV or JSON.
- Schema browser: Inspect tables, columns, indexes, constraints, views, and stored functions.
Installing and Running pgweb
# macOS via Homebrewbrew install pgweb# Linux - direct binary downloadwget https://github.com/sosedoff/pgweb/releases/download/v0.17.0/pgweb_linux_amd64.tar.gztar -xzf pgweb_linux_amd64.tar.gzchmod +x pgweb_linux_amd64./pgweb_linux_amd64Connect to a specific PostgreSQL database at startup:
./pgweb --host localhost --user postgres --db mydb --ssl disableOr using a connection URL:
./pgweb --url "postgresql://user:password@host:5432/dbname?sslmode=disable"pgweb opens at http://localhost:8081 automatically.
Running pgweb with Docker
docker run --rm -p 8081:8081 sosedoff/pgweb --host your-postgres-host --user postgres --db mydb --ssl disablePractical Use Cases
1. Quick Development Database Inspection
A developer SSHes into a staging server and runs pgweb --url $DATABASE_URL, instantly opening a browser interface to inspect production-mirrored data.
2. SSH Port-Forwarded Remote Access
A developer tunnels pgweb through SSH (ssh -L 8081:localhost:8081 myserver), browsing a private production database safely without exposing PostgreSQL ports.
3. Stakeholder Self-Service Reporting
A data team deploys pgweb on an internal server, giving non-technical analysts a web UI to run pre-saved SELECT queries against the reporting database.
Troubleshooting and Limitations
- Read-Only Mode: Use the
--read-onlyflag to prevent users from executing INSERT, UPDATE, or DELETE statements—essential when exposing pgweb to non-administrative users. - Authentication: pgweb itself has no built-in authentication; protect access with an Nginx HTTP Basic Auth reverse proxy or restrict to localhost-only binding.
Official Resources
- GitHub Repository: https://github.com/sosedoff/pgweb
- Documentation: https://sosedoff.github.io/pgweb/
Related tools
More options with a similar category or technology profile.
diskus
Minimal, fast alternative to du -sh written in Rust using multi-threaded directory traversal.
peco
Simplistic interactive filtering tool for Unix pipelines, process lists, and file trees.
Dapr CLI
Command-line tool for managing Dapr distributed application runtime environments and sidecars.
Freeze
Generate beautiful image screenshots and SVGs of code snippets and terminal outputs.