webduck 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. webduck-1.0.0/.github/workflows/publish-docker.yml +52 -0
  2. webduck-1.0.0/.github/workflows/publish-py.yml +30 -0
  3. webduck-1.0.0/.gitignore +72 -0
  4. webduck-1.0.0/.project +28 -0
  5. webduck-1.0.0/.pydevproject +5 -0
  6. webduck-1.0.0/.python-version +1 -0
  7. webduck-1.0.0/Dockerfile +31 -0
  8. webduck-1.0.0/LICENSE +21 -0
  9. webduck-1.0.0/PKG-INFO +306 -0
  10. webduck-1.0.0/README.md +273 -0
  11. webduck-1.0.0/bin/.gitignore +2 -0
  12. webduck-1.0.0/bin/init.sh +27 -0
  13. webduck-1.0.0/bin/setup.sh +71 -0
  14. webduck-1.0.0/bin/setup_demo.sh +90 -0
  15. webduck-1.0.0/bin/start.sh +27 -0
  16. webduck-1.0.0/bin/status.sh +27 -0
  17. webduck-1.0.0/docker-compose.yml +18 -0
  18. webduck-1.0.0/entrypoint.sh +19 -0
  19. webduck-1.0.0/pyproject.toml +61 -0
  20. webduck-1.0.0/scripts/compile_translations.py +36 -0
  21. webduck-1.0.0/scripts/demo_analytics.sql +23 -0
  22. webduck-1.0.0/scripts/demo_setup.sql +152 -0
  23. webduck-1.0.0/src/webduck/__init__.py +1 -0
  24. webduck-1.0.0/src/webduck/api/__init__.py +1 -0
  25. webduck-1.0.0/src/webduck/api/admin.py +371 -0
  26. webduck-1.0.0/src/webduck/api/db.py +357 -0
  27. webduck-1.0.0/src/webduck/auth/__init__.py +2 -0
  28. webduck-1.0.0/src/webduck/auth/manager.py +261 -0
  29. webduck-1.0.0/src/webduck/cli.py +49 -0
  30. webduck-1.0.0/src/webduck/config.py +192 -0
  31. webduck-1.0.0/src/webduck/i18n.py +191 -0
  32. webduck-1.0.0/src/webduck/locales/de/LC_MESSAGES/messages.mo +0 -0
  33. webduck-1.0.0/src/webduck/locales/de/messages.po +355 -0
  34. webduck-1.0.0/src/webduck/locales/en/LC_MESSAGES/messages.mo +0 -0
  35. webduck-1.0.0/src/webduck/locales/en/messages.po +355 -0
  36. webduck-1.0.0/src/webduck/logging.py +207 -0
  37. webduck-1.0.0/src/webduck/main.py +580 -0
  38. webduck-1.0.0/src/webduck/pages/__init__.py +12 -0
  39. webduck-1.0.0/src/webduck/pages/browse.py +893 -0
  40. webduck-1.0.0/src/webduck/pages/context.py +90 -0
  41. webduck-1.0.0/src/webduck/pages/dashboard.py +96 -0
  42. webduck-1.0.0/src/webduck/pages/import_export.py +366 -0
  43. webduck-1.0.0/src/webduck/pages/login.py +139 -0
  44. webduck-1.0.0/src/webduck/pages/projects.py +564 -0
  45. webduck-1.0.0/src/webduck/pages/query.py +459 -0
  46. webduck-1.0.0/src/webduck/pages/ui_helpers.py +198 -0
  47. webduck-1.0.0/src/webduck/pages/user_prefs.py +97 -0
  48. webduck-1.0.0/src/webduck/static/favicon.ico +0 -0
  49. webduck-1.0.0/src/webduck/static/footer-logo.png +0 -0
  50. webduck-1.0.0/src/webduck/static/icon.png +0 -0
  51. webduck-1.0.0/src/webduck/static/icon.svg +18 -0
  52. webduck-1.0.0/src/webduck/static/screen_browse.webp +0 -0
  53. webduck-1.0.0/src/webduck/static/screen_csv.webp +0 -0
  54. webduck-1.0.0/src/webduck/static/screen_projects.webp +0 -0
  55. webduck-1.0.0/src/webduck/static/screen_sql.webp +0 -0
  56. webduck-1.0.0/src/webduck/storage/__init__.py +2 -0
  57. webduck-1.0.0/src/webduck/storage/engine.py +495 -0
  58. webduck-1.0.0/src/webduck/ui/__init__.py +2 -0
  59. webduck-1.0.0/tests/__init__.py +0 -0
  60. webduck-1.0.0/tests/conftest.py +82 -0
  61. webduck-1.0.0/tests/duckdb_objects.sql +166 -0
  62. webduck-1.0.0/tests/test_api_admin.py +192 -0
  63. webduck-1.0.0/tests/test_api_db.py +164 -0
  64. webduck-1.0.0/tests/test_auth.py +79 -0
  65. webduck-1.0.0/tests/test_config.py +41 -0
  66. webduck-1.0.0/tests/test_logging.py +61 -0
  67. webduck-1.0.0/tests/test_sql_upload.py +291 -0
  68. webduck-1.0.0/tests/test_storage.py +107 -0
  69. webduck-1.0.0/webduck.yaml +33 -0
