Sign-in:
- Google, GitHub, Microsoft and any OpenID Connect provider, set up in the
admin panel (secrets are write-only). PocketBase talks to the provider,
and docwell-server keeps the state and PKCE verifier. Accounts a
provider creates follow the sign-up switch and the domain list; refused
ones are removed again.
- Two-step sign-in with an authenticator app (TOTP), set up under "Your
account", with ten single-use recovery codes. After any first factor
(password, email code, provider) the session is held behind a
five-minute challenge: five tries, each code works once. Turning it off
needs a code. Managers can reset it for someone who lost their phone.
Both the web app and the admin panel ask for the code.
Integrations:
- Personal API tokens ("dw_…") that act as their owner, read-only or
read-write, with optional expiry. Only a hash is stored, and the token is
shown once. Tokens cannot manage tokens or two-step sign-in. Admins see
and can revoke their organization's tokens.
- Workspace webhooks for page, comment and space events. Deliveries are
HMAC-SHA256 signed and retried (10 s, 1 min, 5 min), with a 30-day log
and a test button. Loopback and link-local addresses are refused
(DOCWELL_WEBHOOKS_ALLOW_LOCAL is for development).
Audit log: sign-ins (including failures and second steps, filed under the
account's organization) and every successful change request, by route and
path ids, never bodies. Superadmins see everything and org admins their
organization. It is searchable and exportable as CSV in the admin panel's
new Security page, and kept for DOCWELL_AUDIT_RETENTION_DAYS (365).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
docwell-db
The official PocketBase binary (pinned in Dockerfile) with Docwell's schema migrations.
pb_migrations/holds JS migrations, applied in filename order at startup.pb_hooks/holds optional JS hooks (keep these minimal).- All collection API rules are
null, so only superusers have access. Never expose this service publicly; only docwell-server talks to it.
Run locally
Download PocketBase v0.40.6 for your OS into Database/bin/, then:
./bin/pocketbase migrate up --dir ./pb_data --migrationsDir ./pb_migrations
./bin/pocketbase superuser upsert admin@docwell.test devpassword123 --dir ./pb_data
./bin/pocketbase serve --dir ./pb_data --migrationsDir ./pb_migrations --hooksDir ./pb_hooks
The PocketBase dashboard is at http://127.0.0.1:8090/_/.
New migration
./bin/pocketbase migrate create "add_comments" --dir ./pb_data --migrationsDir ./pb_migrations