Action Pattern
All server actions return anActionResult<T> type:
Common Utilities
Authentication & Onboarding
checkUsernameAvailability
Check if a username is available (unauthenticated). Location:app/(onboarding)/hackathon/actions.ts:44
Username to check
Whether the username is available
completeRegistration
Complete hackathon registration and update profile. Location:app/(onboarding)/hackathon/actions.ts:73
User’s display name
Unique username
ISO 3166-1 alpha-2 country code
ISO 3166-2 subdivision code
Experience level
Availability commitment
Team status
Event UUID
createOnboardingProject
Create a project during hackathon onboarding. Location:app/(onboarding)/hackathon/actions.ts:144
Project name
URL-safe slug
Project description
Whether project is new or continuing
Project goal
GitHub repository URL
Event UUID
Profile Management
updateProfile
Update user profile settings. Location:app/(app)/settings/actions.ts:63
Display name
Username (must be unique)
Profile bio
Website URL
Twitter/X handle
GitHub username
Twitch URL
Other stream URL
Country code
Region/subdivision code
Experience level
Allow team invites (privacy setting)
syncAvatarUrl
Sync avatar URL from Clerk. Location:app/(app)/settings/actions.ts:18
Clerk avatar URL or null to remove
Project Management
createProject
Create a new project. Location:app/(app)/projects/actions.ts:27
Project name
URL-safe slug (must be unique)
Project description
Starting point
Project goal
GitHub repository URL
Live demo URL
Optional event ID to link project
Created project slug
updateProject
Update an existing project (owner only). Location:app/(app)/projects/actions.ts:94
Project UUID
Other parameters identical to
createProjectdeleteProject
Delete a project and all related data (owner only). Location:app/(app)/projects/actions.ts:165
Project UUID
Team Management
sendDirectInvite
Send a direct team invite to a specific user. Location:app/(app)/projects/[slug]/team-actions.ts:40
Project UUID
Recipient’s username
generateInviteLink
Generate a shareable invite link. Location:app/(app)/projects/[slug]/team-actions.ts:124
Project UUID
Invite token (UUID v4)
respondToInvite
Accept or decline a direct invite. Location:app/(app)/projects/[slug]/team-actions.ts:166
Invite UUID
Whether to accept the invite
acceptInviteLink
Accept a link-based invite. Location:app/(app)/projects/[slug]/team-actions.ts:219
Invite token
Project slug after joining
revokeInvite
Revoke a pending invite (sender only). Location:app/(app)/projects/[slug]/team-actions.ts:289
Invite UUID
removeTeamMember
Remove a team member (project owner only). Location:app/(app)/projects/[slug]/team-actions.ts:322
Project UUID
Profile UUID of member to remove
leaveProject
Leave a project as a team member. Location:app/(app)/projects/[slug]/team-actions.ts:357
Project UUID
Project owners cannot leave their own project.
searchUsersForInvite
Search for users to invite to a project. Location:app/(app)/projects/[slug]/team-actions.ts:391
Project UUID
Search query (min 2 characters)
Array of user objects with
id, displayName, usernameAdmin Actions
hideUser / unhideUser
Hide or unhide a user from public listings (moderator+). Location:app/admin/users/actions.ts:36 | actions.ts:76
Profile UUID to hide/unhide
banUser / unbanUser
Ban or unban a user (moderator to ban, admin to unban). Location:app/admin/users/actions.ts:113 | actions.ts:184
Profile UUID to ban/unban
Ban reason (optional)
deleteUser
Permanently delete a user and all data (admin only). Location:app/admin/users/actions.ts:239
Profile UUID to delete
setUserRole
Change a user’s role (admin only). Location:app/admin/roles/actions.ts:14
Profile UUID
New role
searchProfilesByName
Search profiles by name or username (admin only). Location:app/admin/roles/actions.ts:76
Search query (min 2 characters)
Array of profiles with
id, displayName, username, avatarUrl, role, clerkIdSearch Actions
searchUsers
Search users by username or display name. Location:app/(onboarding)/hackathon/actions.ts:208
Search query (min 2 characters)
Array of users with
id, displayName, usernamesearchProjects
Search projects by name. Location:app/(onboarding)/hackathon/actions.ts:245
Search query (min 2 characters)
Optional profile ID to filter by owner
Array of projects with
id, name, descriptioncheckProjectSlugAvailability
Check if a project slug is available. Location:app/(onboarding)/hackathon/actions.ts:283
Slug to check (min 2 chars, alphanumeric + hyphens)
Whether the slug is available
Error Handling
Unique Constraint Violations
All actions use theisUniqueViolation() helper to detect duplicate key errors:
Sentry Integration
All errors are captured with context:Best Practices
- Always revalidate paths after mutations
- Use transactions for multi-table operations
- Validate ownership before mutations
- Rate limit sensitive operations
- Atomically claim contested resources (invites, etc.)
- Non-blocking external calls (Discord, Clerk) with Sentry fallback
- Type-safe inputs with Zod validation via
parseInput()