Skip to content

docs: Diátaxis restructure + pocketbase-typegen migration guide - #33

Merged
Karnak19 merged 6 commits into
mainfrom
docs/diataxis-overhaul
Jun 1, 2026
Merged

docs: Diátaxis restructure + pocketbase-typegen migration guide#33
Karnak19 merged 6 commits into
mainfrom
docs/diataxis-overhaul

Conversation

@Karnak19

@Karnak19 Karnak19 commented Jun 1, 2026

Copy link
Copy Markdown
Owner

Why

The docs had grown reference-heavy with how-tos tangled into reference pages and no standalone Explanation content. This restructures the site around the four Diátaxis modes and fills the gaps, plus adds the requested migration guide.

What changed

New migration guidehow-to/migrate-from-pocketbase-typegen.md: dependency swap, CLI-flags → pbkit.config.ts mapping (--db/--url/--json), type-name remapping, pb.collection(...) → generated-function table, typed expand, auth, verification.

Diátaxis restructure — sidebar rebuilt into four sections:

Section Pages
Tutorials Your first typed SDK (reframed Quick Start)
How-to Guides Install · Configure collections · Add TanStack Query · Add Zod schemas · Write a plugin · Migrate from pocketbase-typegen
Reference CLI · Configuration · Generated types · Generated SDK · Field type mapping · Expand types · Programmatic API
Explanation How pbkit works · The generated files · Relations and expand paths · Why a generated SDK (all new)
  • Pages moved with git mv (history preserved), retitled to verb-form for how-tos, re-ordered per section
  • expand-types split into lean reference + a new conceptual explanation page
  • All internal links and nav links rewritten to the new paths

Verification

  • bun run build passes — 20 pages, no broken internal links, search index rebuilt
  • No stale old-path links remain (grep-verified)

Note for review

The four new Explanation pages describe the parse→IR→generate pipeline and cycle/depth handling at a conceptual level, grounded in the public API (SchemaIR, parseApi/parseJson/parseSqlite, expandDepth). I did not read the generator internals — worth a sanity check that the described mechanisms match the implementation.

🤖 Generated with Claude Code

Karnak19 and others added 2 commits June 1, 2026 11:55
Reorganize the docs site into the four Diátaxis sections (Tutorials,
How-to Guides, Reference, Explanation), reclassify existing pages, and
fill the missing Explanation content.

- Add how-to/migrate-from-pocketbase-typegen guide
- Move pages into tutorials/, how-to/, reference/, explanation/ and
  re-order the sidebar accordingly
- Split expand-types into a reference page + a new explanation page
- Add explanation pages: how pbkit works, the generated files,
  relations and expand paths, why a generated SDK
- Reframe Quick Start as a guided tutorial ("Your first typed SDK")
- Update all internal links and nav to the new paths

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Mirror the new migration guide in the agent-facing skill: dependency
swap, CLI-flag mapping, type-name mapping, call-site mapping, and a
workflow note to migrate rather than run pbkit alongside typegen.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docs restructure looks well-organized. Two small accuracy issues found:

  • getArticles is referenced as a generated function name but doesn't exist — the list function is listArticles
  • A cross-reference link text ("Expand Types") points to a page with a different title

- why-a-generated-sdk: getArticles is not generated; use getFirstArticle
  (SDK produces get/getFirst<Singular> and list/getFullList<Plural>)
- migration guide: point "Expand types" link to /reference/expand-types
  so link text matches the target page title

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docs restructure looks solid — Diátaxis classification is clean and the migration guide is thorough. Three minor issues in the new migration guide:

  • devDependency: bun add installs pbkit as a runtime dependency; it should be a devDependency since it's a build-time tool.
  • Token auth gap: The email/password → token mapping doesn't explain how to obtain a PocketBase API token, which will block migrants.
  • Missing Zod link: The "Next steps" section mentions Zod schemas in the description but only links to the TanStack Query page.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Three remaining documentation accuracy issues in the migration guide:

  • pbkit installed as regular dependency instead of devDependency (medium — affects deploy bundles)
  • API token concept unexplained for users coming from email/password auth (high — blocks migration at step 2)
  • Zod schemas mentioned in "Next steps" but not linked (low — discoverability)


