Help with Recurrence System for calendar Events in Xano

Hello everyone,

I’m building a web app using WeWeb for the frontend and Xano as the backend. I want to implement a recurrence system for events, similar to how Google Calendar handles recurrence.

Here’s my goal:

I have an event with a start and end time (representing the first occurrence). This event needs to repeat according to a recurrence rule based on the following options:

• Daily, on specific weekdays (e.g., Monday to Friday).

• Weekly, on certain days of the week.

• Monthly, on specific dates or days (e.g., the 1st or every 3rd Thursday).

• Ending after a given number of occurrences or by a specific date.

I want to manage this directly within Xano, where I create a specific API call that calculates and returns all occurrences of the event.

For example:

An event starting tomorrow at 9 AM that occurs on weekdays only and ends on December 25th.

Proposed Solution (Inspired by Google Calendar APi documentation)

To handle recurrence, you can break the logic into two main parts:

1. Event Data:

• The event’s start and end time (representing the first occurrence).

• Recurrence rules in a JSON format as a varible in the table event (similar to Google Calendar’s RRULE, RDATE, and EXDATE).

2. Recurrence Processing:

• Use the RRULE field for structured recurrence logic. For example:

• FREQ=DAILY;UNTIL=2024-12-25;BYDAY=MO,TU,WE,TH,FR

This rule represents daily occurrences only on weekdays, ending on December 25th.

• Use the RDATE field to add specific additional dates.

• Use the EXDATE field to exclude specific dates.

Example JSON for Recurrence

Here’s an example JSON for the event mentioned above:

{ "start_datetime": "2024-11-24T09:00:00",

  "end_datetime": "2024-11-24T10:00:00",

  "time_zone": "Europe/Paris",

  "recurrence_rules": {

    "RRULE": "FREQ=DAILY;UNTIL=2024-12-25;BYDAY=MO,TU,WE,TH,FR",

    "RDATE": [],

    "EXDATE": []

  },

  "Event_title": "Visit repartition"

}

Backend Implementation in Xano

To implement this in Xano, my reflexion So far:

1. Store the Event Data: Save the event details in a database table (e.g., events) with fields for start, end, and recurrence rules etc.

2. Calculate Recurrence: Use a custom API endpoint to dynamically calculate occurrences based on the RRULE, RDATE, and EXDATE fields.

• Start from the start_datetime and loop based on the FREQ, UNTIL, or COUNT rules.

• Include dates from RDATE and exclude those in EXDATE.

3. Return the Results: Return a list of all calculated occurrences.

4.Create new event for every recurrency item

My Question

Has anyone implemented a similar recurrence system in Xano? How would you optimize the calculation of occurrences dynamically? Any advice or best practices for managing these rules and ensuring the system is scalable?

Thank you in advance for your help! 😊

1 reply