Replies: 1 comment 2 replies
-
This feels related to the "Live Content Loaders" proposal which we recently moved to Stage 2 of our RFC process: #1151 It might make sense to consolidate proposals and leave any feedback you have in that issue. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Body
Summary
Extend Astro's Content Collections with mutable storage capabilities for on-demand routes, allowing content to be synced at runtime without requiring full site rebuilds.
Background & Motivation
Astro's Content Collections provide an excellent developer experience for managing content, but currently have limitations around content syncing. The content store is immutable after build time, requiring full site rebuilds for any content changes.
Users building more dynamic sites face a dilemma: use Content Collections and sacrifice content freshness, or bypass collections entirely and implement custom data fetching logic. Live content loaders could be a solution for highly-dynamic pages, like news sites, but there is still a gap for content that changes occasionally but not on every request.
Many websites need a middle ground - content that updates periodically or in response to webhooks (post saved, etc.), without fetching from the source on every page load. For example, help centers, documentation sites, blogs, typically change throughout the day but don't require real-time data for every visitor. This gap becomes particularly problematic when integrating with external APIs that have rate limits.
A mutable content store would provide the best of both worlds: the type-safety and developer experience of Content Collections with the ability to update content without rebuilds, while protecting against API rate limits or slow APIs through efficient data reuse.
Goals
"Non-goals":
Example
Mutable store would be provided by adapters:
It could reuse the work already done for Sessions.
During initialization, data store snapshot would be fetched from a configured storage (e.g. Cloudflare KV) instead of a JSON file, with a fallback to a standard data store.
It would be possible to re-sync selected collections and write the resulting snapshot to the mutable store, so it's later used in on-demand routes.
When it comes to invoking re-sync, I'm thinking maybe via webhook:
or maybe periodically:
Beta Was this translation helpful? Give feedback.
All reactions