Files
Docwell/README.md
T
tajniak81andClaude Opus 5.5 03f3434c10 Add organizations with cascading user rights
Same model as DriverVault, with organizations above workspaces:

- users get a role (user, admin, superadmin) and at most one
  organization; existing instance admins become superadmins
- rights cascade: superadmins own everything, org admins own their
  organization's workspaces, others get their workspace role
  (owner > admin > member > guest) while they stay in the org
- nobody grants a role above their own, acts on someone ranked above
  them, or changes their own role; rules live in internal/access as
  pure, tested functions
- self-service organizations: an org-less user creates one and becomes
  its admin; the last admin can delete it and is demoted
- endpoints for users, orgs, workspaces and members; token cache is
  dropped when a user's rights change
- admin panel: Users and Organizations pages scoped to the caller
- web app: organization page, workspace list, workspace settings with
  member management (EN/PL)
- fix: organization name missing after login/refresh, and stale tokens
  redirecting public pages to sign-in

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 22:53:11 +01:00

4.7 KiB

Docwell

An open-source, self-hostable knowledge base and collaborative document editor. It is wiki-first like Docmost and Outline, and will grow Notion-style databases later.

  • docs/FEATURES.md: feature inventory of the reference apps, with Docwell priorities
  • docs/PLAN.md: architecture, decisions (ADRs) and roadmap

Status: Phase 0 scaffold. All services build and run, but no product features exist yet.

Components

Folder What Stack
Database/ docwell-db: storage, private service PocketBase v0.40.6 + JS migrations
Server/ docwell-server: the only public API, plus the admin panel at /admin/ Go 1.26, Vue 3, Tailwind CSS 4
Web-App/ docwell-web: serves the end-user web app Go 1.26, Vue 3, Tailwind CSS 4, Tiptap
Desktop-App/ Desktop app; reuses the web app UI Wails v3
Phone-App/ Mobile app (Android, iOS) Flutter
Packages/ Shared frontend code: @docwell/editor, @docwell/ui, @docwell/api-client TypeScript
Docker/ The three services as separate containers docker compose
Docker-AIO/ Everything in one container docker compose

Quick start (Docker)

cd Docker
cp .env.example .env    # change the passwords
docker compose up --build

All-in-one container instead (one port, 3000; admin at http://localhost:3000/admin/):

cd Docker-AIO
PB_ADMIN_PASSWORD=change-me docker compose up --build

The first account you sign up becomes the superadmin, which unlocks the admin panel. To test sign-up emails (verification, password reset) locally, set DOCWELL_SMTP_HOST=mailpit and DOCWELL_SMTP_PORT=1025 in .env, start with docker compose --profile dev up --build, and read the emails at http://localhost:8025.

Authentication

Accounts live in PocketBase's built-in users auth collection. PocketBase stores the passwords, issues the tokens, and sends the verification and password-reset emails. It stays private: apps call /api/v1/auth/* on docwell-server, which forwards to PocketBase and adds Docwell's rules:

  • sign-up on or off (DOCWELL_SIGNUP_ENABLED) and an email-domain allow-list (DOCWELL_SIGNUP_DOMAINS)
  • the first account becomes the superadmin
  • disabled accounts (status = disabled) can't sign in

Tokens are sent as Authorization: Bearer <token>. Email codes (OTP), MFA and OAuth2 providers are switched on in PocketBase's users collection settings; the web app already handles codes and MFA. See ADR-6 in docs/PLAN.md.

Organizations and rights

Docwell uses the same model as DriverVault. Every user belongs to at most one organization and has a role:

Role Can manage
superadmin Every organization, user and workspace on the server
admin Their own organization: its members (never superadmins) and all of its workspaces
user Only the workspaces they were added to

Workspaces belong to an organization, and rights cascade into them: superadmins and org admins are owners of every workspace in their scope, and everyone else gets their workspace role (owner > admin > member > guest). Nobody can grant a role above their own, change someone ranked above them, or change their own role.

A user without an organization can create one from the web app and becomes its admin. Org admins and superadmins manage users and organizations in the admin panel; workspace members are managed in the web app. The rules live in Server/internal/access.

Development

Requirements: Go 1.26+, Node 22+, Flutter 3.44+, Wails CLI v3, and the PocketBase binary (see Database/README.md).

npm install

Run each piece in its own terminal:

# 1. Database (from Database/)
./bin/pocketbase serve --dir ./pb_data --migrationsDir ./pb_migrations

# 2. API server (from Server/)
DOCWELL_PB_EMAIL=admin@docwell.test DOCWELL_PB_PASSWORD=devpassword123 go run ./cmd/docwell-server

# 3. Web app with hot reload (from the repo root): http://localhost:5173
npm run dev:web

# 4. Admin panel with hot reload: http://localhost:5174/admin/
npm run dev:admin

# Desktop app (from Desktop-App/)
wails3 dev

# Mobile app (from Phone-App/), e.g. on an Android emulator
flutter run

Tests and checks:

go test ./Server/... ./Web-App/... ./Desktop-App/
npm run typecheck && npm test
cd Phone-App && flutter analyze && flutter test

After changing api/openapi.yaml, regenerate the TypeScript types:

npm run generate -w @docwell/api-client

License

GNU Affero General Public License v3.0 or later.