-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Description
Background
The current KV-only architecture has reached its limits regarding feature expansion.
Many requested features (like sorting by time or filtering by domain) are becoming impossible to implement elegantly because KV lacks native query capabilities.
To support the long-term development of Sink, I plan to migrate the core data storage to Cloudflare D1 (SQLite).
What problems will this solve?
By introducing SQL capabilities, we can resolve several long-standing issues at once:
-
Sorting & Pagination
Native support forORDER BY created_at, finally allowing the dashboard to show the newest links first. -
Advanced Filtering
Support for filtering by domain, expiration time, and similar attributes. -
Flexibility
Remove key format restrictions (supporting slugs with/)
and enable features like tagging.
Architecture: D1 + KV Cache
To ensure we don't sacrifice redirection speed, I plan to use a D1 + KV (Cache) hybrid approach:
-
Management (Admin / API)
Reads and writes go to D1 as the Source of Truth, providing full sorting and filtering capabilities. -
Redirection
Prioritizes reading from KV Cache (synced when writing to D1) to maintain extreme performance and low latency.
Impact
-
Breaking Change
The current KV cursor-based pagination API will be deprecated in favor of SQL-based pagination. -
Data Migration
A migration script will be provided to import existing KV data into D1.