Docs
Protocol Verified

DB-Backed Routing Authority

The ID is the Primary Key. The URL is just a pointer.

PRID: 1005
VERIFIED
2 min read

🗄️ Strategy: DB-Backed Routing Authority (DB-BRA)

The Identity is the Primary Key. The URL is just a pointer.


1. Permanent Resource ID (PRID) Protocols

In a truly database-driven application, resources must have an identity that persists even if their metadata (like titles or URLs) changes.

ID Formatting Rules (Strict)

The ID serves as the Primary Key in the database. To ensure decoupling from content, it must follow one of these two formats:

Use structured ranges to categorize content types. This is easier for human maintenance in src/mocks/content/registry-*.ts.

  • Core Docs: 1000 - 1099
  • Engineering: 1100 - 1199
  • Infrastructure: 1200 - 1299
  • Blog Posts: 2000 - 2999

If data is generated programmatically or via CMS, use standard UUID v4.

  • Example: 550e8400-e29b-41d4-a716-446655440000

❌ Anti-Pattern (FORBIDDEN)

NEVER use slug-based or hybrid IDs. They re-couple identity to content, defeating the purpose of PRID.

  • doc-project-plan (Contains semantic meaning)
  • blog-2024-update (Changes if date changes)

2. Resolution vs. Routing

We have decoupled the "URL Segment" from the "File Path". The system uses a Dual-Path Resolution Strategy:

Path A: The Fast Track (State Hydration)

When a user navigates within the app (e.g., clicks a link in the sidebar):

  1. The <Link> component carries the prid in its state property.
    tsx
    // ✅ Correct: Opaque ID <Link to="..." state={{ prid: "1001" }} />
  2. The Target Page reads location.state.prid.
  3. The Data Hook executes getDetailById("1001").
  4. Result: O(1) Lookup. Instant rendering. Zero ambiguity.

Path B: The Slow Track (URL Reconstruction)

When a user refreshes the page or enters a URL directly:

  1. location.state is undefined.
  2. The Loader parses the URL slug (e.g., system-design).
  3. The Data Hook executes getDetailBySlug("system-design", "en").
  4. Result: O(n) Map Lookup.

3. Benefits of this Protocol

  • Proxy Resilience: If AI Studio adds .html or a Blob prefix, Path A ignores it completely because it doesn't need to read the URL.
  • Link Stability: You can rename system_design.md to architecture_v2.md. If you keep the id: 1003 in Frontmatter, all existing internal links remain functional.
  • Performance: Integer or Fixed-Char lookups are significantly faster than string matching.

Status: V5.1 - Numeric Sovereignty Active.

Authority Distribution

Share this technical artifact