Wes/core architecture rework - #2638
Conversation
Adds five new draft MDX pages (server-overview, server-database, server-middleware, server-plugins, server-routes) and an Agents placeholder, wired into the nav under a draft Server group. Pages are hidden in production and visible with VITE_SHOW_DRAFTS=true. Includes nav keys in all locale files and an updated i18n doc-coverage baseline to exempt draft pages from the localized-doc requirement.
Reframes db.ts as optional rather than default, moves the database plugin section after auth and agent-chat, expands the intro to explain what plugins are and how Nitro discovers them, and adds a new section on writing custom plugins with defineNitroPlugin linking to Nitro docs.
…are guide Expands the draft from a stub into a full page: - Adds a diagram showing callers → middleware → allowed/blocked outcomes - Rewrites the intro to describe middleware as a general cross-cutting layer - Adds a "Writing Middleware" section with a defineEventHandler example and links to Nitro/H3 docs, placed before the auth section - Consolidates The Auth Guard, Why Middleware, and Adding Public Paths under a single "The Auth Middleware" H2 with those as H3 subheadings
…agram Reorganizes the draft from a loosely ordered reference into a narrative that builds from concept to implementation: - New diagram showing Browser/UI and Agent loop reaching the database through the same Actions layer - Hosting Options section covering all five backends in order of complexity (SQLite default, PGlite, Postgres, Turso, Builder managed) - Setting Up section as four numbered steps: define schema, create DB client, write migrations, query in actions - Scoping Data to Users consolidates the owner_email and ownableColumns patterns that were previously scattered - Removes all em-dashes throughout in favor of separate sentences
Ports the sync loop content from the published server.mdx into the database page, where it completes the write story: after an action mutates data, the sync version increments and useDbSync() on the client invalidates caches so the UI refreshes. Includes the sync loop diagram and the poll endpoint block. Adds a What's next link to real-time-sync.
Splits server.mdx into five pages (overview, database, middleware, plugins, routes), un-drafts them in the nav, and repoints cross-page links across the docs that pointed at the old combined page.
|
Here's a visual recap of what changed: Open the full interactive recap |
There was a problem hiding this comment.
Builder reviewed your changes and found 2 potential issues 🔴
Review Details
Code Review Summary
This low-risk PR restructures the monolithic Server documentation page into focused Overview, Database, Middleware, Plugins, and Routes pages, adds a draft Agents entry, and updates the docs sidebar, cross-links, i18n labels, and localization coverage baseline. The overall information architecture is sound, and the new MDX blocks and primary English navigation paths were validated by the review agents. The main concern is migration safety for existing documentation URLs and correctness of newly introduced examples/links.
Key Findings
- 🔴 HIGH — Two newly added visual/code blocks reuse globally existing IDs, which can cause block identity, rendering, or cache collisions.
- 🔴 HIGH — The new Database page links to
/docs/real-time-sync, which does not exist and returns 404. - 🟡 MEDIUM — Removing
server.mdxwithout aserverredirect breaks existing/docs/serverlinks and bookmarks; HTTP verification confirmed a 404. - 🟡 MEDIUM — The webhook example can throw a 500 on malformed signature lengths because
timingSafeEqualrequires equal-length buffers. - 🟡 MEDIUM — The migration example uses SQLite-incompatible
ADD COLUMN IF NOT EXISTSsyntax despite documenting SQLite as the default backend. - 🟡 MEDIUM — The Agent Surfaces link now targets the agent-chat plugin but claims to provide the production handler’s full signature, which is no longer documented at that target.
The split itself is clear and the docs-block validation passed. 🧪 Browser testing: Attempted after this review; visual executors were unavailable, but HTTP checks confirmed the legacy /docs/server and /docs/real-time-sync failures.
| | `now` | Dialect-agnostic current timestamp for `.default(now())` | | ||
|
|
||
| <DataModel | ||
| id="doc-block-14e70da" |
There was a problem hiding this comment.
🔴 Use unique visual block IDs
This new DataModel reuses doc-block-14e70da, which already identifies the existing Database page's block. The duplicate global ID can cause the wrong block to be resolved or cached; assign a unique ID to each new block.
Additional Info
Found by code-review agent; corroborated by repository grep showing the same ID in packages/core/docs/content/database.mdx:159.
| - [**Plugins**](/docs/server-plugins): the startup plugin lifecycle where migrations run | ||
| - [**Actions**](/docs/actions): the surface where actions call `getDb()` to read and write data | ||
| - [**Deployment**](/docs/deployment#persistent-database): connecting a persistent database per deploy target | ||
| - [**Real-Time Sync**](/docs/real-time-sync): `useDbSync()` and the full client-side sync model |
There was a problem hiding this comment.
🔴 Fix the broken Real-Time Sync link
/docs/real-time-sync has no corresponding documentation slug and returns 404. Point this link at the existing sync/collaboration documentation or add the missing page before publishing the new Database page.
Additional Info
Confirmed by repository search and HTTP verification from the browser-test planner.
steve8708
left a comment
There was a problem hiding this comment.
great stuff wes - may have some localized mdx we need to update/move too

This PR breaks the Server page up into several different pages. The previous Server page has several different concepts within it, while this attempts to break it up into more manageable chunks that are a bit more readable and understandable. A general overview is below:
This does not yet include translations. I want to get this reviewed for content before spending the tokens on translations. :)