docs: update architecture, API reference, and tRPC integration documentation#1448
Conversation
|
@copilot Don't forget to document the new Trpc integration |
- SYSTEM_ARCHITECTURE.md: replace STATIC_ASSETS→ASSETS binding, remove deprecated Clerk node, add BetterAuth inside MonolithWorker/APIWorker subgraphs, mark FrontendAPI service binding as wired, update summaries - hono-routing.md: replace stale middleware pipeline flowchart with accurate 11-step diagram (timing, X-API-Version, metadata, SSR detection, Better Auth handler, agent router, POC/pre-auth paths, unified auth, CORS, secure headers, prettyJSON, routes sub-app); add isSSR to context variable table; update tRPC description - api-reference.md: replace JSDoc-only stub with comprehensive REST + library reference including auth methods, rate-limit tiers, ~60-row endpoint summary table, curl examples, and further-reading links Agent-Logs-Url: https://github.com/jaypatrick/adblock-compiler/sessions/80a9ff5c-00a8-4f68-9bdf-12a409f10bec Co-authored-by: jaypatrick <1800595+jaypatrick@users.noreply.github.com>
- Add file layout section (worker/trpc/ directory tree) - Add TrpcContext interface documentation - Add procedure builder table (public/protected/admin) - Update mount-point flowchart: add rateLimitMiddleware and ZTA gate nodes before handleTrpcRequest (matching hono-app.ts lines 575-600) - Add Client section: httpBatchLink batching, AppRouter type import, createTrpcClient usage examples - Add 'Adding a new procedure' skeleton with v1/index.ts registration - Add Testing section: createCallerFactory pattern (no HTTP overhead) - Register trpc.md in docs/SUMMARY.md under Architecture section Agent-Logs-Url: https://github.com/jaypatrick/adblock-compiler/sessions/84a21688-845f-4605-ac25-734497977a29 Co-authored-by: jaypatrick <1800595+jaypatrick@users.noreply.github.com>
Done in f347054.
Also added |
There was a problem hiding this comment.
Pull request overview
Updates the project’s documentation to reflect the current post–Clerk migration architecture (Better Auth), the Phase 4 Hono routing refactor, and the tRPC v11 API layer, keeping mdBook navigation in sync.
Changes:
- Refreshed architecture diagrams and routing/middleware ordering docs to match
worker/hono-app.ts. - Expanded the API reference into a REST + library guide with auth/rate-limit tiers, endpoint summaries, and usage examples.
- Added/expanded tRPC documentation (layout, context, builders, mount-point flow, client usage, and testing guidance) and linked it in
docs/SUMMARY.md.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| docs/architecture/trpc.md | Adds comprehensive tRPC layer documentation (structure, context, client/testing, mount-point flow). |
| docs/architecture/hono-routing.md | Updates the middleware/routing diagram and context vars to match current Hono app ordering. |
| docs/architecture/SYSTEM_ARCHITECTURE.md | Updates architecture diagrams/summary for Better Auth + ASSETS binding + SSR worker → API service binding wiring. |
| docs/api-reference.md | Replaces stub with full REST endpoint summary, auth/rate-limit tiers, examples, and links to deeper docs. |
| docs/SUMMARY.md | Registers the new tRPC documentation page in mdBook navigation. |
|
@copilot apply changes based on the comments in this thread |
trpc.md: - v1.compile.json: "user session or API key" (not session-only) - Testing imports: bare specifiers → relative paths (./init.ts, etc.) - createTrpcClient example: use 4-level relative path with depth note - AppRouter example: use 4-level relative path with depth note api-reference.md: - /compile/async + /compile/batch/async: Free+ → Pro+ - /queue/stats: No → Free+ - /configuration/validate + /configuration/resolve: No → Free+ - /metrics/prometheus: No → Admin - /workflow/compile + /workflow/:id: Free+ → Pro+ - Async compile curl example: add Pro-tier required note Agent-Logs-Url: https://github.com/jaypatrick/adblock-compiler/sessions/0b13188b-ffcd-4cef-b808-f3537d7ec35f Co-authored-by: jaypatrick <1800595+jaypatrick@users.noreply.github.com>
All 10 review comments addressed in 5070221:
|
|
@copilot finish your work |
Description
Four documentation files were stale after the Clerk → Better Auth migration, the Hono routing refactor (Phase 4 domain route split), and the addition of the tRPC v11 API layer. This PR brings
SYSTEM_ARCHITECTURE.md,hono-routing.md,api-reference.md, andtrpc.mdinto sync with the current codebase, and registerstrpc.mdindocs/SUMMARY.md. Endpoint auth tier labels inapi-reference.mdhave been corrected to matchROUTE_PERMISSION_REGISTRY, and import paths and procedure descriptions intrpc.mdhave been corrected based on review feedback.Changes
docs/architecture/SYSTEM_ARCHITECTURE.mdSTATIC_ASSETS→ASSETSbinding (matcheswrangler.toml/worker/types.ts)ClerkfromExternalServices; addedBetterAuthnode insideMonolithWorkerandAPIWorkersubgraphs withauthclass stylingFrontendAPIedge: dashed "not yet wired" → solid arrow reflectingenv.API.fetch()now live infrontend/server.tsdocs/architecture/hono-routing.mdhono-app.tsorder:timing → X-API-Version → metadata → SSR detection → Better Auth handler → agent router → PoC/pre-auth shortcuts → unified auth → CORS → secure-headers → prettyJSON → routes sub-appisSSRto the Context Variables tabledocs/api-reference.mdanonymous/free/pro/admin)curlexamples for sync compile, sign-in, health check, and async queue pollingROUTE_PERMISSION_REGISTRY:/api/compile/asyncand/api/compile/batch/async:Free+→Pro+/api/queue/stats:No→Free+/api/configuration/validateand/api/configuration/resolve:No→Free+/api/metrics/prometheus:No→Admin/api/workflow/compileand/api/workflow/:id:Free+→Pro+curlexampledocs/architecture/trpc.mdworker/trpc/directory structureTrpcContextinterface documentation (env,authContext,requestId,ip,analytics)publicProcedure/protectedProcedure/adminProcedure) with auth requirements and error codesrateLimitMiddlewareand ZTA gate (checkUserApiAccess+trackApiUsage) nodes beforehandleTrpcRequest, matchinghono-app.tslines 575–600httpBatchLinkbatching behaviour,AppRoutertype import,createTrpcClientusage examplesv1/index.tsregistrationcreateCallerFactorypattern for unit tests without HTTP overheadv1.compile.jsondescription: now reads "user session or API key" instead of implying session-only access./init.ts,./router.ts,./context.ts)createTrpcClientandAppRouterexamples to 4 levels with a comment noting the depth depends on the calling file's locationdocs/SUMMARY.mdtrpc.mdunder the Architecture section so it appears in the mdBook navigationTesting
worker/utils/route-permissions.tsZero Trust Architecture Checklist
This PR does not touch
worker/orfrontend/— ZTA checklist not required.Original prompt
The repository's Architecture and API Documentation are outdated and need revisions to reflect recent changes in the system. The updates will target the following areas:\n\n1. Architecture Documentation:\n - Update the
docs/architecturedirectory files to reflect the current state of the system's design, components, and workflows.\n - Modify or replace diagrams, descriptions, and technical workflows to align with recent architectural updates in the repository.\n\n2. API Documentation:\n - Revise thedocs/api-reference.mdfile to include accurate endpoint definitions, request/response parameters, and any new APIs.\n - Add or update examples for API usage, noting deprecated or removed APIs.\n - Incorporate details from thedocs/apifolder into theapi-reference.mdfile if necessary to ensure comprehensiveness.\n\nThese updates will ensure the documentation aligns with the current codebase and project requirements, providing clear and accurate information to both contributors and users.The following is the prior conversation context from the user's chat exploration (may be truncated):
User: Lots of our /docs are out of date. How to upgrade the content with burning through a lot of tokens?
Assistant: To update your
/docscontent efficiently without burning a lot of tokens, here's a step-by-step plan:1. Audit Existing
/docs/docsdirectory. Tools likels(locally) or GitHub's file browser can help you see what’s present.Token Efficiency Tip: Extract file lists and top-level information without opening or processing entire files at once.
2. Refine and Prioritize Scope
3. Use Code Search for Relevant Content
Example Code Search:
4. GitHub Tools to Minimize Manual Work
Example semantic queries:
5. Leverage Contributors or Reviews
6. Batch Questions and Tools Usage
7. Update and Test Incrementally
Let me know if you’d like help auditing, searching related content, or generating updated templates!
User: Auditing and updating docs
Assistant: To effectively audit and update the
/docscontent in yourjaypatrick/adblock-compilerrepository, follow this structured approach:1. Audit Existing Documentation
a. Inventory the
/docsDirectory/docsdirectory.b. Categorize Documents
c. Highlight Critical Docs
Token Efficiency Tip: Use GitHub’s
ls-treeorAPIto extract the directory structure and file metadata without loading file contents directly.2. Updating the Content
a. Evaluate Language Composition
This pull request was created from Copilot chat.
🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.