convex-better-auth-dual-database

Provision and synchronize users across Better Auth and Convex data stores.

Updated Jan 23, 2026
One-click install
npx skills add https://github.com/strataga/claude-skill-inception --skill convex-better-auth-dual-database
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: convex-better-auth-dual-database
Source: https://github.com/strataga/claude-skill-inception/tree/main/convex-better-auth-dual-database
Command: npx skills add https://github.com/strataga/claude-skill-inception --skill convex-better-auth-dual-database

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

When using Convex with Better Auth, user data can end up split between the Better Auth component tables and the app's own users table. This mismatch leads to confusing errors such as "User not found" during login or password reset even when a user exists in one store.

Core Features & Use Cases

  • Unified provisioning: ensure that creating or syncing a user creates corresponding records in both Better Auth and the app’s users table.
  • Admin onboarding & remediation: provide steps to manually create admin users in production and resolve divergence between data stores.
  • Verification & maintenance: offer guidance to verify consistency by checking both data stores after provisioning.

Quick Start

Use the Skill to provision and synchronize a new admin user across both stores.

  1. Create a Better Auth user via API: curl -X POST "https://yourapp.com/api/auth/sign-up/email"
    -H "Content-Type: application/json"
    -d '{"email": "[email protected]","password": "your-password","name": "Admin User"}'
  2. Create the corresponding app user via a Convex mutation: npx convex run --prod adminSetup:createAdminUser
    '{"email": "[email protected]", "name": "Admin", "setupSecret": "your-secret"}'
  3. Verify that the user exists in both data stores:
    • Check _components/betterAuth/user/documents.jsonl
    • Check users/documents.jsonl

Frequently Asked Questions about convex-better-auth-dual-database

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
Why does Better Auth show a user not found error during login when using Convex?

To provision an admin user, first create the Better Auth user via the sign-up API, then run a Convex mutation to generate the corresponding app user. Finally, verify both records exist by checking the user documents in both data stores.

What is the best way to sync users between Better Auth and a Convex database?

Syncing users requires explicit provisioning steps to ensure corresponding records exist in both Better Auth and your app's users table. You create the auth user via API, provision the app user via a Convex mutation, and verify cross-store consistency.

How do I manually create an admin user in a Convex and Better Auth setup?

You can manually create an admin in production by calling the Better Auth sign-up API, then running an admin setup Convex mutation with a setup secret. This ensures the admin is provisioned reliably across both data stores.

How can I verify consistency between Better Auth component tables and my app users table?

Verify cross-store consistency by checking the user documents in both the Better Auth component table and the app's users table directly. Inspecting these stores ensures the provisioning process created matching records.

Can I use Better Auth with Convex if my users table is already populated?

Yes, but you must resolve the data divergence. The Skill provides remediation steps to manually provision missing Better Auth users and synchronize them with your existing app users table to prevent authentication errors.