DB-Backed Routing Authority
The ID is the Primary Key. The URL is just a pointer.
🗄️ 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:
✅ Option A: Numeric Series (Recommended for Manual Registry)
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
✅ Option B: UUID / GUID (Recommended for Auto-Gen)
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):
- The
<Link>component carries thepridin itsstateproperty.tsx// ✅ Correct: Opaque ID <Link to="..." state={{ prid: "1001" }} /> - The Target Page reads
location.state.prid. - The Data Hook executes
getDetailById("1001"). - 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:
location.stateis undefined.- The Loader parses the URL slug (e.g.,
system-design). - The Data Hook executes
getDetailBySlug("system-design", "en"). - Result: O(n) Map Lookup.
3. Benefits of this Protocol
- Proxy Resilience: If AI Studio adds
.htmlor a Blob prefix, Path A ignores it completely because it doesn't need to read the URL. - Link Stability: You can rename
system_design.mdtoarchitecture_v2.md. If you keep theid: 1003in 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.