Explore databases, browse schemas, run queries, and export data — all from a single web interface. Install with one command, no web server needed.
A lightweight web-based database management tool for developers. Connect to MySQL, PostgreSQL, or MSSQL databases and work with them from a clean, fast interface.
Especially useful for backend developers and DBAs who need to quickly inspect schemas, run queries, compare databases, export reports, and generate boilerplate code.
Built with Python / FastAPI (backend) and Vue.js 3 (frontend). Designed to be self-hosted, simple, and fast.
curl -fsSL https://raw.githubusercontent.com/cloudpad9/db-viewer-python/main/install.sh | bashThis creates a self-contained installation at ~/.dbviewer/ with its own Python virtual environment. No sudo required.
The installer will prompt you to create an admin username and password on first install.
Then open a new terminal (or source ~/.bashrc) and run:
dbviewerThe app starts at http://localhost:9876.
To update to the latest version:
dbviewer --updateOr directly with curl:
curl -fsSL https://raw.githubusercontent.com/cloudpad9/db-viewer-python/main/update.sh | bashThe update script replaces only the application code — your data directory (~/.dbviewer/data/) and credentials are preserved. If a systemd service is running, it is stopped before the update and restarted automatically afterward.
Python 3.10 or newer.
Check your Python version:
python3 --versiondbviewer [OPTIONS]
Options:
--host HOST Bind address (default: 0.0.0.0)
--port PORT Port number (default: 9876)
--data-dir PATH Data directory (default: ~/.dbviewer/data)
--no-auth Disable authentication
--open Open browser on start
--version Show version and exit
--change-password Change a user's password
--update Update to the latest version from GitHub
Examples:
# Start on a custom port
dbviewer --port 8080
# Start and open browser
dbviewer --open
# Run without login (trusted network)
dbviewer --no-auth
# Change the admin password
dbviewer --change-password
# Update to latest version
dbviewer --updateSchema Exploration — Browse tables across MySQL, PostgreSQL, and MSSQL from a single interface. View table structures, column types, indexes, table sizes, and row counts. Search columns by name or type across selected tables.
SQL Execution — Run arbitrary SQL queries with results displayed as formatted tables. Query autocomplete from table and column names. Query history with recall. Special modes: Explain, Profiling, Last Row, Last Update. Destructive queries require explicit confirmation.
Data Viewing & Editing — View table data with pagination. Edit cells inline by clicking (supported for NAME, TITLE, ALIAS, SHORT_NAME, ORDERING columns). Insert new rows via a dynamic form. Generate and insert fake data for testing.
Table Operations — Rename, clone, truncate, or drop tables. Add, alter, or drop columns. Drop indexes. Visual query builder for common UPDATE/DELETE patterns. All destructive operations support dry-run mode.
Database Comparison — Compare schemas between two database connections. Generate ALTER TABLE patches to sync differences. Copy selected tables or clone entire databases between connections.
Excel Export
— Export query results as formatted .xlsx files. Configure column titles, decimal formatting, summable columns, center alignment, column widths, and sheet separation. Save and recall report configurations.
Code Generation — Generate Vue.js 3 components (list panel + edit form) from table schemas. Export code snippets, column lists, and boilerplate in multiple formats.
AI-Assisted Queries (optional) — Ask questions in natural language about your data. The AI generates SQL queries based on your schema, executes them, and shows results. Generate form layouts from table schemas.
Interface — GitHub-inspired light theme. Monospace response pane. Tabbed interface (Viewer, Operations, Databases, Exporter, Importer, AI Generator). State persists across page refreshes.
Edit ~/.dbviewer/data/connections.json to add your database connections:
[
{
"name": "My MySQL DB",
"type": "mysql",
"server": "localhost",
"port": 3306,
"database": "mydb",
"user": "root",
"password": "secret"
},
{
"name": "My PostgreSQL DB",
"type": "postgres",
"server": "localhost",
"port": 5432,
"database": "mydb",
"user": "postgres",
"password": "secret"
}
]Supported database types: mysql, postgres, mssql.
Restart the server after editing connections.
A typical workflow:
- Start
dbviewerand open it in your browser - Select a database connection from the dropdown
- Browse the table list (shows row counts)
- Select one or more tables
- Use the Viewer tab to explore structure, run queries, view data
- Use the Operations tab for schema changes
- Use the Databases tab to compare or sync schemas
- Use the Exporter tab to generate Excel reports
The app uses stateless Basic Auth with bcrypt-hashed passwords.
- User logs in via a custom login form
- Server verifies credentials against bcrypt hash
- Client stores encoded credentials in localStorage
- Every API request includes credentials — server verifies each time
- No server-side sessions — fully stateless
Change the password at any time:
dbviewer --change-passwordTo disable authentication entirely (e.g. for local-only use):
dbviewer --no-authTo keep dbviewer running in the background:
# /etc/systemd/system/dbviewer.service
[Unit]
Description=DB Viewer
After=network.target
[Service]
Type=simple
User=youruser
ExecStart=/home/youruser/.dbviewer/bin/dbviewer --port 9876
Restart=always
RestartSec=5
[Install]
WantedBy=multi-user.targetsudo systemctl daemon-reload
sudo systemctl enable --now dbviewerFor a full production setup including Cloudflare Tunnel and custom domain, see docs/PRODUCTION_SETUP.md.
All data is stored in ~/.dbviewer/data/ as plain JSON files. No database required for the app itself.
| File | Purpose |
|---|---|
| users.json | User accounts |
| connections.json | Database connection configurations |
| config.json | Optional app settings (AI keys, etc.) |
db-viewer-python/
├── install.sh
├── update.sh
├── pyproject.toml
├── README.md
├── LICENSE
├── docs/
│ ├── SPECS_V1.0.md
│ ├── DEV_SETUP.md
│ └── PRODUCTION_SETUP.md
├── src/
│ └── dbviewer/
│ ├── __init__.py
│ ├── __main__.py
│ ├── cli.py
│ ├── server.py
│ ├── config.py
│ ├── auth.py
│ ├── api.py
│ ├── name_helper.py
│ ├── code_generator.py
│ ├── schema_diff.py
│ ├── excel_export.py
│ ├── drivers/
│ │ ├── __init__.py
│ │ ├── base.py
│ │ ├── mysql.py
│ │ ├── postgres.py
│ │ └── mssql.py
│ └── static/
│ └── index.html
└── tests/
| Document | Description |
|---|---|
| docs/SPECS_V1.0.md | Complete technical specification — every feature, API endpoint, and data format |
| docs/DEV_SETUP.md | Clone the repo, install dependencies, run tests, and manually verify all features locally |
| docs/PRODUCTION_SETUP.md | Deploy as a systemd service, expose via Cloudflare Tunnel with a custom domain |
rm -rf ~/.dbviewerThen remove this line from ~/.bashrc and/or ~/.zshrc:
export PATH="$HOME/.dbviewer/bin:$PATH"Contributions are welcome.
- Fork the repository
- Create a feature branch
- Submit a pull request
MIT License
