Profile API
The Profile API provides functions for managing user profiles, builder profiles, and related authentication and permission systems.Implementation Status
Current State: Partially implementing StandardApiResponse patternsType System: Unified BuilderProfileData in progress
Authentication: Clerk-based with role management
Validation: ValidationTier unified with marketplace domain
Core Features Confirmed
- Builder Profile Management: Fetching and updating builder profile data
- Authentication Integration: Clerk-based profile access control
- Permission Management: Owner/admin/public access patterns
- Role Management: CLIENT, BUILDER, ADMIN, SUBSCRIBER roles
- Validation Tier Integration: Using marketplace ValidationTier enum
API Response Structure
StandardApiResponse Pattern (In Progress)
Target Structure (from Mintlify docs):Core API Functions (Verified)
getUserProfile()
Location:/lib/profile/actions.tsType: Server Action
Authentication: Required
- Returns different structure than BuilderProfileResponseData
- Requires manual transformation for component consumption
Profile Data Service Functions
Location:/lib/profile/data-service.tsAccess: Server-side only Functions include profile creation, updates, and data retrieval with proper database integration.
Type Definitions (Session 11 Status)
Core Profile Types
Source of Truth:/lib/profile/types.ts
ValidationTier Integration
✅ COMPLETED: ValidationTier unification with marketplace domainUser Role System
✅ COMPLETED: Enhanced role supportComponent Integration Patterns
Profile Wrapper Pattern
✅ STANDARDIZED: BuilderProfileWrapper following Mintlify patternsComponent Prop Standards
Following Mintlify documentation:Known API Issues (Session 12 Priority)
🚨 Critical Import/Export Issues
⚠️ API Standardization Gaps
- Inconsistent Response Formats: Not all profile endpoints follow StandardApiResponse pattern
- Manual Data Transformation: Some pages manually create BuilderProfile objects
- Property Mismatches: Existing API routes may return different field names
Data Mapping Issues
Problem: API responses don’t always match component expectationsAuthentication Integration
Current Auth Patterns
Clerk Integration: Profile access control through Clerk authenticationPermission System
Access Control: Implemented through ProfilePermissions interfaceMissing Features & Future Considerations
Features Temporarily Disabled
During type unification, these features were temporarily disabled:- Re-integrated into unified interface
- Kept as separate optional features
- Permanently removed
API Endpoints Requiring Standardization
- Profile Creation/Update: Apply StandardApiResponse pattern
- Profile Search: Implement consistent filtering
- Profile Analytics: Standardize metrics endpoints
- Profile Permissions: Consistent access control
Migration Guidelines
For API Route Updates
For Component Updates
Testing Patterns
Profile Component Testing
Verified Patterns from Session 11:See Also
- Profile Architecture
- Component Library Type System
- Marketplace Types (ValidationTier source)
- Authentication Integration
Session 12 Focus Areas
Primary: Fix BuilderProfileData import breakage and complete API standardizationSecondary: Re-evaluate temporarily disabled features for inclusion
Future: Complete migration to StandardApiResponse pattern across all profile endpoints