A Cloudflare Worker to export Google Calendar events as an ICS feed.
- Features
- Requirements
- Installation
- Configuration
- Environment Variables
- Types
- Generate a Google Refresh Token
- Generate a Secret UUID
- Deployment
- Contributing
- Export Google Calendar events as an
.icsfeed - Secure access via a secret UUID
- Authentication through the Google API
- Use
ical-generatorfor ICS creation - Local development & debugging with
wrangler dev - Unit tests with Vitest and Pool-Workers
- Node.js >= 18
- npm or yarn
- Wrangler CLI (
npm install -g wrangler) - Cloudflare account
- Google Service Account credentials (JSON)
git clone https://github.com/ArturGraefenstein/calendar-exporter.git
cd calendar-exporter
npm install- Copy the example calendar config:
cp src/calendar-config.ts.example src/calendar-config.ts
- Add your calendar IDs in
src/calendar-config.ts.
-
Copy the example environment file:
cp .env.example .env
-
Fill in the required variables in
.env:CLIENT_ID: your Google Cloud App client IDCLIENT_SECRET: your Google Cloud App client secret
- Copy the example dev vars file:
cp .dev.vars.example .dev.vars
- You don’t need to change anything here unless you plan to test locally.
- Generate Wrangler types:
npm run typegen
- Run the token generation script:
npm run generate-token
- Follow the prompts and authorize the target Google account to access your calendar.
- Copy the token from the URL parameter
codeand paste it back into the terminal. - The token will be exported to Cloudflare. For local development, add the JSON to your
.dev.varsfile.
- Run the UUID generation script:
npm run generate-uuid
- The UUID will be exported to Cloudflare. For local development, add the UUID to your
.dev.varsfile.
Deploy with Wrangler:
npm run deployContributions are welcome! Please open an issue first.