Data Snapshots & Offline Sync
About 145 wordsLess than 1 minute
2026-09-01
External anime data follows a dual-plane model: requests happen during explicit synchronization, while pages read local JSON snapshots. Runtime pages do not call Bangumi or Bilibili directly.
Sync Commands
pnpm anime:sync --provider bangumi
pnpm anime:sync --provider bilibiliThe entry point is scripts/anime/sync.mjs; providers live in scripts/anime/providers/. Credentials are read only during synchronization and must not be stored in posts or committed.
Snapshot Lifecycle
- The script reads
animeConfigand environment variables. - A provider calls its API, sanitizes the response, and writes a local snapshot.
src/pages/anime.astroand page components consume the snapshot during build.- Commit snapshots intended for publishing; deployment needs no external API request.
When a sync fails, keep the last valid snapshot. Check credentials, user IDs, network access, and rate limits before retrying.
Copyright
Copyright Ownership:matsuzaka-yuki
License under:Attribution 4.0 International (CC-BY-4.0)