Go to file
Claude Opus 4.8 7d8f331870
All checks were successful
CD / Build and push images (push) Successful in 2m51s
CI / Lint, typecheck, test (push) Successful in 1m55s
CI / Auth e2e pack (push) Successful in 2m0s
CI / Build container images (push) Has been skipped
CD / Deploy to Test (push) Successful in 9s
CD / Smoke tests against Test (push) Successful in 1m11s
CD / Promote to Int (push) Successful in 11s
Add collab document persistence hooks and content-cache refresh (#35)
The collaboration server becomes the writer of page state (ADR 0003,
realtime-collaboration.md §lifecycle):

- onLoadDocument reconstructs a page's Y.Doc from PostgreSQL by applying
  `pages.ydoc_state` and then every `page_updates` row in order, so a page
  with a long update log loads correctly.
- onStoreDocument persists debounced (2 s, max 30 s): it appends the delta
  since the last flush to `page_updates`, periodically merges the log back
  into `ydoc_state` (inline threshold; the session-aware compaction of idle
  pages remains the separate job, #40), refreshes `page_content_cache`
  (plain text / Markdown / HTML / outline via the shared derivation, #24),
  bumps `pages.updated_at`, and keeps `Attachment.pageId` pointed at the
  embedding page (#31). Each flush runs in one transaction and its duration
  is logged.
- The document size ceiling (MAX_PAGE_DOCUMENT_BYTES) is enforced on store:
  an oversize document is not persisted and the clients are notified with a
  stateless error so they can revert.

Persistence is an injected port (PagePersistence): the Postgres
implementation is covered by a DB-backed test (store/load round-trip,
content-cache refresh, a 1000-entry update log, size-ceiling rejection,
not-found), and the hook wiring — two-client sync, survival across a server
restart, and the size-ceiling stateless notification — by an integration
test using an in-memory fake. The collab package gains its own vitest setup
that provisions an isolated `_collab` test database.

The REST `PUT /pages/:id/state` write path stays in place for now and is
retired (410) together with switching the editor to live collaboration in
#36, so the deployed editor is never left unable to save between the two
deploys.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PGdhRiwU1WRL4XxJfZYipY
2026-07-08 17:06:41 +02:00
.gitea/workflows Add collaboration server skeleton (Hocuspocus) with health, container, and CI/CD (#33) 2026-07-08 14:53:44 +02:00
apps Add collab document persistence hooks and content-cache refresh (#35) 2026-07-08 17:06:41 +02:00
deploy Add collaboration token issuance and connection authentication (#34) 2026-07-08 15:52:19 +02:00
docs/architecture Add collaboration server skeleton (Hocuspocus) with health, container, and CI/CD (#33) 2026-07-08 14:53:44 +02:00
packages/shared Add collaboration token issuance and connection authentication (#34) 2026-07-08 15:52:19 +02:00
scripts Run the CI auth pack against the production build 2026-07-05 06:16:27 +02:00
.dockerignore Add production Dockerfiles and the Compose stack with dev overlay 2026-07-04 19:30:21 +02:00
.editorconfig Scaffold pnpm monorepo with lint, format, and test tooling 2026-07-04 19:06:27 +02:00
.gitignore Add file storage service and image upload API (#27) 2026-07-08 10:35:03 +02:00
.prettierignore Add M2 fixtures and content regression pack (#32) 2026-07-08 13:14:48 +02:00
.prettierrc.json Scaffold pnpm monorepo with lint, format, and test tooling 2026-07-04 19:06:27 +02:00
eslint.config.mjs Run the CI auth pack against the production build 2026-07-05 06:16:27 +02:00
LICENSE Add architecture documentation, ADRs, and operations concept 2026-07-04 14:36:16 +02:00
package.json Scaffold pnpm monorepo with lint, format, and test tooling 2026-07-04 19:06:27 +02:00
pnpm-lock.yaml Add collab document persistence hooks and content-cache refresh (#35) 2026-07-08 17:06:41 +02:00
pnpm-workspace.yaml Add user, identity, session, and auth-support data model 2026-07-05 00:42:22 +02:00
README.md Scaffold pnpm monorepo with lint, format, and test tooling 2026-07-04 19:06:27 +02:00
tsconfig.base.json Scaffold pnpm monorepo with lint, format, and test tooling 2026-07-04 19:06:27 +02:00

Dorfteich

Dorfteich is an open-source wiki system built around ponds (German: Teiche) — self-contained wiki spaces that people and teams organize freely with hierarchical labels, directories, and Obsidian-style page relations. Pages are edited in a collaborative WYSIWYG editor with live cursors and offline support.

Key features

  • Real-time collaboration — multiple people edit the same page simultaneously; everyone sees the other participants' cursors and input live. Offline edits merge conflict-free on reconnect (CRDT-based).
  • Ponds — isolated wiki spaces with their own members, permissions, fonts, and page organization. Every registered person gets a personal pond.
  • Flexible organization — hierarchical labels, free page ordering, [[wikilinks]] with backlinks. A classic page tree is possible but never enforced.
  • Fine-grained permissions — roles (Site Admin, Pond Admin, Editor, Reader, Public) can be granted per pond, per label, or per page; the most specific setting wins.
  • Import & export — Markdown as the primary exchange format, plus best-effort structural import from Word/OpenOffice and export to Word/OpenOffice/PDF.
  • Plugins — sandboxed extensions (custom blocks, styles, page tools) installable at runtime without redeploying the instance.
  • Self-hosting first — a single docker compose up plus a guided first-run setup wizard yields a working instance.

Repository layout

Path Contents
docs/architecture/ Architecture documentation: ADRs, data model, permission model, collaboration and plugin concepts, deployment and operations
apps/ Application packages (web frontend, API server, collaboration server) — created as implementation proceeds
packages/ Shared packages (types, permission logic, plugin SDK)
deploy/ Docker Compose stacks and deployment tooling

Development

Requirements: Node.js ≥ 22 and pnpm (npm install -g pnpm).

pnpm install        # install all workspace dependencies
pnpm lint           # ESLint + Prettier check across the repo
pnpm typecheck      # TypeScript --noEmit in every package
pnpm test           # Vitest in every package
pnpm build          # build every package (dependency order)

The workspace packages live under apps/ (web, api, collab) and packages/ (shared). Shared logic goes into packages/shared and is imported as @dorfteich/shared — never copy code between apps.

Status

The project is in the architecture and backlog phase. Implementation stories are tracked as issues in this repository. Start reading at docs/architecture/README.md.

Contributing

Code, comments, and documentation are written in English. Write clear code that humans can follow easily; when in doubt, prefer readability over cleverness. All contributions are accepted under the MIT license.