@@ -0,0 +1,52 @@
1
+ name: Publish Docker Image
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - "v*"
7
+
8
+ jobs:
9
+ docker:
10
+ runs-on: ubuntu-latest
11
+ permissions:
12
+ contents: read
13
+ packages: write
14
+ steps:
15
+ - uses: actions/checkout@v4
16
+
17
+ - name: Docker meta
18
+ id: meta
19
+ uses: docker/metadata-action@v5
20
+ with:
21
+ images: |
22
+ autumoswitzerland/webduck
23
+ ghcr.io/autumoswitzerland/webduck
24
+ tags: |
25
+ type=semver,pattern={{version}}
26
+ type=semver,pattern={{major}}.{{minor}}
27
+
28
+ - name: Login to Docker Hub
29
+ uses: docker/login-action@v3
30
+ with:
31
+ username: ${{ secrets.DOCKERHUB_USERNAME }}
32
+ password: ${{ secrets.DOCKERHUB_TOKEN }}
33
+
34
+ - name: Login to GitHub Container Registry
35
+ uses: docker/login-action@v3
36
+ with:
37
+ registry: ghcr.io
38
+ username: ${{ github.actor }}
39
+ password: ${{ secrets.GITHUB_TOKEN }}
40
+
41
+ - name: Set up Docker Buildx
42
+ uses: docker/setup-buildx-action@v3
43
+
44
+ - name: Build and push
45
+ uses: docker/build-push-action@v6
46
+ with:
47
+ context: .
48
+ push: true
49
+ tags: ${{ steps.meta.outputs.tags }}
50
+ labels: ${{ steps.meta.outputs.labels }}
51
+ cache-from: type=gha
52
+ cache-to: type=gha,mode=max
@@ -0,0 +1,30 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - "v*"
7
+
8
+ jobs:
9
+ build-and-publish:
10
+ runs-on: ubuntu-latest
11
+ environment:
12
+ name: pypi
13
+ url: https://pypi.org/p/webduck
14
+ permissions:
15
+ id-token: write
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+
19
+ - uses: actions/setup-python@v5
20
+ with:
21
+ python-version: "3.12"
22
+
23
+ - name: Install build tools
24
+ run: pip install build
25
+
26
+ - name: Build package
27
+ run: python -m build
28
+
29
+ - name: Publish to PyPI
30
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,72 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.so
6
+ .Python
7
+ build/
8
+ develop-eggs/
9
+ dist/
10
+ downloads/
11
+ eggs/
12
+ .eggs/
13
+ lib/
14
+ lib64/
15
+ parts/
16
+ sdist/
17
+ var/
18
+ wheels/
19
+ *.egg-info/
20
+ .installed.cfg
21
+ *.egg
22
+
23
+ # Virtual environments
24
+ .venv/
25
+ venv/
26
+ ENV/
27
+ env/
28
+
29
+ # IDE
30
+ .vscode/
31
+ .idea/
32
+ *.swp
33
+ *.swo
34
+ *~
35
+
36
+ # Testing
37
+ .pytest_cache/
38
+ .coverage
39
+ htmlcov/
40
+ .tox/
41
+ .nox/
42
+
43
+ # mypy
44
+ .mypy_cache/
45
+
46
+ # ruff
47
+ .ruff_cache/
48
+
49
+ # Generated translations (compiled from .po files)
50
+ locales/*/LC_MESSAGES/
51
+ locales/*/LC_MESSAGES/*.mo
52
+
53
+ # Runtime data
54
+ data/
55
+ *.duckdb
56
+ *.duckdb.wal
57
+
58
+ # Config
59
+ *.yaml.local
60
+ *.env
61
+ .env.local
62
+
63
+ # OS
64
+ .DS_Store
65
+ Thumbs.db
66
+
67
+ # Git
68
+ .git/
69
+ /TODO.txt
70
+ /.nicegui/
71
+ /webduck-dev.yaml
72
+ /log/
webduck-1.0.0/.project ADDED
@@ -0,0 +1,28 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <projectDescription>
3
+ <name>WebDuck</name>
4
+ <comment></comment>
5
+ <projects>
6
+ </projects>
7
+ <buildSpec>
8
+ <buildCommand>
9
+ <name>org.eclipse.wst.validation.validationbuilder</name>
10
+ <arguments>
11
+ </arguments>
12
+ </buildCommand>
13
+ <buildCommand>
14
+ <name>org.eclipse.dltk.core.scriptbuilder</name>
15
+ <arguments>
16
+ </arguments>
17
+ </buildCommand>
18
+ <buildCommand>
19
+ <name>org.eclipse.wst.common.project.facet.core.builder</name>
20
+ <arguments>
21
+ </arguments>
22
+ </buildCommand>
23
+ </buildSpec>
24
+ <natures>
25
+ <nature>org.eclipse.wst.common.project.facet.core.nature</nature>
26
+ <nature>org.python.pydev.pythonNature</nature>
27
+ </natures>
28
+ </projectDescription>
@@ -0,0 +1,5 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <?eclipse-pydev version="1.0"?><pydev_project>
3
+ <pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">Default</pydev_property>
4
+ <pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python interpreter</pydev_property>
5
+ </pydev_project>
@@ -0,0 +1 @@
1
+ 3.11.14
@@ -0,0 +1,31 @@
1
+ FROM python:3.12-slim
2
+
3
+ WORKDIR /app
4
+
5
+ # Install system dependencies
6
+ RUN apt-get update && apt-get install -y --no-install-recommends \
7
+ build-essential \
8
+ && rm -rf /var/lib/apt/lists/*
9
+
10
+ # Copy project files
11
+ COPY pyproject.toml README.md ./
12
+ COPY src/ src/
13
+ COPY entrypoint.sh /entrypoint.sh
14
+
15
+ # Install the package
16
+ RUN pip install --no-cache-dir .
17
+
18
+ # Make entrypoint executable
19
+ RUN chmod +x /entrypoint.sh
20
+
21
+ # Create data directory
22
+ RUN mkdir -p /data
23
+
24
+ # Expose port
25
+ EXPOSE 8998
26
+
27
+ # Volume for persistent data
28
+ VOLUME ["/data"]
29
+
30
+ ENTRYPOINT ["/entrypoint.sh"]
31
+ CMD ["webduck", "start", "--host", "0.0.0.0", "--port", "8998"]
webduck-1.0.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 autumo GmbH
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
webduck-1.0.0/PKG-INFO ADDED
@@ -0,0 +1,306 @@
1
+ Metadata-Version: 2.4
2
+ Name: webduck
3
+ Version: 1.0.0
4
+ Summary: A DuckDB server with REST API and Web UI
5
+ Author-email: autumo GmbH <info@autumo.ch>
6
+ License-Expression: MIT
7
+ License-File: LICENSE
8
+ Keywords: api,database,duckdb,server
9
+ Classifier: Development Status :: 3 - Alpha
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Programming Language :: Python :: 3.11
13
+ Classifier: Programming Language :: Python :: 3.12
14
+ Classifier: Programming Language :: Python :: 3.13
15
+ Classifier: Topic :: Database
16
+ Classifier: Topic :: Software Development :: Libraries
17
+ Requires-Python: >=3.11
18
+ Requires-Dist: babel>=2.14.0
19
+ Requires-Dist: bcrypt>=4.1.0
20
+ Requires-Dist: click>=8.0
21
+ Requires-Dist: duckdb>=1.0.0
22
+ Requires-Dist: fastapi>=0.115.0
23
+ Requires-Dist: nicegui>=2.0.0
24
+ Requires-Dist: pyjwt>=2.8.0
25
+ Requires-Dist: python-multipart>=0.0.7
26
+ Requires-Dist: pyyaml>=6.0
27
+ Requires-Dist: uvicorn[standard]>=0.30.0
28
+ Provides-Extra: dev
29
+ Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
30
+ Requires-Dist: pytest>=8.0; extra == 'dev'
31
+ Requires-Dist: ruff>=0.5.0; extra == 'dev'
32
+ Description-Content-Type: text/markdown
33
+
34
+ <div align="center">
35
+ <img src="src/webduck/static/icon.svg" width="128">
36
+ <h1>WebDuck</h1>
37
+
38
+ A self-hosted DuckDB-as-a-Service server with REST API and Web UI.
39
+ WebDuck is designed for web hosting providers who want to offer their customers
40
+ a ready-to-use administration interface for DuckDB databases and data analytics
41
+ — out of the box, just like the database admin tools that come with any hosting package.
42
+
43
+ <img src="https://img.shields.io/badge/version-1.0.0-FFD54F">
44
+ <img src="https://img.shields.io/badge/license-MIT-green">
45
+ <img src="https://img.shields.io/badge/python-3.11+-blue">
46
+
47
+ <br><br>
48
+ <a href="https://webduck.autumo.ch">Website</a> ·
49
+ <a href="https://github.com/autumoswitzerland/Webduck/issues">Issues</a> ·
50
+ <a href="https://github.com/autumoswitzerland/Webduck/blob/main/LICENSE">License</a>
51
+ </div>
52
+
53
+ ## Features
54
+
55
+ - **DuckDB storage engine** with file-locking for safe concurrent access
56
+ - **REST API** — admin endpoints (project/DB management) + database endpoints (SQL queries)
57
+ - **Web UI** (NiceGUI) — dark mode with yellow/amber theme
58
+ - **JWT authentication** for admin API, optional project-key auth for database access
59
+ - **bcrypt password hashing** (never plaintext)
60
+ - **SQL editor** — multi-statement support with sequential execution
61
+ - **SQL upload** — execute multi-statement SQL scripts from files
62
+ - **Browse view** — tree-based navigation of databases/tables/views with infinite scroll and cell editing
63
+ - **Import/Export** — CSV import via drag & drop, CSV export with browser download
64
+ - **Project ordering** — drag & drop reordering, persisted in `.projects.json`
65
+ - **i18n** — English (default), German, extensible via PO/Gettext
66
+ - **Configurable logging** — file rotation + console output, independently configurable
67
+ - **Configurable upload size** — max file size for CSV/SQL uploads
68
+ - **FK dependency hints** — DROP errors include referenced tables and constraint info
69
+ - **Docker** support out of the box
70
+ - **YAML configuration**
71
+
72
+ ## Web UI
73
+
74
+ <table>
75
+ <tr>
76
+ <td align="center"><strong>Projects</strong><br><a href="src/webduck/static/screen_projects.webp"><img src="src/webduck/static/screen_projects.webp" width="450"></a></td>
77
+ <td align="center"><strong>Browse View</strong><br><a href="src/webduck/static/screen_browse.webp"><img src="src/webduck/static/screen_browse.webp" width="450"></a></td>
78
+ </tr>
79
+ </table>
80
+
81
+ ## Installation
82
+
83
+ ### pip (Python)
84
+
85
+ ```bash
86
+ pip install webduck
87
+ ```
88
+
89
+ ### Docker
90
+
91
+ ```bash
92
+ # docker-compose.yml herunterladen
93
+ curl -O https://raw.githubusercontent.com/autumoswitzerland/Webduck/main/docker-compose.yml
94
+
95
+ # Passwort setzen
96
+ export WEBDUCK_ADMIN_PASS=meinpasswort
97
+
98
+ # Starten (Admin-User wird automatisch angelegt)
99
+ docker compose up -d
100
+ ```
101
+
102
+ ## Quick Start
103
+
104
+ ### pip
105
+
106
+ ```bash
107
+ # Initialisieren (Admin-User anlegen)
108
+ webduck init
109
+
110
+ # Server starten
111
+ webduck start
112
+ ```
113
+
114
+ ### Docker
115
+
116
+ Docker startet automatisch — UI unter `http://localhost:8998/ui/login`.
117
+ Login mit `admin` / dem gesetzten Passwort.
118
+
119
+ ## CLI Commands
120
+
121
+ | Command | Description |
122
+ |---------|-------------|
123
+ | `webduck init` | Create admin user + default config |
124
+ | `webduck start` | Start the server |
125
+ | `webduck status` | Show projects and databases |
126
+
127
+ Options:
128
+
129
+ ```bash
130
+ webduck start --host 127.0.0.1 --port 8080 --config /path/to/webduck.yaml
131
+ ```
132
+
133
+ ## Configuration
134
+
135
+ `webduck.yaml` (generated by `webduck init`):
136
+
137
+ ```yaml
138
+ version: "1.0.0"
139
+ icon: "icon.svg"
140
+ auth:
141
+ jwt_algorithm: HS256
142
+ jwt_expire_minutes: 60
143
+ jwt_secret: CHANGE-ME-TO-A-SECRET-KEY-IN-PRODUCTION
144
+ logging:
145
+ file:
146
+ enabled: true
147
+ level: error
148
+ max_files: 5
149
+ max_size_mb: 10
150
+ query_log: false
151
+ log_dir: log
152
+ console:
153
+ enabled: false
154
+ access_log: false
155
+ level: warning
156
+ server:
157
+ data_dir: data
158
+ host: 0.0.0.0
159
+ port: 8998
160
+ max_upload_mb: 5
161
+ ```
162
+
163
+ ## Web UI Pages
164
+
165
+ | Page | URL | Description |
166
+ |------|-----|-------------|
167
+ | Login | `/ui/login` | Admin login with language selection |
168
+ | Dashboard | `/ui/dashboard` | Server status, project/database overview |
169
+ | Projects | `/ui/projects` | Create/delete projects, manage databases, set passwords, drag & drop reorder |
170
+ | Queries | `/ui/query` | SQL editor (multi-statement) + SQL file upload |
171
+ | Browse | `/ui/browse` | Tree navigation, table/view browsing with infinite scroll, cell editing |
172
+ | Import/Export | `/ui/import` | CSV import (drag & drop) and export (browser download) |
173
+
174
+ ## REST API Reference
175
+
176
+ ### Admin API (JWT protected)
177
+
178
+ All admin endpoints require `Authorization: Bearer <jwt_token>`.
179
+
180
+ | Method | Endpoint | Description |
181
+ |--------|----------|-------------|
182
+ | `POST` | `/admin/login` | Login, returns JWT token |
183
+ | `GET` | `/admin/projects` | List all projects (ordered) |
184
+ | `POST` | `/admin/projects` | Create project |
185
+ | `DELETE` | `/admin/projects/{project}` | Delete project + all databases |
186
+ | `POST` | `/admin/reorder-projects` | Reorder projects |
187
+ | `GET` | `/admin/projects/{project}/databases` | List databases in project |
188
+ | `POST` | `/admin/projects/{project}/databases` | Create database |
189
+ | `DELETE` | `/admin/projects/{project}/databases/{db}` | Delete database |
190
+ | `PUT` | `/admin/projects/{project}/databases/{db}/password` | Set database password |
191
+ | `GET` | `/admin/users` | List admin users |
192
+ | `POST` | `/admin/users` | Create admin user |
193
+ | `DELETE` | `/admin/users/{username}` | Delete admin user |
194
+
195
+ ### Database API (project-key protected)
196
+
197
+ All database endpoints require `X-Project-Key: <project>:<password>`.
198
+ Databases without a password set are publicly accessible.
199
+
200
+ | Method | Endpoint | Description |
201
+ |--------|----------|-------------|
202
+ | `GET` | `/db/projects` | List all projects (public) |
203
+ | `GET` | `/db/projects/{project}/databases` | List databases (public) |
204
+ | `POST` | `/db/projects/{project}/databases/{db}/query` | Execute SQL (read-only) |
205
+ | `POST` | `/db/projects/{project}/databases/{db}/write` | Execute SQL (read-write) |
206
+ | `GET` | `/db/projects/{project}/databases/{db}/tables` | List tables + columns |
207
+ | `POST` | `/db/projects/{project}/databases/{db}/import` | Import CSV |
208
+ | `GET` | `/db/projects/{project}/databases/{db}/export` | Export table to CSV |
209
+
210
+ ### Example: Login + Query
211
+
212
+ ```bash
213
+ # Login
214
+ TOKEN=$(curl -s -X POST http://localhost:8998/admin/login \
215
+ -H "Content-Type: application/json" \
216
+ -d '{"username":"admin","password":"secret"}' | jq -r '.access_token')
217
+
218
+ # Create project + database
219
+ curl -X POST http://localhost:8998/admin/projects \
220
+ -H "Authorization: Bearer $TOKEN" \
221
+ -d '{"name":"myapp"}'
222
+
223
+ curl -X POST http://localhost:8998/admin/projects/myapp/databases \
224
+ -H "Authorization: Bearer $TOKEN" \
225
+ -d '{"name":"main"}'
226
+
227
+ # Set database password (optional — without password, API is open)
228
+ curl -X PUT http://localhost:8998/admin/projects/myapp/databases/main/password \
229
+ -H "Authorization: Bearer $TOKEN" \
230
+ -d '{"password":"dbpass","access_level":"write"}'
231
+
232
+ # Execute a query via the Database API
233
+ curl -X POST http://localhost:8998/db/projects/myapp/databases/main/write \
234
+ -H "X-Project-Key: myapp:dbpass" \
235
+ -H "Content-Type: application/json" \
236
+ -d '{"sql":"CREATE TABLE users (id INT, name VARCHAR); INSERT INTO users VALUES (1, '\''Alice'\'');"}'
237
+
238
+ # Read (with password)
239
+ curl -X POST http://localhost:8998/db/projects/myapp/databases/main/query \
240
+ -H "X-Project-Key: myapp:dbpass" \
241
+ -d '{"sql":"SELECT * FROM users"}'
242
+
243
+ # Read (without password — no header needed)
244
+ curl -X POST http://localhost:8998/db/projects/myapp/databases/main/query \
245
+ -d '{"sql":"SELECT * FROM users"}'
246
+ ```
247
+
248
+ ## Docker
249
+
250
+ ```bash
251
+ docker compose up -d
252
+ ```
253
+
254
+ The data directory is mounted at `./data`. Initialize with:
255
+
256
+ ```bash
257
+ docker compose exec webduck webduck init
258
+ ```
259
+
260
+ ## Architecture
261
+
262
+ ```
263
+ FastAPI ──┬── /admin/* (JWT auth) → Project/DB management
264
+ ├── /db/* (project key) → SQL queries + CSV import/export
265
+ ├── /ui/* (cookie) → NiceGUI Web UI
266
+ ├── /api/* (session) → Internal UI endpoints
267
+ └── /health → Health check
268
+ ```
269
+
270
+ - **Storage:** DuckDB files in `data/<project>/<database>.duckdb`
271
+ - **Project order:** Persisted in `data/.projects.json`
272
+ - **Auth:** Admin passwords in `data/.users.json` (bcrypt), DB passwords in `data/<project>/.project.json`
273
+ - **User preferences:** Stored in `data/.user_preferences.json`
274
+ - **Logging:** Rotated log files in `log/` (configurable), independent console logging
275
+ - **Concurrency:** Single-writer via file-level locks (apps manage write contention)
276
+
277
+ ## Development
278
+
279
+ ```bash
280
+ git clone https://github.com/autumoswitzerland/Webduck.git
281
+ cd webduck
282
+ python3.13 -m venv .venv
283
+ source .venv/bin/activate
284
+ pip install -e ".[dev]"
285
+
286
+ # Run tests
287
+ pytest tests/ -v
288
+
289
+ # Run linter
290
+ ruff check src/ tests/
291
+ ```
292
+
293
+ ## Donate
294
+
295
+ WebDuck is free and open-source. If you find it useful, consider supporting the development:
296
+
297
+ [![Donate via PayPal](https://img.shields.io/badge/Donate-PayPal-blue)](https://www.paypal.com/ncp/payment/NZ4CC6SVF9HN8)
298
+
299
+ ## License
300
+
301
+ MIT — see [LICENSE](LICENSE) for details.
302
+
303
+ <br>
304
+ <hr>
305
+
306
+ Copyright &copy; 2026 autumo GmbH