Live Demo: Generate Calendar

The Challenge

Keeping track of weekly anime releases usually involves checking external websites or manually updating a calendar. I wanted a solution that:

  1. Automatically syncs with my AniList watch history.
  2. Integrates natively into Google Calendar or Apple Calendar.
  3. Requires zero maintenance (serverless).

The Approach: Cloudflare Workers

I chose Cloudflare Workers for this project because of their low latency and generous free tier. The application acts as a middleware between the AniList GraphQL API and the ICS calendar standard.

Workflow

  1. Request: User hits the worker URL with their username.
  2. Fetch: Worker queries AniList’s GraphQL API for the user’s “Currently Watching” list.
  3. Transform: The JSON response is parsed and converted into the iCalendar (ICS) text format.
  4. Response: The worker serves the .ics file with correct MIME types, allowing calendar apps to subscribe directly.

Addressing Timezones

One of the trickiest parts was handling airing times. AniList provides Unix timestamps, which need to be correctly formatted for the ICS standard:

// Converting Unix timestamp to ICS date string
function formatToICSDate(date: Date): string {
    return date.toISOString().replace(/[-:]/g, '').split('.')[0] + 'Z';
}

Outcome

This project demonstrates the power of edge computing for personal utilities. Instead of spinning up a full VPS or container, a single script handles API integration, data transformation, and serving—scaled automatically by Cloudflare’s network.