Google Workspace
One shared OAuth2 connector behind Sheets sync, Drive media/backup and Docs import — bring your own Google Cloud client, fail-soft when not connected.
Cartwright integrates with Google Workspace through one shared server-side OAuth2 connector (lib/google/). Three feature modules sit on top of it; each is a separate, default-off flag. Customer "Continue with Google" sign-in is a separate system — see Google Sign-In.
The connector (infrastructure, no flag)
You bring your own Google Cloud OAuth client. Paste the client ID/secret in /admin/integrations (stored encrypted in IntegrationSettings, same AES-256-GCM pattern as Stripe), or set GOOGLE_OAUTH_CLIENT_ID / GOOGLE_OAUTH_CLIENT_SECRET in the environment. Then connect your Google account once from the admin UI.
- Incremental scopes — only the scopes the enabled modules need are requested (Sheets / Drive / Docs).
- Fail-soft — with no credentials or no connection, every Google surface is silently inert; nothing throws at render.
- Tokens are stored encrypted on a
GoogleConnectionsingleton; refresh is skew-aware and single-flight (concurrent refreshes can't clobber the rotated token). Disconnect is local-authoritative (remote revoke is best-effort; local state always clears).
The connector requires no brand.features flag — it's inert until you add credentials and connect. The modules below are each flag-gated and default OFF.
The modules
Sheets ↔ catalog sync
sheetsSync — two-way product/stock/price sync
Drive media + backup
googleDrive — import images, push DB backups
Docs → content import
docsImport — a Doc becomes a draft post/page
Google Sign-In (separate)
googleAuth — customer login, different OAuth client
Required environment
# Shared Workspace connector (Sheets / Drive / Docs):
GOOGLE_OAUTH_CLIENT_ID= # or set in /admin/integrations (encrypted)
GOOGLE_OAUTH_CLIENT_SECRET=
CRON_SECRET= # for the sheets-sync / drive-backup cronsEach module's page lists its specific scope and admin surface. With every flag off, an existing shop is byte-identical — none of these change behaviour until you opt in.
Google Sign-In
A "Continue with Google" button for customer login via NextAuth — flag-gated, env-gated, and never a path to admin.
Google Sheets sync
Two-way sync between a Google Sheet and your product catalog — pull (upsert by SKU, never deletes) and push (clears stale rows), with a CRON_SECRET-gated cron.