Using Supabase to Ingest iCal Feeds and Populate a Booking Table
I am busy building a short term rental management tool EazyAL and one of the features in my roadmap involves importing reservations from a…
Using Supabase to Ingest iCal Feeds and Populate a Booking Table

screenshot of EazyAL Portugal
I am busy building a short term rental management tool *EazyAL* and one of the features in my roadmap involves importing reservations from a platform like Airbnb, without the platforms API.
In this guide, I will walk through how to use Supabase to fetch an iCal link, parse it, and store the events in a bookings table.
The steps :
- Fetch an iCal (.ics) file from a URL
- Parse the calendar data into structured events
- Store or upsert those events into a Supabase table
- Schedule this to run automatically
Step 1: Set Up Your Supabase Table
Start by creating a bookings table, for example :
sql
create table bookings (
id uuid primary key default gen_random_uuid(),
external_id text unique,
title text,
start_time timestamp,
end_time timestamp,
source text,
created_at timestamp default now()
);
Ensure to include external_id because each iCal event has a UID. We’ll use it to avoid duplicates when syncing.
Step 2: Create a Supabase Edge Function
The Supabase Edge Function is used to fetch and process the iCal feed.
Install the Supabase CLI if you haven’t:
Step 3: Parse the iCal Feed
Inside your function, install an iCal parser:
npm install node-ical
Then implement the sync logic:
ts
import { serve } from "https://deno.land/std/http/server.ts";
import ical from "npm:node-ical";
import { createClient } from "https://esm.sh/@supabase/supabase-js";
const supabase = createClient(
Deno.env.get("SUPABASE_URL")!,
Deno.env.get("SUPABASE_SERVICE_ROLE_KEY")!
);
serve(async () => {
try {
const ICAL_URL = "https://example.com/calendar.ics";
// Fetch and parse iCal
const data = await ical.async.fromURL(ICAL_URL);
const events = Object.values(data).filter(
(event: any) => event.type === "VEVENT"
);
const bookings = events.map((event: any) => ({
external_id: event.uid,
title: event.summary,
start_time: event.start,
end_time: event.end,
source: "ical",
}));
// Upsert into Supabase
const { error } = await supabase
.from("bookings")
.upsert(bookings, { onConflict: "external_id" });
if (error) throw error;
return new Response(
JSON.stringify({ message: "Sync successful", count: bookings.length }),
{ headers: { "Content-Type": "application/json" } }
);
} catch (err) {
return new Response(
JSON.stringify({ error: err.message }),
{ status: 500 }
);
}
});
Step 4: Automate the Sync
To keep your bookings up to date, you can:
Option A: Use Supabase Scheduled Functions (if enabled)
Option B: Use an external cron service
Handling Cancellations & Updates
iCal feeds don’t always explicitly delete events. To handle this:
Store a last_seen timestamp
Remove events not present in the latest sync
Final Thoughts
Using Supabase with iCal feeds is a powerful way to unify external booking systems into a single source of truth. With just an Edge Function and a parser, you can build a reliable sync pipeline in under an hour. Oh and if you want to see my tool see alojamento local software.
메타데이터
- post_id
- 0bd0ce6b5a67
- slug
- using-supabase-to-ingest-ical-feeds-and-populate-a-booking-table-0bd0ce6b5a67
- url
- https://medium.com/@smartstack/using-supabase-to-ingest-ical-feeds-and-populate-a-booking-table-0bd0ce6b5a67
- canonical_url
- https://medium.com/@smartstack/using-supabase-to-ingest-ical-feeds-and-populate-a-booking-table-0bd0ce6b5a67
- author_url
- https://medium.com/@smartstack
- status
- ok
- fetched_at
- 2026-06-23 17:05:31