SuperAPI AI Directory

build-convex-clerk-swiftui

Coding & development

View repository

Updated 10-16 04:12

About this skill

Build Convex With Clerk Backend For SwiftUI Devs

Use this skill to keep Swift-side guidance and Convex-backend guidance aligned. Use the repo-local references for the broad Convex/Swift mental model, and use the verified Clerk facts captured in the auth, client-sdk, playbook, and operations docs here for official clerk-convex-swift / WorkoutTracker behavior.

Workflow

  1. Decide whether Convex fits the product.
  2. If starting from scratch, follow the setup walkthrough.
  3. Reset the mental model before recommending architecture.
  4. Lock auth and root ownership.
  5. Design the backend before wiring the UI.
  6. Design client consumption and ownership.
  7. Load only the platform and advanced docs that match the task.
  8. For a complete example app, read references/walkthrough/ (chat app from zero).
  9. For fast lookup, use references/quick-reference/ (cheat sheets, decision trees, SQL mapping).
  10. Before you answer with confidence, read references/operations/01-verified-corrections-and-trust-boundaries.md and surface any relevant limitation from references/operations/02-known-gaps-limitations-and-non-goals.md.

Default Stance

  • Prefer Clerk as the default Swift auth path. Use the official ClerkConvex package (clerk-convex-swift >= 0.1.0) with clerk-ios >= 1.0.0 and convex-swift >= 0.8.0.
  • Prefer one @MainActor long-lived authenticated client per process, created with ConvexClientWithAuth(deploymentUrl:authProvider: ClerkConvexAuthProvider()).
  • Prefer ObservableObject plus @StateObject for subscription-owning models.
  • Treat tokenIdentifier as the canonical server ownership key, enforced via convex-helpers userQuery/userMutation wrappers.
  • Use AuthView() and UserButton() from ClerkKitUI for interactive sign-in and user management. Do not build manual client.login() flows.
  • Treat the official WorkoutTracker sample as the default small-app baseline, not as proof of every production or macOS architecture rule.
  • Add .prefetchClerkImages() and .environment(Clerk.shared) on root views.
  • Treat subscriptions as bounded live reads, not endless full-history pipes.
  • Treat iOS as reconnecting-online, not offline-first.
  • Treat macOS support as Apple Silicon only.
  • Target iOS 17+ / macOS 14+ minimum (required by clerk-convex-swift).

Hard Rules

  • Do not recommend Convex as the default when offline-first, SQL-heavy, unsupported-platform, or Intel-macOS requirements are real blockers.
  • Do not promise optimistic updates, native offline persistence, Catalyst support, watchOS support, tvOS support, or visionOS support.
  • Do not use client-passed userId values for authorization design.
  • Do not use .filter() or unbounded .collect() as the normal backend query strategy.
  • Do not use Date.now() in Convex queries.
  • Do not store unbounded growing arrays inside one document.
  • Do not recommend long-lived view .task ownership for important shared live data.
  • Do not assume subscription recovery after a terminal failure unless you explicitly rebuild the pipeline.
  • Do not repeat stale or corrected claims without checking the operations docs.

Reference Map

Start Here

Setup

Onboarding

Backend

Client SDK

SwiftUI

Authentication

Platforms

Advanced

Pitfalls

Walkthrough

Quick Reference

Testing

Playbooks

Operations