RepositoryTypeScript
natelindev

natelindev/tsdav

WebDAV, CALDAV, and CARDDAV client for js runtimes and the Browser

362stars
60forks
1issues
5views

Featured achievements

The project's latest awards

1
TINIX TRENDING·Topic: ical

#1 Repository of the week

1
TINIX TRENDING·Topic: calendars

#1 Repository of the week

1
TINIX TRENDING·Topic: addressbook

#1 Repository of the week

webdav request made easy

Bundlephobia Types NPM Version MIT License

Features

  • Easy to use, well documented JSON based WEBDAV API
  • Works in Browsers, Node.js (>= 18), Bun, Deno, and Cloudflare Workers
  • Supports Both commonjs and esm
  • OAuth2 & basic auth helpers built-in
  • Native typescript, fully linted and well tested
  • Supports WEBDAV, CALDAV, CARDDAV
  • Tested with multiple cloud providers

Install

npm install tsdav

or

yarn add tsdav

Quickstart

Google CALDAV
import { createDAVClient } from 'tsdav';

(async () => {
  const client = await createDAVClient({
    serverUrl: 'https://apidata.googleusercontent.com/caldav/v2/',
    credentials: {
      tokenUrl: 'https://accounts.google.com/o/oauth2/token',
      username: 'YOUR_EMAIL_ADDRESS',
      refreshToken: 'YOUR_REFRESH_TOKEN_WITH_CALDAV_PERMISSION',
      clientId: 'YOUR_CLIENT_ID',
      clientSecret: 'YOUR_CLIENT_SECRET',
    },
    authMethod: 'Oauth',
    defaultAccountType: 'caldav',
  });

  const calendars = await client.fetchCalendars();

  const calendarObjects = await client.fetchCalendarObjects({
    calendar: calendars[0],
  });
})();
Apple CARDDAV
import { createDAVClient } from 'tsdav';

(async () => {
  const client = await createDAVClient({
    serverUrl: 'https://contacts.icloud.com',
    credentials: {
      username: 'YOUR_APPLE_ID',
      password: 'YOUR_APP_SPECIFIC_PASSWORD',
    },
    authMethod: 'Basic',
    defaultAccountType: 'carddav',
  });

  const addressBooks = await client.fetchAddressBooks();

  const vcards = await client.fetchVCards({
    addressBook: addressBooks[0],
  });
})();

After v1.1.0, you have a new way of creating clients.

Google CALDAV
import { DAVClient } from 'tsdav';

const client = new DAVClient({
  serverUrl: 'https://apidata.googleusercontent.com/caldav/v2/',
  credentials: {
    tokenUrl: 'https://accounts.google.com/o/oauth2/token',
    username: 'YOUR_EMAIL_ADDRESS',
    refreshToken: 'YOUR_REFRESH_TOKEN_WITH_CALDAV_PERMISSION',
    clientId: 'YOUR_CLIENT_ID',
    clientSecret: 'YOUR_CLIENT_SECRET',
  },
  authMethod: 'Oauth',
  defaultAccountType: 'caldav',
});

(async () => {
  await client.login();

  const calendars = await client.fetchCalendars();

  const calendarObjects = await client.fetchCalendarObjects({
    calendar: calendars[0],
  });
})();
Apple CARDDAV
import { DAVClient } from 'tsdav';

const client = new DAVClient({
  serverUrl: 'https://contacts.icloud.com',
  credentials: {
    username: 'YOUR_APPLE_ID',
    password: 'YOUR_APP_SPECIFIC_PASSWORD',
  },
  authMethod: 'Basic',
  defaultAccountType: 'carddav',
});

(async () => {
  await client.login();

  const addressBooks = await client.fetchAddressBooks();

  const vcards = await client.fetchVCards({
    addressBook: addressBooks[0],
  });
})();

Documentation

Check out the Documentation

License

MIT

Changelog

refers to Changelog

Debugging

this package uses debug package, add tsdav:* to DEBUG env variable to enable debug logs

FAQ

Can I use token-based auth (e.g., OIDC) with Nextcloud?

Yes, if your Nextcloud instance is configured to support it (e.g., via the user_oidc app), you can use authMethod: 'Bearer':

const client = new DAVClient({
  serverUrl: 'https://<your-nextcloud-host>/remote.php/dav',
  credentials: {
    accessToken: 'YOUR_OIDC_ACCESS_TOKEN',
  },
  authMethod: 'Bearer',
  defaultAccountType: 'caldav',
});

Note: Some Nextcloud configurations may still require Basic auth (username + app password) for DAV endpoints if OIDC is not fully integrated with the DAV subsystem.

Similar Projects

Discover other similar projects and AI models.

RepositoryGo
emersion/go-webdav

A Go library for WebDAV, CalDAV and CardDAV

503
Nov 25, 2026
RepositoryKotlin
bitfireAT/davx5-ose

DAVx⁵ is an open-source CalDAV/CardDAV suite and sync app for Android. You can also access your online files (WebDAV) with it.

3.1k
Dec 1, 2026
RepositoryRust
lennart-k/rustical

a calendar server aiming to be simple, fast and passwordless

604
Dec 1, 2026
RepositoryRust
stalwartlabs/stalwart

All-in-one Mail & Collaboration server. Secure, scalable and fluent in every protocol (IMAP, JMAP, SMTP, CalDAV, CardDAV, WebDAV).

16.7k
Dec 1, 2026
RepositoryPHP
tchapi/davis

🗓 A modern, simple, feature-packed, fully translatable admin interface for sabre/dav based on Symfony 7 and Bootstrap

769
Nov 19, 2026
RepositoryPython
jelmer/xandikos

A CalDAV/CardDAV server backed by Git

611
Nov 19, 2026
RepositoryRust
pimalaya/cardamum

CLI to manage contacts

50
Nov 27, 2026
RepositoryTypeScript
ridafkih/keeper.sh

Calendar sync tool & universal calendar MCP server. Aggregate, sync and control calendars on Google, Outlook, Office 365, iCloud, CalDAV or ICS.

1.5k
Nov 30, 2026
RepositoryTypeScript
perry-mitchell/webdav-client

WebDAV client written in Typescript for NodeJS and the browser

816
Nov 19, 2026