autumoswitzerland/Webduck
소개
A self-hosted DuckDB-as-a-Service server with REST API and Web UI.
데이터 및 분석What you can do
- DuckDB storage engine with file-locking for safe concurrent access
- REST API — admin endpoints (project/DB management) + database endpoints (SQL queries)
- Web UI (NiceGUI) — dark mode with yellow/amber theme
- Dashboard — server status cards, live REST traffic monitor (queries/min, active sessions), storage overview with per-project sizes and trash totals
측정된 스타 증가
- in 24h
- +1
- in 7 days
- +1
- in 15 days
- +1
- in 1 month
- +1
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
OriginalWebDuck
A self-hosted DuckDB-as-a-Service server with REST API and Web UI. WebDuck is designed for web hosting providers who want to offer their customers a ready-to-use administration interface for DuckDB databases and data analytics — out of the box, just like the database admin tools that come with any hosting package.
Table of Contents
- Features
- Web UI
- Installation
- DuckDB 2.0 compatibility
- Quick Start
- CLI Commands
- Configuration
- Web UI Pages
- REST API Reference
- Docker
- Architecture
- Database External Access Lock
- Reverse Proxy & HTTPS
- Development
- Donate
- License
- Migration Guide
Features
- DuckDB storage engine with file-locking for safe concurrent access
- REST API — admin endpoints (project/DB management) + database endpoints (SQL queries)
- Web UI (NiceGUI) — dark mode with yellow/amber theme
- Dashboard — server status cards, live REST traffic monitor (queries/min, active sessions), storage overview with per-project sizes and trash totals
- Trash — soft-delete projects/databases with restore, permanent delete per entry, empty trash
- JWT authentication for admin API, optional project-key auth for database access
- Per-database write protection — lock a database to read-only, independent of passwords: passwords control who may access, write protection controls what may be done to the data. It protects the data only — compacting, deleting and managing passwords in the web UI keep working at any time
- Per-database external access lock — disable DuckDB external file/URL access per database (
enable_external_access=false), independent of write protection. New and newly discovered databases are locked by default; existing databases without an explicit setting keep their previous behavior. When locked, file operations such asCOPY,read_csv_auto(),read_parquet(),read_json_auto(), andATTACHare blocked with a clear message - bcrypt password hashing (never plaintext)
- SQL editor — multi-statement support with sequential execution, query history (Alt+Up/Alt+Down, Alt+Enter)
- SQL upload — execute multi-statement SQL scripts from files
- Database compression — reclaims space DuckDB leaves behind after updates/deletes; a hint highlights databases with high fragmentation
- Browse view — tree-based navigation of databases/tables/views with infinite scroll and cell editing
- Import/Export — CSV, Parquet and JSON import via drag & drop, export with browser download
- Project ordering — drag & drop reordering, persisted in
.projects.json - i18n — English (default), German, extensible via PO/Gettext
- Configurable logging — file rotation + console output, independently configurable
- Configurable upload size — max file size for uploads
- FK dependency hints — DROP errors include referenced tables and constraint info
- Docker support out of the box
- YAML configuration
Web UI
Dashboard![]() |
|
Projects![]() |
Browse View![]() |
Installation
pip (Python)
pip install webduck
Docker
# Download docker-compose.yml
curl -O https://raw.githubusercontent.com/autumoswitzerland/Webduck/master/docker-compose.yml
# Set password
export WEBDUCK_ADMIN_PASS=mypassword
# Start - An admin user is created automatically
docker compose up -d
DuckDB 2.0 compatibility
WebDuck 2.0 requires DuckDB 2.0 LTS (duckdb>=2.0,<2.1).
- Existing databases stay readable. DuckDB 2.0 opens DuckDB 1.x files without conversion and preserves their storage version when writing to them. Those files therefore remain readable by WebDuck 1.5.x.
- New files use storage version 69. Databases created by WebDuck 2.0 use DuckDB 2.0's default storage format. Compacting a database also rebuilds the file, so compacting an older database upgrades it to the 2.0 format; after that it can no longer be opened by WebDuck 1.5.x.
- Linux x86_64 needs AVX2. Official DuckDB 2.0 wheels for Linux x86_64 are built with AVX2 instructions. Docker inherits the host CPU, so an AVX1-only host cannot run WebDuck 2.0. Use the WebDuck 1.5.x line there. macOS x86_64 and arm64 are not affected.
For version upgrade notes, see MIGRATION.md.
Quick Start
pip
# Initialize - Create an admin user
webduck init
# Create additional admin users (optional)
webduck user add anna secret
# Start server
webduck start
Docker
Docker starts automatically — UI at http://localhost:8998/ui/login.
Log in with admin and the password you set.
CLI Commands
| Command | Description |
|---|---|
webduck init |
Create admin user + default config |
webduck user add <name> <password> |
Create an additional admin user |
webduck user list |
List all admin users |
webduck user delete <name> |
Delete an admin user (removes prefs + query history) |
webduck start |
Start the server |
webduck status |
Show projects and databases |
Options:
webduck start --host 127.0.0.1 --port 8080 --config /path/to/webduck.yaml
webduck user add anna secret
webduck user add anna secret --config /path/to/webduck.yaml
Configuration
webduck.yaml (generated by webduck init):
icon: "icon.svg"
auth:
jwt_algorithm: HS256
jwt_expire_minutes: 60
jwt_secret: CHANGE-ME-TO-A-SECRET-KEY-IN-PRODUCTION
logging:
file:
enabled: true
level: error
max_files: 5
max_size_mb: 10
query_log: false
log_dir: log
console:
enabled: false
access_log: false
level: warning
server:
data_dir: data
host: 0.0.0.0
port: 8998
max_upload_mb: 256
import_export_root: "" # empty = data_dir; allowed root for REST server-path import/export
Security note: Before deploying WebDuck in production, replace
jwt_secretinwebduck.yamlwith a long, random secret (e.g. generated withopenssl rand -base64 48). The placeholder valueCHANGE-ME-TO-A-SECRET-KEY-IN-PRODUCTIONmust never be used in production — anyone who knows the secret can forge admin tokens.
Web UI Pages
| Page | URL | Description |
|---|---|---|
| Login | /ui/login |
Admin login with language selection |
| Dashboard | /ui/dashboard |
Server status, live traffic monitor (queries/min, active sessions), storage overview |
| Projects | /ui/projects |
Create/delete projects, manage databases, set passwords, write protection, external access lock, drag & drop reorder, database sizes + compression hint |
| Queries | /ui/query |
SQL editor (multi-statement) + SQL file upload, query history (Alt+Up/Alt+Down) |
| Browse | /ui/browse |
Tree navigation, table/view browsing with infinite scroll, cell editing |
| Import/Export | /ui/import |
CSV, Parquet and JSON import (drag & drop) and export (browser download) |
| Trash | /ui/trash |
Restore soft-deleted projects/databases, empty the trash |
REST API Reference
Admin API (JWT protected)
All admin endpoints require Authorization: Bearer <jwt_token>. Tokens are
signed with the jwt_secret from webduck.yaml — make sure you replaced the
placeholder before going to production (see the security note above).
| Method | Endpoint | Description |
|---|---|---|
POST |
/admin/login |
Login, returns JWT token |
GET |
/admin/projects |
List all projects (ordered) |
POST |
/admin/projects |
Create project |
DELETE |
/admin/projects/{project} |
Delete project + all databases |
POST |
/admin/reorder-projects |
Reorder projects |
GET |
/admin/projects/{project}/databases |
List databases in project |
POST |
/admin/projects/{project}/databases |
Create database |
DELETE |
/admin/projects/{project}/databases/{db} |
Delete database |
PUT |
/admin/projects/{project}/databases/{db}/password |
Set database password |
PUT |
/admin/projects/{project}/databases/{db}/write-protection |
Enable/disable write protection (read-only) |
PUT |
/admin/projects/{project}/databases/{db}/external-access |
Enable/disable DuckDB external file/URL access |
GET |
/admin/users |
List admin users |
POST |
/admin/users |
Create admin user |
DELETE |
/admin/users/{username} |
Delete admin user |
Database API (project-key protected)
All database endpoints require X-Project-Key: <project>:<password>.
Databases without a password set are publicly accessible.
| Method | Endpoint | Description |
|---|---|---|
GET |
/db/projects |
List all projects (public) |
GET |
/db/projects/{project}/databases |
List databases (public) |
POST |
/db/projects/{project}/databases/{db}/query |
Execute SQL (read-only) |
POST |
/db/projects/{project}/databases/{db}/write |
Execute SQL (read-write) |
GET |
/db/projects/{project}/databases/{db}/tables |
List tables + columns |
POST |
/db/projects/{project}/databases/{db}/import/{tbl} |
Import CSV/Parquet/JSON |
GET |
/db/projects/{project}/databases/{db}/export/{tbl} |
Export table to CSV/Parquet/JSON |
REST import/export paths: Caller-supplied server paths for REST import/export must resolve inside
server.import_export_root. Ifserver.import_export_rootis empty (default), the allowed root isdata_dir. This does not affect the Web UI, which uses managed upload/download temp files.
Example: Login + Query
# Login
TOKEN=$(curl -s -X POST http://localhost:8998/admin/login \
-H "Content-Type: application/json" \
-d '{"username":"admin","password":"secret"}' | jq -r '.token')
# Create project + database
curl -X POST http://localhost:8998/admin/projects \
-H "Authorization: Bearer $TOKEN" \
-d '{"name":"myapp"}'
curl -X POST http://localhost:8998/admin/projects/myapp/databases \
-H "Authorization: Bearer $TOKEN" \
-d '{"name":"main"}'
# Execute a query via the Database API (no password yet = open)
curl -X POST http://localhost:8998/db/projects/myapp/databases/main/write \
-H "Content-Type: application/json" \
-d '{"sql":"CREATE TABLE users (id INT, name VARCHAR); INSERT INTO users VALUES (1, '\''Alice'\'');"}'
# Read (without password — no header needed)
curl -X POST http://localhost:8998/db/projects/myapp/databases/main/query \
-d '{"sql":"SELECT * FROM users"}'
# Set database password (optional — without password, API is open)
curl -X PUT http://localhost:8998/admin/projects/myapp/databases/main/password \
-H "Authorization: Bearer $TOKEN" \
-d '{"password":"dbpass","access_level":"write"}'
# Read (with password)
curl -X POST http://localhost:8998/db/projects/myapp/databases/main/query \
-H "X-Project-Key: myapp:dbpass" \
-d '{"sql":"SELECT * FROM users"}'
Docker
Run WebDuck with Docker Compose:
docker compose up -d
WebDuck stores its data in /app/data inside the container. The provided Docker Compose configuration persists this data using the webduck_data volume.
Initialize with:
docker compose exec webduck webduck init
Architecture
FastAPI ──┬── /admin/* (JWT auth) → Project/DB management
├── /db/* (project key) → SQL queries + CSV/Parquet/JSON import/export
├── /ui/* (cookie) → NiceGUI Web UI
├── /api/* (session) → Internal UI endpoints
└── /health → Health check
- Storage: DuckDB files in
data/<project>/<database>.duckdb - Project order: Persisted in
data/.projects.json - Reserved name:
trashis reserved for the soft-delete trash directory — a project directory namedtrashis not listed as a project - Auth: Admin passwords in
data/.users.json(bcrypt), DB passwords indata/<project>/.project.json - Write protection: Per-database read-only flag in
data/<project>/.project.json; a protected database is always opened read-only by the engine - External access lock: Per-database
external_accessflag indata/<project>/.project.json; DuckDBenable_external_accessis set per connection. New DBs default to locked, legacy DBs keep prior behavior, newly discovered DB files default to locked - User preferences: Stored in
data/.user_preferences.json - Logging: Rotated log files in
log/(configurable), independent console logging - Concurrency: Per-file reader-writer locks — parallel reads, exclusive writes (DuckDB single-writer model)
Database External Access Lock
WebDuck 2.1.0 adds a per-database lock for DuckDB external file/URL access.
The lock is controlled by enable_external_access on DuckDB connections and is
configured per database in data/<project>/.project.json:
{
"databases": {
"mydb": {
"write_protected": false,
"external_access": false
}
}
}
Behavior
- Independent of write protection:
external_accessonly controls DuckDB external file/URL access.write_protectedonly controls data writes. Both settings can be combined. - New databases: Databases created by WebDuck default to
external_access=false(locked). - Existing databases (legacy): If a database existed before 2.1.0 and has
no explicit
external_accesssetting, WebDuck keeps the previous behavior on first 2.1.0 access by migrating it toexternal_access=true. The project is marked with_external_access_migratedin.project.json. - Newly discovered database files: If a
.duckdbfile appears in a project directory after migration and has no explicit setting, WebDuck treats it as locked (external_access=false) until an admin explicitly enables it.
What is blocked when locked
When external access is locked, DuckDB operations that access external files/URLs are blocked, including for example:
COPY ... TO/FROM ...read_csv_auto(...),read_csv(...)read_parquet(...)read_json_auto(...),read_json(...)read_text(...)ATTACH ...
When the protection is active (amber in the GUI, external_access=false), the
database remains usable for normal SQL on tables inside the DuckDB file
(for example SELECT, INSERT, UPDATE, DELETE, CREATE TABLE). Only
operations that make DuckDB access files or URLs outside the database are
blocked.
GUI restrictions when protection is active:
- Import/Export page: File-based CSV, Parquet, and JSON import/export is blocked. The GUI shows a clear error/notification.
- SQL editor / Query page: SQL containing external file/URL functions such
as
COPY ... TO/FROM,read_csv_auto(),read_parquet(),read_json_auto(),read_text(), orATTACHis blocked. Normal SQL on tables inside the database still works. - SQL upload: SQL scripts that contain such external file operations are blocked in the same way.
Not restricted by this protection: Normal browsing/querying/editing of data inside the database, and management/maintenance functions such as compaction, write protection toggle, external access toggle, and project/database management. Write protection remains independent.
REST API behavior when protection is active:
SQL endpoints:
POST /db/projects/{project}/databases/{db}/queryandPOST /db/projects/{project}/databases/{db}/writereturn HTTP403witherror_code="external_access_blocked"when the executed SQL contains external file/URL functions such asCOPY ... TO/FROM,read_csv_auto(),read_parquet(),read_json_auto(),read_text(), orATTACH.Import/export endpoints: File-based CSV, Parquet, and JSON import/export is blocked:
POST /db/projects/{project}/databases/{db}/import/{table_name}?path=...&format=...GET /db/projects/{project}/databases/{db}/export/{table_name}?path=...&format=...
These calls also return HTTP
403. To run file-based import/export, enable external access for the affected database first.
There is no bypass through the Web UI or REST API.
Errors
- Web UI: Shows a clear notification/message that external file access is disabled for the database.
- REST API: Returns HTTP
403with a clean JSON error detail. Query responses also includeerror_code="external_access_blocked".
Maintenance
Internal maintenance operations continue to work when external access is locked. In particular, database compaction remains available.
REST import/export server paths
For REST endpoints that accept caller-supplied server paths (import/export
with path=...), WebDuck validates the resolved path against
server.import_export_root:
server:
import_export_root: "" # empty = data_dir
- Empty/default: only paths inside
data_dirare allowed. - Set to an absolute path: only paths inside that directory are allowed.
- Paths outside the allowed root are rejected with HTTP
403.
This validation applies to caller-supplied REST server paths. It does not block the normal Web UI upload/download flow, which uses managed temporary files.
Reverse Proxy & HTTPS
WebDuck has no built-in TLS support. For running over HTTPS, put a reverse proxy in front that terminates TLS and forwards requests to WebDuck (default port 8998).
WebDuck will continue to run over HTTP; the proxy handles certificates and HTTPS.
Nginx
server {
listen 443 ssl http2;
server_name webduck.example.com;
ssl_certificate /etc/letsencrypt/live/webduck.example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/webduck.example.com/privkey.pem;
location / {
proxy_pass http://127.0.0.1:8998;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}
server {
listen 80;
server_name webduck.example.com;
return 301 https://$host$request_uri;
}
NiceGUI uses WebSockets, so the
UpgradeandConnectionheaders must be set as shown above.
Caddy (automatic Let's Encrypt)
webduck.example.com {
reverse_proxy localhost:8998
}
Caddy automatically obtains and renews TLS certificates.
Traefik (Docker)
services:
webduck:
image: autumoswitzerland/webduck
volumes:
- webduck_data:/app/data
labels:
- "traefik.enable=true"
- "traefik.http.routers.webduck.rule=Host(`webduck.example.com`)"
- "traefik.http.routers.webduck.entrypoints=websecure"
- "traefik.http.routers.webduck.tls.certresolver=letsencrypt"
- "traefik.http.services.webduck.loadbalancer.server.port=8998"
Directly with Uvicorn (optional)
If you want WebDuck to serve TLS directly, you can run Uvicorn manually with certificate files. The webduck start command does not currently pass through SSL options:
uvicorn webduck.main:fastapi_app \
--host 0.0.0.0 \
--port 8998 \
--ssl-keyfile /path/to/key.pem \
--ssl-certfile /path/to/cert.pem
For production deployments, a reverse proxy is generally simpler and more secure than terminating TLS directly in WebDuck.
Development
git clone https://github.com/autumoswitzerland/Webduck.git
cd webduck
python3.13 -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"
# Run tests
pytest tests/
# Run linter
ruff check src/ tests/
Donate
WebDuck is free and open-source. If you find it useful, consider supporting the development:
License
WebDuck is licensed under the GNU Affero General Public License v3.0 (AGPLv3) — see LICENSE for details.
Copyright © 2026 autumo GmbH
관련 프로젝트 살펴보기
불러오는 중…


