Skip to content

Add connector sync hub for 3rd party services - #2

Merged
itsthisjustin merged 4 commits into
mainfrom
feat-3rd-party-connectors
Aug 7, 2026
Merged

Add connector sync hub for 3rd party services#2
itsthisjustin merged 4 commits into
mainfrom
feat-3rd-party-connectors

Conversation

@itsthisjustin

Copy link
Copy Markdown
Contributor

Implements server-side fan-out sync to external reading services. Includes encrypted credential vault (AES-256-GCM), automatic book matching with title/author normalization, coalescing retry queue with exponential backoff, and management API for linking/unlinking services. Progress updates and highlights automatically sync to connected services. Requires TOKEN_ENC_KEY environment variable to enable.

Implements server-side fan-out sync to external reading services. Includes encrypted credential vault (AES-256-GCM), automatic book matching with title/author normalization, coalescing retry queue with exponential backoff, and management API for linking/unlinking services. Progress updates and highlights automatically sync to connected services. Requires TOKEN_ENC_KEY environment variable to enable.
Implements stateless HMAC-signed session cookies for browser-based authentication alongside existing device header auth. The /api/v1 endpoints now accept either session cookies (for web UI) or x-auth headers (for firmware). Adds session creation/verification utilities and new auth/web routes. Includes static assets (favicon, logo) for the web interface.
Introduces a separate accounts table for website authentication, distinct from kosync device credentials. Kosync users can be linked to a master account via account_id foreign key, allowing orphaned kosync accounts to be claimed later. One kosync user per master account enforced by unique index.
Allows connectors to be registered but hidden from the UI connector list, preventing users from linking them through the interface while keeping them available programmatically.
@itsthisjustin
itsthisjustin merged commit a3eb196 into main Aug 7, 2026
2 of 3 checks passed
@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 67555863-8018-4b70-98bd-a925fdc276e0

📥 Commits

Reviewing files that changed from the base of the PR and between 067f908 and fdf91f8.

⛔ Files ignored due to path filters (2)
  • assets/favicon.png is excluded by !**/*.png
  • assets/logo.png is excluded by !**/*.png
📒 Files selected for processing (40)
  • Dockerfile
  • README.md
  • docs/API.md
  • docs/BUILD_STATUS.md
  • docs/design/hardcover-sync.md
  • docs/design/sync-hub.md
  • migrations/0003_connectors.sql
  • migrations/0004_master_accounts.sql
  • src/app.ts
  • src/auth/middleware.ts
  • src/auth/session.ts
  • src/connectors/bookfusion.ts
  • src/connectors/fanout.ts
  • src/connectors/hardcover.ts
  • src/connectors/kosync.ts
  • src/connectors/matching.ts
  • src/connectors/queue.ts
  • src/connectors/readwise.ts
  • src/connectors/registry.ts
  • src/connectors/runner.ts
  • src/connectors/store.ts
  • src/connectors/types.ts
  • src/crypto/secrets.ts
  • src/index.ts
  • src/models/position.ts
  • src/models/stats.ts
  • src/routes/account.ts
  • src/routes/auth.ts
  • src/routes/kosync.ts
  • src/routes/v1/clippings.ts
  • src/routes/v1/connectors.ts
  • src/routes/v1/progress.ts
  • src/routes/web.ts
  • test/account.test.ts
  • test/connectors-more.test.ts
  • test/connectors.test.ts
  • test/helpers.ts
  • test/matching.test.ts
  • test/queue.test.ts
  • test/secrets.test.ts

📝 Walkthrough

Walkthrough

This change adds master accounts, signed sessions, encrypted connector credentials, four connector adapters, queued synchronization, connector APIs, a server-rendered web interface, database migrations, documentation, and integration tests.

Changes

Sync Hub

Layer / File(s) Summary
Accounts, authentication, and encryption
migrations/*, src/auth/*, src/crypto/*, src/routes/auth.ts, src/routes/account.ts, src/app.ts, src/index.ts
Adds master accounts, signed session cookies, session-or-device authentication, account linking, account deletion, AES-256-GCM credential encryption, and conditional queue-worker startup.
Connector contracts, matching, storage, and queue
src/connectors/types.ts, src/connectors/matching.ts, src/connectors/store.ts, src/connectors/queue.ts
Adds connector interfaces, metadata matching, encrypted account persistence, document matches, event coalescing, retries, and dead-letter handling.
Built-in connector adapters
src/connectors/kosync.ts, src/connectors/hardcover.ts, src/connectors/readwise.ts, src/connectors/bookfusion.ts, src/connectors/registry.ts
Adds KoSync, Hardcover, Readwise, and BookFusion validation, matching, event delivery, and device-link flows.
Fan-out, retries, and connector APIs
src/connectors/fanout.ts, src/connectors/runner.ts, src/routes/v1/connectors.ts, src/routes/v1/progress.ts, src/routes/v1/clippings.ts, src/routes/kosync.ts
Adds event fan-out, queued delivery, connector linking and unlinking, match overrides, rematching, and progress or highlight forwarding.
Web management interface
src/routes/web.ts, Dockerfile
Adds account and connector management pages, device-code polling, browser actions, branding, and runtime asset packaging.
Integration and unit validation
test/*
Adds coverage for accounts, sessions, connectors, matching, queue retries, encryption, fan-out, and device linking.
API, design, and build documentation
README.md, docs/*, src/models/*
Documents encryption configuration, connector APIs, build status, synchronization design, connector feasibility, and deployment requirements.

Estimated code review effort: 5 (Critical) | ~120 minutes

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 Trivy (0.72.0)

Trivy execution failed: 2026-08-07T07:37:28Z FATAL Fatal error run error: fs scan error: scan error: scan failed: failed analysis: post analysis error: post analysis error: ansible scan error: fs filter error: fs filter error: walk error range error: stat .coderabbit-opengrep-fallback.3ebad8de-054a-483b-8785-797554100a15.yml: no such file or directory: range error: stat .coderabbit-opengrep-fallback.3ebad8de-054a-483b-8785-797554100a15.yml: no such file or directory


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant