DHTMLX Scheduler: Two-way sync with Google Calendar (Node.js)
In this guide, you will implement two-way sync between DHTMLX Scheduler and Google Calendar in a small Node.js app:
- Load calendars and events from Google Calendar into Scheduler
- Push Scheduler create/update/delete operations back to Google Calendar
This approach implements two-way sync via API calls (Scheduler → backend → Google Calendar). It does not implement real-time Google → Scheduler push updates (webhooks). If you change events directly in Google Calendar, reload the app (or reload a date range) to see the updated data in Scheduler.
You will build:
- a Node.js + Express backend with Google OAuth 2.0 (Passport) and a small REST API for Scheduler
- an event mapping layer (Google ↔ Scheduler), including basic recurring events/exceptions handling
- a Scheduler client wired to the backend via
scheduler.createDataProcessor()
Prerequisites
- Node.js 18+
- A Google account with access to Google Cloud Console
- Basic familiarity with TypeScript and Express
- Access to DHTMLX Scheduler packages (the example uses
@dhx/trial-scheduler)
Demo repository
A complete working project that matches this guide is available on GitHub:
- https://github.com/dhtmlx/scheduler-google-auth-demo (placeholder - replace with your actual repo)
The guide explains the key steps and shows the integration code that matters. The repository is the "full runnable reference".
Project setup
In this section you will prepare Google OAuth credentials, configure the project, and run the app locally.
1) Get the project code
Do one of the following:
- Clone the repository:
git clone https://github.com/dhtmlx/scheduler-google-auth-demo.git
cd scheduler-google-auth-demo
If your project installs @dhx/* packages from the private registry, configure npm:
npm config set @dhx:registry https://npm.dhtmlx.com
2) Configure Google Cloud (OAuth 2.0)
In this step you will create OAuth credentials that the backend uses to access Google Calendar on behalf of a user.
The guide uses OAuth in Testing mode (recommended for development). In this mode, only users listed as Test users can authorize the app.
2.1 Create or select a Google Cloud project
- Open Google Cloud Console.
- Select an existing project or create a new one.
2.2 Enable Google Calendar API
- Go to APIs & Services → Library.
- Search for Google Calendar API.
- Click Enable.
2.3 Configure the OAuth consent screen
- Go to APIs & Services → OAuth consent screen.
- Choose External (typical for consumer Google accounts), then click Create.
- Fill in the required fields:
- App name
- User support email
- Developer contact email
- Set Publishing status to Testing.
- Add Test users:
- Add the Google accounts you will use to sign in while developing/testing.
If you skip test users in Testing mode, Google will block authorization for accounts that are not explicitly added.
2.4 Create OAuth client credentials
- Go to APIs & Services → Credentials.
- Click Create credentials → OAuth client ID.
- Application type: Web application.
- Add this Authorized redirect URI:
http://localhost:3000/auth/google/callback
- Save and copy:
- Client ID
- Client Secret
2.5 Scope used by this integration
The backend requests Google Calendar access via:
https://www.googleapis.com/auth/calendar
This scope is sufficient for listing calendars and performing event CRUD operations.