Server-Side Scheduling
Bounded recurrence, ICS, cleanup, and runtime checks for headless applications.
Core computation runs without a DOM and ships as ESM with no runtime package dependencies. That is useful in Node.js, serverless functions and compatible edge runtimes. Optional network/Worker/browser helpers still depend on their host APIs; verify the actual runtime and bundler.
Bounded recurrence queries
import { RecurrenceEngine } from '@forcecalendar/core';
const event = {
id: 'standup', title: 'Standup',
start: new Date('2026-10-05T09:00:00Z'),
end: new Date('2026-10-05T09:15:00Z'),
recurring: true, recurrenceRule: 'FREQ=WEEKLY;BYDAY=MO,WE,FR;COUNT=12',
timeZone: 'UTC',
};
const upcoming = RecurrenceEngine.takeOccurrences(event, 3, {
after: new Date('2026-10-01T00:00:00Z'),
before: new Date('2026-11-01T00:00:00Z'),
timezone: 'UTC',
});This example deliberately uses UTC. Lazy queries avoid materializing an entire open-ended series, but still require explicit workload bounds. Do not assume every recurrence completes within a fixed request budget. See iterator semantics and the V2 timezone contract and limits.
Generate an ICS snapshot
import { Calendar, ICSHandler } from '@forcecalendar/core';
const calendar = new Calendar({ timeZone: 'UTC' });
try {
calendar.addEvent({
id: 'review', title: 'Review',
start: new Date('2026-10-05T14:00:00Z'),
end: new Date('2026-10-05T15:00:00Z'),
});
const ics = new ICSHandler(calendar).export({ calendarName: 'Reviews' });
console.log(ics); // Serve as text/calendar using your host's response API.
} finally {
calendar.destroy();
}Always dispose owned Calendars/EventStores when finished, especially in jobs and tests. Stop any independent ICS subscription handles as well. File download helpers need a browser; return the ICS string from server routes instead.
Deployment responsibilities
- Authorize access to calendar data before queries, exports or mutations.
- Bound input size, event count, expansion windows, concurrency and response size.
- Set egress policies for ICS URL imports.
- Test host/event timezone combinations and DST transitions; use occurrence
start/endaccording to the engine's documented contract. - Keep IDs stable and use reconciliation for data reloads.
- Treat text as data; calendar storage does not authorize an agent to execute work.
The examples repository contains platform starters, including server-side scheduling. A starter is not proof of production certification on every platform.