API and tRPC service layer
The API and tRPC service layer is the boundary through which clients and external systems use Karakeep. It accepts HTTP requests, builds a request context, checks identity and access, validates request data, and routes each call to a domain capability such as bookmarks, lists, tags, assets, or integrations.
Service boundary
The service exposes two related request styles. The versioned HTTP API gives outside clients resource-shaped paths under /api/v1, while tRPC exposes the same application capabilities as typed procedures under /api/trpc. Health, version, metrics, public asset, RSS, and webhook paths sit beside these main interfaces for system checks and external integrations. packages/…/index.ts• L29-43 packages/…/index.ts• L69-93
The tRPC router is the shared service contract. The web server can call it directly, and HTTP adapters can call the same procedures instead of creating a second domain layer. The router type also gives typed clients a common view of available procedures. Its domain map includes support reports as well as the user, bookmark, integration, and administration capabilities. packages/…/_app.ts• L22-44 apps/…/client.ts• L66-70
This diagram shows how an incoming request reaches a domain procedure and becomes a response.
flowchart LR
Client[Client or external system] --> HTTP[HTTP API]
Client --> TRPC[tRPC endpoint]
HTTP --> Context[Request context]
TRPC --> Context
Context --> Guard[Identity and scope checks]
Guard --> Contract[Input and output contract]
Contract --> Router[Domain router]
Router --> Domain[Application capability]
Domain --> Response[HTTP or tRPC response]
HTTP routes
The Hono application provides the HTTP shell for the service. It applies shared logging, cross-origin rules, metrics collection, context checks, and tRPC error conversion before it dispatches to route groups. packages/…/index.ts• L45-85 packages/…/trpcAdapter.ts• L16-28
The versioned group focuses on resource access. Its main resources are bookmarks, lists, tags, users, assets, feeds, backups, and highlights. These handlers validate HTTP query, path, form, or JSON data, then call the matching domain API and translate the result into an HTTP status and JSON body. packages/…/index.ts• L29-43 packages/…/bookmarks.ts• L31-62 packages/…/lists.ts• L13-71
Mutation routes respect read-only mode before they change data or upload files. Read-only mode is a service-wide write block: the tRPC procedure layer rejects mutations, and HTTP routes that perform work outside a tRPC procedure apply the matching HTTP guard. Asset upload requires asset write scope and is rate limited. Asset reads require asset read scope and can return a short-lived signed URL or the asset content. packages/…/readOnlyMode.ts• L7-14 packages/…/assets.ts• L15-72 packages/…/bookmarks.ts• L121-159
The HTTP surface also handles concerns that do not fit a normal resource route. Public and RSS routes serve intentionally shareable data, the asset routes serve uploaded content, and the Stripe webhook accepts a signed event from Stripe. Operational paths expose health, version, and protected metrics data. packages/…/public.ts• L1-7 packages/…/rss.ts• L12-55 packages/…/webhooks.ts• L12-41 packages/…/health.ts• L5-14 packages/…/metrics.ts• L26-30
tRPC contract
tRPC defines procedures as queries or mutations with explicit input and output schemas. The shared procedure layer applies the read-only write block, request metrics, tracing, and rate limits. A failed input check is reported as a structured bad request, while production internal errors are reduced to a safe generic message. packages/…/index.ts• L67-125
The root router groups procedures by domain. A client therefore addresses a capability through a stable namespace such as bookmarks, lists, tags, assets, users, admin, subscriptions, or problemReports. The grouping is a service map, not a separate network service for each domain. packages/…/_app.ts• L22-44
The shared procedure layer also sets the service-wide traffic policy. Public and signed-in calls use different default rate limits, while server-initiated internal calls do not use user-facing limits. This distinction lets workers and controlled impersonation act for a user without making normal sessions exempt. packages/…/index.ts• L34-47 packages/…/index.ts• L101-149 packages/…/rateLimit.ts• L15-56 packages/…/impersonate.ts• L8-31
Request contracts
Request contracts keep the HTTP and tRPC boundaries aligned. Shared Zod schemas define accepted values and response shapes for core objects, while HTTP handlers adapt transport details such as query strings, cursors, multipart files, and path identifiers before calling a procedure. packages/…/bookmarks.ts• L35-50 packages/…/tags.ts• L19-36 packages/…/bookmarks.ts• L47-61
The main data contracts describe three bookmark forms: a link, a text note, or an uploaded asset. Lists can be manual or smart, and tags provide user-owned names with usage counts split by AI and human attachment. Tag responses also support filtering, sorting, and cursor-based listing. Highlights add personal annotations to bookmark content while keeping the highlighted text shareable without exposing the author's private note to collaborators. Bookmark and asset responses include attachment metadata such as file size, so clients can show storage and download context without a second lookup. These shapes let clients use one service boundary while preserving the rules of each product feature. packages/…/bookmarks.ts• L20-25 packages/…/bookmarks.ts• L120-171 packages/…/lists.ts• L8-62 packages/…/tags.ts• L12-42 packages/…/tags.ts• L84-181 packages/…/bookmarks.ts• L241-259 packages/…/assets.test.ts• L134-177 packages/…/highlights.service.ts• L43-51
Asset contracts use user-facing asset types at the service boundary. The service maps these types to stored asset kinds and permits attachment or removal only for types that make sense for the operation. Some generated content can be detached but cannot be attached by a client, while bookmark-owned content, HTML content, avatars, and unknown assets cannot be attached or detached through this contract. Asset listings report totals and support size or newest ordering, with unbookmarked assets included after assets attached to bookmarks in newest views. packages/…/attachments.ts• L9-26 packages/…/attachments.ts• L28-83 packages/…/assets.ts• L77-127
List and search results use cursors rather than page numbers. The HTTP layer converts transport-safe cursor values into the internal request form and returns a nextCursor for the next request. Clients should treat that cursor as an opaque continuation value. packages/…/tags.ts• L19-36 packages/…/lists.ts• L44-58 packages/…/bookmarks.ts• L65-101
Readable bookmark content has a separate continuation contract. The endpoint can return content in chunks, checks that a cursor belongs to the same bookmark and format, and asks the client to restart if the content changed. This keeps large content responses bounded without allowing a stale cursor to produce an invalid view. packages/…/bookmarks.ts• L216-301
Authentication and authorization
Authentication creates a request context with the user, authentication type, database access, and client IP. Server-side web calls use a session when available. Requests with a valid Bearer API key use the key owner's identity and carry the key's scopes into later access checks. apps/…/client.ts• L10-63 packages/…/auth.ts• L116-176
API keys are generated as one-time credentials and stored through a verifier rather than as a reusable secret. The service accepts the supported key formats and returns the owning user plus normalized scopes after validation. The current key format uses a hashed secret, while validation continues to accept the earlier format. packages/…/auth.ts• L29-35 packages/…/auth.ts• L65-100 packages/…/auth.ts• L103-179 packages/…/apiKeys.test.ts• L732-759
The service distinguishes four access paths. Public procedures support operations that need no signed-in user, authenticated procedures require a user, and admin procedures require both an authenticated user and the admin role. Session-only procedures reject API keys when an operation must come from an interactive session, while internal contexts represent trusted server work on behalf of a user. packages/…/index.ts• L34-47 packages/…/index.ts• L132-162 packages/…/index.ts• L207-237 packages/…/auth.ts• L9-59 packages/…/impersonate.ts• L8-31
API keys can be limited by resource and access mode. Readwrite access also satisfies read access, while full access bypasses resource checks. The same scope model is enforced by tRPC procedures and by selected HTTP routes such as asset upload and download. packages/…/apiKeys.ts• L3-19 packages/…/apiKeys.ts• L92-106 packages/…/apiKeyScopes.ts• L14-38 packages/…/assets.ts• L17-49
Password authentication supports local credential accounts and keeps compatibility with older password hashes. Password login can be disabled by policy, and email matching is case-insensitive because account email values are normalized. Accounts without a password cannot use password exchange. packages/…/auth.ts• L178-277 packages/…/auth.test.ts• L197-305
Authorization also follows ownership and role rules inside domain routers. For example, bookmark operations check bookmark ownership, while list operations can require viewer, editor, or owner rights. This keeps identity checks at the boundary and resource rights close to the capability that owns them. packages/…/bookmarks.ts• L84-100 packages/…/lists.ts• L24-58
This sequence shows the two supported authentication paths for an API request.
sequenceDiagram
participant C as Client
participant A as API boundary
participant K as API key store
participant S as Session provider
participant R as Domain router
C->>A: Request with Bearer key or session cookie
alt Bearer API key
A->>K: Validate key
K-->>A: User and scopes
else Session cookie
A->>S: Read session
S-->>A: User or no user
end
A->>R: Call with request context
R-->>C: Result or access error
Domain routers
The domain routers expose the product capabilities through one typed service map. The bookmark organization domains are the central user workflow, while other routers support capture, enrichment, sharing, account control, and system operations.
Bookmark organization
Bookmark organization covers saved content and the structures used to find and group it. Bookmarks support creation, search, update, deletion, readable content, assets, tags, highlights, and summaries. Re-adding an existing link is idempotent: normal saves restore and refresh the bookmark, while RSS and import saves leave the existing state unchanged. Bookmark creation also starts the downstream crawl, extraction, indexing, rule, and webhook work needed to enrich and distribute the change. Tags belong to one user and support usage views, source-based filtering, cleanup, renaming, and merge operations. Only actual tag-link changes trigger reindexing and related events. Lists support manual or smart grouping, public views, and collaboration for manual lists. List owners manage metadata and members, editors can change bookmark membership, and viewers can read shared content without changing it. Shared-list views keep personal bookmark state private, and a collaborator's list memberships are removed when that collaborator leaves or is removed. Smart lists reuse the search contract, while list changes can trigger user rules for later work. See Bookmark organization APIs for the detailed domain view.
References: packages/…/bookmarks.ts• L242-579 packages/…/bookmarks.ts• L1331-1544 packages/…/bookmarks.ts• L841-895 packages/…/lists.ts• L76-100 packages/…/lists.ts• L248-413 packages/…/lists.ts• L206-257 packages/…/lists.ts• L432-503 packages/…/lists.ts• L727-900 packages/…/lists.ts• L1170-1247 packages/…/tags.ts• L30-181 packages/…/tags.ts• L184-387 packages/…/ruleEngine.ts• L144-156 packages/…/sharedLists.test.ts• L594-714 packages/…/sharedLists.test.ts• L1289-1384 packages/…/bookmarks.ts• L35-442 packages/…/bookmarks.test.ts• L786-1012
Capture and content
Capture and content routers manage the material that users save and the work performed on it. Assets store files linked to bookmarks, feeds provide recurring sources, import sessions support bulk intake, and prompts and rules extend processing and automation. Asset type rules separate user-uploaded content from generated content and profile assets. Asset management also supports attachment replacement and removal while protecting ownership and preventing unsupported content types from crossing the service boundary.
References: packages/…/_app.ts• L5-18 packages/…/assets.ts• L14-83 packages/…/assets.ts• L77-127 packages/…/assets.ts• L223-342 packages/…/attachments.ts• L9-83 packages/…/assets.ts• L15-72 packages/…/assets.test.ts• L12-132 packages/…/assets.test.ts• L179-300
Accounts and sharing
Account and sharing routers manage user identity, API keys, invitations, and subscriptions. The user router includes public account creation plus signed-in account operations, while API key management creates scoped credentials for programmatic access. Admins can create, list, resend, and revoke invitations. An invite recipient can inspect and accept a one-time token to create a verified user, while email delivery remains a best-effort side effect. User operations also expose settings, stats, avatar changes, and account deletion. packages/…/users.ts• L24-127 packages/…/apiKeys.ts• L36-230 packages/…/invites.ts• L20-275 packages/…/email.ts• L95-141
User account procedures also expose a personal view of bookmark use. The service reports bookmark counts and aggregate activity, returns account settings, and permits avatar changes only through assets owned by the current user. Account deletion checks local credentials when present and blocks deletion while an active or trialing Stripe subscription remains. User creation normalizes email values, assigns the first user the admin role when no role is supplied, and gives new users the configured free quotas. packages/…/users.ts• L59-125 packages/…/users.ts• L64-136 packages/…/users.ts• L145-208 packages/…/users.ts• L210-383
References: packages/…/users.ts• L23-125 packages/…/users.ts• L64-136 packages/…/users.ts• L145-208 packages/…/users.ts• L210-383 packages/…/users.ts• L385-671 packages/…/apiKeys.ts• L36-230 packages/…/invites.ts• L20-275 packages/…/email.ts• L95-141 packages/…/invites.test.ts• L37-83 packages/…/users.test.ts• L49-119
Support reports
Support reports give signed-in users a controlled path to send a problem description to the configured support mailbox. The request can include browser and recent client-error diagnostics, and the service adds server and reporter context so support can connect the report to logs. This procedure accepts session authentication only and limits submissions to reduce abuse. packages/…/problemReports.ts• L12-67 packages/…/email.ts• L241-394
References: packages/…/problemReports.ts• L12-67 packages/…/email.ts• L241-394 packages/…/problemReports.test.ts• L41-139
Integration and operations
Integration and operations routers connect the service to external systems and administrators. Webhooks and subscriptions handle billing events, including Stripe and in-app purchase state, while backups support data protection and the admin router exposes controlled maintenance and system actions. Subscription state drives user quotas and browser-crawling access. Manual tiers remain in place when a provider has no active paid state until an active subscription takes precedence. Admin actions report worker and connection health, manage users and quotas, and enqueue repair work such as recrawls, reindexing, embedding regeneration, inference, and asset processing. See Integration and operations APIs for the detailed domain view. packages/…/subscriptions.ts• L118-320 packages/…/subscriptions.ts• L323-399 packages/…/subscriptions.ts• L727-867 packages/…/admin.ts• L65-327 packages/…/admin.ts• L671-823
The admin router separates system, user, bookmark, and job access into granular admin scopes. It can inspect service totals and connection health, manage users and quotas, inspect bookmark state, and request work from crawler, search, vector, inference, video, feed, webhook, and asset queues. Bulk work can target bookmark status or recent modification time, which limits repair work without clearing a full index. packages/…/admin.ts• L53-65 packages/…/admin.ts• L268-468 packages/…/admin.ts• L474-685 packages/…/admin.ts• L697-849 packages/…/admin.test.ts• L384-417
References: packages/…/subscriptions.ts• L21-39 packages/…/subscriptions.ts• L97-309 packages/…/subscriptions.ts• L337-729 packages/…/subscriptions.test.ts• L1179-1354 packages/…/admin.ts• L51-65 packages/…/admin.ts• L65-327 packages/…/admin.ts• L467-680 packages/…/admin.ts• L671-823 packages/…/admin.test.ts• L102-381 packages/…/admin.test.ts• L384-417
Client access
Clients use the generated AppRouter type and an HTTP batch link for remote tRPC calls. The link sends API keys as Bearer tokens when configured and uses a bounded request URL so bulk calls do not exceed common reverse-proxy limits. The web server can instead create a direct caller with the same router and context. packages/…/trpc-provider.tsx• L42-93 packages/…/trpc.ts• L1-25 apps/…/client.ts• L41-70
Change checklist
When these files or sections are changed, remember to consider these:
- A new or renamed root router changes the shared
AppRoutercontract and must remain reachable through both direct callers and the/api/trpcadapter. - A change to a shared Zod schema can affect both JSON or query HTTP adapters and native tRPC clients. Check transport-specific cursor and file handling at the same time.
- A new API-key-protected capability needs matching scope definitions and checks in the tRPC procedure and any HTTP route that bypasses the tRPC adapter.
- Changes to API-key creation or validation must preserve one-time secret delivery, current and legacy key formats, and the rule that key-authenticated callers can revoke only their own key.
- A change to read-only mode must cover both the base tRPC mutation guard and HTTP routes that upload or change data before they call a domain procedure.
- Changes to authentication context fields must stay aligned between session requests, API-key requests, webhooks, and direct server callers.
- Changes to internal authentication must preserve the exemption from user-facing rate limits without making session or API-key calls internal.
- Changes to password policy or user creation must preserve normalized email lookup, credential account behavior, and the first-user role rule.
- Changes to invitation creation must keep token use, duplicate checks, user creation, and best-effort email delivery aligned.
- Changes to shared-list roles or public-list views must keep owner, editor, viewer, and unauthenticated responses aligned with bookmark ownership and membership cleanup.
- Changes to asset type names must update the boundary mapping and the attach, replace, listing, or detach rules together.
- Changes to asset listing order or continuation values must preserve total counts, total size, stable ordering, and the transition between bookmarked and unbookmarked assets.
- Changes to tag ownership, attachment-source counts, or merge and rename behavior must keep tag responses and search reindexing for affected bookmarks aligned.
- Changes to bookmark link de-duplication must preserve the different resave rules for interactive, RSS, and import sources.
- Changes to bookmark attachment metadata must keep sizes aligned in both bookmark detail and bookmark listing responses.
- Changes to Stripe state must keep webhook event handling, subscription selection, manual tiers, quotas, and browser crawling entitlements consistent.
- Changes to admin bulk jobs must preserve status filters, modification-time filters, queue payloads, and index clearing behavior.
- Changes to error codes or internal-error messages must preserve the conversion from tRPC errors to HTTP responses.
- Changes to problem reports must keep the session-only gate, submission limit, diagnostics contract, support email configuration, and log correlation ID aligned.
- Changes to batch URL limits must account for browser bulk calls and clients behind reverse proxies.
- Changes to readable bookmark content must keep cursor identity, content version, chunk size, and
ETagbehavior aligned.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| Missing or invalid session and no valid API key | Authenticated procedures return UNAUTHORIZED; HTTP auth middleware returns 401. | Build the request context before routing and use the correct auth class for the route. |
| API key is malformed, revoked, or uses an invalid secret | Authentication fails and the request cannot reach a protected procedure. | Keep the full key when it is issued, and use the supported key format and secret. |
| API key lacks the required resource scope | The request is rejected with FORBIDDEN, even when the key identifies a valid user. | Grant the needed read or readwrite scope and keep route and procedure checks aligned. |
| A key tries to manage another key | The request is rejected; key-authenticated clients can revoke only themselves. | Use a session for key management or revoke the key attached to the request. |
| Password authentication is disabled or the user has no password account | Password login and credential-to-key exchange fail. | Use the configured sign-in method and do not treat an OAuth-only account as a local account. |
| A mutation runs while read-only mode is active | The service returns FORBIDDEN and must not change data or upload an asset. | Use the shared tRPC mutation guard and the HTTP guard for work that runs outside tRPC. |
| User lacks ownership or list role | A valid user cannot read or change the resource. | Apply the domain ownership or viewer, editor, and owner checks. |
| A viewer or collaborator tries to manage list metadata, members, RSS access, or merge lists | The service returns FORBIDDEN; a collaborator cannot gain owner-only control. | Keep list management checks separate from bookmark membership checks. |
| Request data fails its shared schema | The service returns a bad-request result and does not call the domain capability. | Send the required shape and treat cursors as opaque values. |
| Duplicate tag name is created or an update renames a tag to an existing name | The service returns BAD_REQUEST and keeps the existing tag set. | Keep tag names unique per user and use merge when combining tags. |
| A tag merge includes a missing tag or the destination tag as a source | The merge is rejected and no tag links are moved. | Validate all requested tags and use a distinct destination tag. |
| A tag is changed or removed without reindexing affected bookmarks | Search results can retain stale tag names or membership. | Trigger reindexing for bookmarks linked to the changed tag. |
| Readable-content cursor does not match the bookmark, format, or content version | The service returns a 400 or 409 response and the client must restart reading. | Keep the cursor with its bookmark and format, then restart when content changes. |
| Invite token is unknown, already accepted, or duplicated | Invite lookup or acceptance fails and no second account is created. | Keep tokens one-time, reject duplicate pending invites, and remove the invite after account creation. |
| SMTP is unavailable while an invite is created | The invite remains available, but no email reaches the recipient. | Treat email as best effort and provide another way to deliver or resend the invite. |
| Stripe is not configured or a webhook has no valid signature | Billing actions fail or subscription state is not changed. | Require the configured Stripe values and verify the raw event body and signature. |
| Stripe reports no active subscription for a user without a manual tier | The user moves to free entitlements and related quotas. | Sync the full customer state and preserve manual tiers until they are explicitly revoked or superseded. |
| Large tRPC batch URL exceeds a proxy limit | The client can receive a 431-style header or request-line failure before the application handles the call. | Use the external URL limit and split large batches when needed. |
| Admin bulk job receives a broad filter or stale status assumption | Too much work can be queued or a repair can target the wrong records. | Use the status and modification-time filters and preserve idempotent queue payloads. |
| User account deletion is requested with an active or trialing Stripe subscription | Account deletion is rejected and user data remains. | Cancel the subscription before deletion; the account service checks subscription state. |
| Bookmark creation exceeds the user's bookmark quota | The bookmark is not created and the request returns FORBIDDEN; a duplicate link can still return the existing bookmark. | Check quota inside the creation transaction after link de-duplication. |
| A link is re-saved from RSS or import | The existing bookmark stays archived or otherwise unchanged apart from the duplicate result. | Keep automated sources on the no-op de-duplication path. |
| Semantic search is requested without enabled search infrastructure | Semantic-only search fails, while hybrid search can fall back to full-text search. | Configure semantic search, embeddings, and a vector store, or use full-text search. |
| Admin maintenance targets a time-limited set | A full search or vector index must not be cleared for a partial repair. | Clear indexes only for unbounded jobs and retain the modification-time filter for partial jobs. |
| Problem reports are disabled, SMTP is unavailable, or the support address is missing | The report is rejected or email delivery fails without a report being accepted as sent. | Enable reports and configure both SMTP and the problem-report destination before exposing the procedure. |
| A session user submits more than the report limit | The service returns TOO_MANY_REQUESTS and does not send another report. | Use the report-specific rate limit and keep it separate from the global procedure limits. |
| A worker or impersonated server call is treated as a user session | Trusted work can be throttled by user-facing limits or a user can gain an internal path. | Build internal contexts only on the server and keep the internal auth type distinct. |
Key files
| File | Why to read it |
|---|---|
| packages/…/index.ts | Shows the HTTP route tree and shared middleware order. |
| packages/…/package.json | Shows the service package boundary and its HTTP, tRPC, validation, and metrics dependencies. |
| packages/…/trpc.ts | Shows how the root tRPC router becomes an HTTP endpoint. |
| packages/…/auth.ts | Defines HTTP public, signed-in, and admin access gates. |
| packages/…/apiKeyScopes.ts | Shows scope checks for HTTP routes that do not pass through a tRPC procedure. |
| packages/…/readOnlyMode.ts | Shows the HTTP write guard used when the service is read-only. |
| packages/…/trpcAdapter.ts | Defines tRPC-to-HTTP error conversion. |
| packages/…/assets.ts | Shows asset upload and read access at the HTTP boundary. |
| packages/…/bookmarks.ts | Shows bookmark transport contracts and the link-plus-archive capture flow. |
| packages/…/index.ts | Defines request context, read-only behavior, access levels, scopes, and shared procedure behavior. |
| packages/…/auth.ts | Defines API-key validation, password authentication, and key format compatibility at a high level. |
| packages/…/impersonate.ts | Shows how trusted server calls build an internal user context. |
| packages/…/rateLimit.ts | Shows how rate limits identify users, IPs, and internal calls. |
| packages/…/_app.ts | Maps domain routers into the service contract. |
| packages/…/apiKeys.ts | Shows key creation, exchange, listing, regeneration, and revocation rules. |
| packages/…/invites.ts | Shows the admin invite lifecycle and public acceptance flow. |
| packages/…/email.ts | Shows email side effects for account, list invitation, and problem report delivery. |
| packages/…/problemReports.ts | Shows the session-only support report procedure, diagnostics handoff, and submission limit. |
| packages/…/lists.ts | Shows list access, collaboration, role boundaries, and invitation operations. |
| packages/…/lists.ts | Shows the shared-list view, role boundaries, public-list behavior, and membership cleanup. |
| packages/…/tags.ts | Shows tag ownership, usage views, attachment-source filters, merge behavior, and search reindexing. |
| packages/…/assets.ts | Shows asset ownership, attachment lifecycle, listing totals, ordering, and user-facing asset metadata. |
| packages/…/bookmarks.ts | Shows bookmark response shapes, privacy behavior, readable content, and attachment metadata. |
| packages/…/bookmarks.ts | Shows bookmark creation, de-duplication, search, enrichment triggers, and resource checks. |
| packages/…/admin.ts | Shows administrator controls, connection checks, granular admin scopes, and worker-backed maintenance actions. |
| packages/…/subscriptions.ts | Shows billing actions, provider synchronization, manual tiers, and quota effects. |
| packages/…/users.ts | Shows user creation, local account state, settings, stats, avatar handling, and deletion rules. |
| packages/…/users.ts | Shows the user-facing account procedures and their access level. |
| packages/…/highlights.service.ts | Shows highlight ownership and privacy behavior for shared bookmark views. |
| packages/…/ruleEngine.ts | Shows how bookmark events can trigger user rules and background work. |
| packages/…/search.ts | Shows how search matchers also define smart-list membership. |
| packages/…/attachments.ts | Defines the service-facing asset type map and attach or detach rules. |
| packages/…/sharedLists.test.ts | Demonstrates the external contract for collaboration, privacy, role checks, and access removal. |
| packages/…/apiKeys.test.ts | Demonstrates the API-key lifecycle, scope enforcement, password exchange, and format compatibility. |
| packages/…/subscriptions.test.ts | Demonstrates billing transitions, webhook handling, manual tiers, and quota updates. |
| packages/…/admin.test.ts | Demonstrates granular admin scopes, user management, quota purge, and filtered repair jobs. |
| packages/…/assets.test.ts | Demonstrates asset listing totals and ordering, attachment metadata, ownership, and attach or detach rules. |
| packages/…/bookmarks.test.ts | Demonstrates bookmark contracts, ownership, de-duplication, quotas, search-related behavior, and reading progress. |
| packages/…/users.test.ts | Demonstrates account creation, normalized email behavior, settings, stats privacy, deletion, and avatar rules. |
| packages/…/problemReports.test.ts | Demonstrates report enablement, session-only access, diagnostics delivery, and safe email rendering. |
| packages/…/testUtils.ts | Shows direct caller construction and queue isolation used to test the shared service contract. |
| packages/…/package.json | Shows the tRPC package boundary and its validation, queue-facing, billing, and test tooling dependencies. |
| apps/…/client.ts | Shows server-side context creation and direct router calls. |
| packages/…/trpc-provider.tsx | Shows how remote clients connect to /api/trpc. |
| docs/bookmark-organization-apis.md | Describes bookmark, list, and tag capabilities in more detail. |
| docs/integration-operations-apis.md | Describes integration and administrative capabilities in more detail. |