WorkOS Docs Homepage
Events
API referenceDashboardSign In
Event typesEvent typesData syncingOverviewOverviewSyncing with events APISyncing with events APISyncing with webhooksSyncing with webhooksData reconciliationData reconciliation
Syncing to external databasesSyncing to external databases
PostgresPostgresMySQLMySQLNeonNeonPlanetScalePlanetScaleMongoDB AtlasMongoDB AtlasClickHouse CloudClickHouse CloudMonitoring and OperationsMonitoring and Operations
ObservabilityStreaming to DatadogStreaming to Datadog
API Reference
API Reference
Integrations
Integrations
Migrate to WorkOS
Migrate to WorkOS
SDKs
SDKs

PlanetScale

Mirror your WorkOS data into PlanetScale Postgres or Vitess.

On this page

  • Introduction
  • Sync to Postgres
  • Sync to Vitess
  • Branches and queries

Introduction

PlanetScale hosts Postgres and Vitess, a MySQL-compatible database. The sync engine connects through each engine’s standard protocol using @workos/sync-postgres or @workos/sync-mysql.

The PlanetScale integration guide in the sync engine repository covers database creation, roles, connection strings, TLS, endpoint verification, and deployment.

Sync to Postgres

Follow the Postgres guide with your PlanetScale connection string as DATABASE_URL. The sync needs a role that can create the mirror’s schema and objects; the default read/write role is not enough for initialization.

Keep sslmode=verify-full, but remove sslrootcert=system from PlanetScale’s connection string when using the Node.js driver. See the repository’s Postgres setup for the role, connection options, TLS behavior, and commands.

Sync to Vitess

Use the MySQL destination, with two PlanetScale-specific considerations:

  • The branch is the database. Set WORKOS_SYNC_SCHEMA to the branch’s database name rather than letting the sync create a separate workos database.
  • Safe migrations control schema changes. On a protected production branch, apply the mirror’s schema through a PlanetScale deploy request rather than running DDL directly.

Follow the repository’s Vitess setup for credentials, the required TLS CA configuration, and the safe-migrations workflow. The @workos/sync-mysql README is the reference for commands and configuration.

Branches and queries

Each branch needs its own credentials and mirror initialization. Syncs sharing a WorkOS environment also share its API rate limit. See Branches before setting up additional mirrors.

Query the mirror’s _live views to exclude deleted objects. See Query it for Postgres and Vitess examples.

MongoDB Atlas Mirror your WorkOS data into MongoDB Atlas from your own host
Up next
© WorkOS, Inc.
FeaturesAuthKitSingle Sign-OnDirectory SyncAdmin PortalFine-Grained Authorization
DevelopersDocumentationChangelogAPI Status
ResourcesBlogPodcastPricingSecuritySupport
CompanyAboutCustomersCareersLegalPrivacy
© WorkOS, Inc.