Projects
projects.list
Get all projects for the authenticated user with preview attachments.previewAttachment field (most recent image attachment from latest message).
Authentication: Returns empty array if not authenticated.
projects.listShowcase
Get up to 12 public projects that have at least one fragment (for showcase page).messageCount and hasFragment fields.
Authentication: Public query (no auth required).
projects.get
Get a single project by ID.projectId: Id<"projects">- Project ID
projects.getForSystem
Get a project without authentication (system-level, for Inngest only).projectId: Id<"projects">- Project ID
projects.getForUser
Get a project for a specific user (for background jobs/Inngest).userId: string- Clerk user IDprojectId: Id<"projects">- Project ID
Messages
messages.list
Get all messages for a project with fragments and attachments.projectId: Id<"projects">- Project ID
Fragment (object or null) and Attachment (array) fields.
Throws: If user doesn’t own the project
messages.get
Get a single message by ID.messageId: Id<"messages">- Message ID
messages.getFragment
Get the fragment for a message.messageId: Id<"messages">- Message ID
messages.getAttachments
Get all attachments for a message.messageId: Id<"messages">- Message ID
messages.getFragmentById
Get a fragment by ID (public, no auth).fragmentId: Id<"fragments">- Fragment ID
messages.getFragmentByIdAuth
Get a fragment by ID with authorization check.fragmentId: Id<"fragments">- Fragment ID
fragment, message, and project fields
Throws: If user doesn’t own the project
messages.listForUser
List messages for a specific user (for background jobs/Inngest).userId: string- Clerk user IDprojectId: Id<"projects">- Project ID
fragment and attachments fields
Usage & Credits
usage.getUsage
Get current credit usage for the authenticated user.- Free: 5/day
- Pro: 100/day
- Unlimited: Unlimited
usage.getUsageForUser
Get usage for a specific user (for actions).userId: string- Clerk user ID
getUsage
Subscriptions
subscriptions.getSubscription
Get active subscription for the authenticated user.subscriptions.getSubscriptionByPolarId
Get subscription by Polar subscription ID.polarSubscriptionId: string- Polar subscription ID
subscriptions.getUserSubscriptions
Get all subscriptions for a user.userId: string- Clerk user ID
Imports
imports.getImport
Get an import by ID.importId: Id<"imports">- Import ID
imports.listByProject
List all imports for a project.projectId: Id<"projects">- Project ID
imports.listByUser
List all imports for the authenticated user.OAuth Connections
oauth.getConnection
Get OAuth connection for a provider.provider: "figma" | "github"- OAuth provider
oauth.listConnections
List all OAuth connections for the authenticated user.Rate Limiting
rateLimit.getRateLimitStatus
Get current rate limit status for a key.key: string- Rate limit key
Agent Runs
agentRuns.listPendingForProject
List pending agent runs for a project (WebContainer execution).projectId: Id<"projects">- Project ID
Helper Functions
These are internal helpers used in mutations and queries:requireAuth
Ensure user is authenticated and return their Clerk user ID.getCurrentUserId
Get current user ID or null.hasProAccess
Check if user has active Pro subscription.true if user has active Pro subscription
hasUnlimitedAccess
Check if user has active Unlimited subscription.true if user has active Unlimited subscription