```bash
bun remove pocketbase-typegen
bun add @karnak19/pbkit pocketbase

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Problem: bun add @karnak19/pbkit pocketbase installs both packages as regular dependencies. pbkit is a build-time code generator and should be a devDependency — it has no role in production and pulling it into serverless/edge bundles adds unnecessary weight.

Impact: Users migrating from pocketbase-typegen (which was almost certainly a devDependency) would inadvertently move their code-gen tool into dependencies, potentially increasing deploy size and install time in production environments.

Fix: Split the install commands so pbkit goes to devDependencies and pocketbase (the runtime SDK) stays as a regular dependency:

bun remove pocketbase-typegen
bun add -d @karnak19/pbkit
bun add pocketbase

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch — fixed in 6d8202c. Split the install so pbkit goes in as a dev dependency (bun add -d @karnak19/pbkit) and pocketbase stays a runtime dependency, and updated the surrounding prose to call out that pbkit is build-time only.


| pocketbase-typegen flag | pbkit `input` |
|---|---|
| `--url ... --email ... --password ...` | `{ url: "...", token: "..." }` |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Problem: The table maps --email ... --password ... to token: "..." but never explains what this token is or how to obtain one. pocketbase-typegen authenticates with admin email/password credentials; pbkit uses an API token. This is a conceptual shift that will block users at this step.

Impact: A developer following this guide will see token: "ADMIN_AUTH_TOKEN" and have no idea where to get that value — it's not the same as their old email/password pair.

Fix: Add a short note (or a callout block) explaining that pbkit uses a PocketBase admin API token instead of email+password, and link to the PocketBase docs on how to generate one (e.g., via the admin UI or the POST /api/admins/auth-with-password endpoint to obtain a token). Something like:

pbkit authenticates with an API token rather than email/password. Generate one from the PocketBase admin UI under Settings → API tokens, or obtain one via the admin auth endpoint.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, this was a real gap — fixed in 6d8202c. Added a callout explaining that pbkit takes a superuser auth token (not email/password), how to obtain one via POST /api/collections/_superusers/auth-with-password, that it is only needed for non-public schemas, and to load it from an env var. Also updated the config example to use process.env.PB_ADMIN_TOKEN.


- [Configuration Reference](/reference/configuration) — every available option
- [Per-collection configuration](/how-to/configure-collections) — exclude collections or disable operations
- [Add TanStack Query](/how-to/add-tanstack-query) — generate TanStack Query options or Zod schemas

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Problem: The description says "generate TanStack Query options or Zod schemas" but the link only points to the TanStack Query page. The Zod schemas page (/how-to/add-zod-schemas) is not linked, so users looking for Zod guidance will have to find it manually.

Impact: Minor discoverability issue — the text promises two options but only provides a link for one.

Fix: Link to both pages, matching the pattern used in the tutorial's "Next steps" section:

- [Add TanStack Query](/how-to/add-tanstack-query) or [Zod schemas](/how-to/add-zod-schemas) via plugins

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 6d8202c — the Next steps bullet now links both Add TanStack Query and Zod schemas, matching the tutorial pattern.

- Install pbkit as a devDependency (build-time tool); keep pocketbase
  as a runtime dependency
- Explain the superuser auth token (pbkit takes a token, not
  email/password); read it from an env var instead of hardcoding
- Link both plugin pages (TanStack Query and Zod) in Next steps

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All three previously flagged issues in the migration guide are confirmed fixed in the current diff. One remaining inconsistency found in the SKILL.md agent instructions:

  • SKILL.md missing -d flag (medium): The condensed migration instructions say add @karnak19/pbkit without -d, contradicting the fix already applied to the full migration guide. An AI agent following this literally would install pbkit as a runtime dependency.

Comment thread skills/pbkit/SKILL.md Outdated

When a project already uses [pocketbase-typegen](https://github.com/patmood/pocketbase-typegen), pbkit replaces both the generated types and the `TypedPocketBase` cast with generated SDK functions.

- Swap dependencies: remove `pocketbase-typegen`, add `@karnak19/pbkit`. Keep `pocketbase`.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Problem: This line says add @karnak19/pbkit without the -d flag. The same issue was caught and fixed in the migration guide (how-to/migrate-from-pocketbase-typegen.md) during the previous review round — the guide now correctly uses bun add -d @karnak19/pbkit — but the fix was not propagated to this condensed SKILL.md summary.

Impact: An AI coding agent following these instructions literally would run bun add @karnak19/pbkit, installing the code generator as a regular dependency instead of a devDependency. This is the exact same class of bug that was already fixed in the user-facing guide, and it would silently undo that fix for any project where an agent handles the migration.

Fix: Add -d to match the migration guide:

- Swap dependencies: remove `pocketbase-typegen`, add `-d @karnak19/pbkit`. Keep `pocketbase`.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good consistency catch — fixed in 90fd421. The migration bullet in SKILL.md now uses add -d @karnak19/pbkit and notes pocketbase stays a runtime dependency, matching the migration guide.

Propagate the devDependency fix from the migration guide to the
condensed SKILL.md summary so agents following it don't install the
code generator as a runtime dependency.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions

github-actions Bot commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

No new major issues found. All four previously raised issues (devDependency install, token explanation, dual plugin links, SKILL.md consistency) have been verified as correctly addressed in the latest commits (00c98d2). The Diátaxis restructuring is clean — new explanation/tutorial/how-to/reference pages are technically accurate, internal links are consistently updated, and install commands correctly separate devDependencies from runtime dependencies across all pages. Review threads could not be auto-resolved due to permissions but all fixes are confirmed.

Apply the build-time/devDependency split consistently across the
install guide, plugin how-tos, and the skill:

- pbkit, pbkit-tanstack, pbkit-zod are generation-time tools → -d
- pocketbase, @tanstack/query-core, zod are imported by generated
  code at runtime → regular dependencies

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Karnak19
Karnak19 merged commit 0121e75 into main Jun 1, 2026
3 checks passed
@Karnak19
Karnak19 deleted the docs/diataxis-overhaul branch June 1, 2026 10:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant