API & server functions
MigrateTo's app code calls server functions defined in src/lib/*.functions.ts. They're typed RPCs over HTTP; every authenticated call carries your session bearer.
Calling a server function from the client
import { useServerFn } from '@tanstack/react-start'
import { getMyProfile } from '@/lib/profile.functions'
const fetchProfile = useServerFn(getMyProfile)
const { data } = useQuery({ queryKey: ['profile'], queryFn: fetchProfile })Authentication
- Every function wrapped with
requireSupabaseAuthneeds a valid bearer token (added automatically by our client). - Public functions live under
/api/public/*file routes and verify signatures themselves (webhooks, callbacks). - Role checks use the
has_any_roleRPC; client cannot bypass.
Reference
Profile — src/lib/profile.functions.ts
getMyProfile· GET · returns display name, avatar URL (signed), email.updateMyProfile· POST ·{ displayName?, avatarPath? }.createAvatarUploadUrl· POST · returns a signed URL to upload directly to storage.getNotificationPrefs/updateNotificationPrefs.listMyWorkspaces· GET · workspaces + your role on each.
Workspaces — src/lib/workspaces.functions.ts
listWorkspaces,createWorkspace,updateWorkspace,deleteWorkspace.
Members — src/lib/members.functions.ts
listMembers,inviteMember,updateMemberRole,removeMember.
Figma — src/lib/figma.functions.ts + figma-oauth.functions.ts
setFigmaPAT,testFigmaConnection,importFigmaFile,reingestFigmaFile.
Dataverse — src/lib/dataverse.functions.ts
setDataverseConnection,testDataverseConnection,syncTables,listTables,listColumns.
Mapping & generation
mappings.functions.ts—saveBinding,listBindings,deleteBinding.mapping-templates.functions.ts—saveTemplate,applyTemplate.generation.functions.ts—startGeneration,getTask,cancelTask,listRecent.
Packages & deploy
packages.functions.ts—buildPackage,getDownloadUrl,listPackages.deploy.functions.ts— pipeline scaffolding only; actual deploy is run by your CLI / pipeline.
SSO, security, audit
sso.functions.ts—provisionConnection,verifyDomain,listInvitations,enforceSSO.security.functions.ts—getSecurityPolicy,updateSecurityPolicy,getSecurityPosture.audit.functions.ts—listAuditEvents,exportAuditCsv.
Billing & usage
billing.functions.ts—getBillingStatus,createCheckoutSession.usage.functions.ts—getUsage,getCreditHistory.
Developer & misc
developer.functions.ts— API tokens, webhook secrets.comments.functions.ts— preview comments.review.functions.ts— review packets.components.functions.ts— Figma component catalog.
Source is the spec
We don't publish an OpenAPI document; the source files are the canonical reference and TypeScript types are exported. Browse
src/lib/*.functions.ts in your IDE for exact input/output shapes.Was this page helpful?Send feedback →