Complete specification for asset generation, branding, and distribution
╔═══════════════════════════════════════════════════════════════════════════════╗
║ SOCIAL MEDIA ASSET SYSTEM - COMPLETE FLOW ║
╚═══════════════════════════════════════════════════════════════════════════════╝
┌───────────────────────────────────────────────────────────────────────────────┐
│ PHASE 1: ASSET CREATION (Studio Owner) │
└───────────────────────────────────────────────────────────────────────────────┘
┌──────────────────────┐
│ CREATION METHOD │
│ SELECTION │
└──────────┬───────────┘
│
┌──────────┴────────────────────────┐
│ │
▼ ▼
┌────────────────┐ ┌──────────────────┐
│ USE TEMPLATE │ │ UPLOAD CUSTOM │
└────────────────┘ └──────────────────┘
│ │
├─► Browse template library ├─► Upload image file
├─► Filter by: ├─► Validate:
│ • Business type │ • Format: PNG/JPG/WEBP
│ • Category │ • Size: <10MB
│ • Format (square/story) │ • Dimensions recommended
├─► Select template(s) ├─► Set metadata:
│ │ • Name, description
▼ │ • Category, format
┌────────────────────────────┐ │ • Caption, hashtags
│ BRANDING ENGINE │ │
│ │ │
│ Inputs: │ ▼
│ • Studio logo │ ┌────────────────────┐
│ • Primary color │ │ CREATE ASSET │
│ • Secondary color │ │ is_custom: true │
│ • Studio name │ │ branded: false │
│ │ └────────────────────┘
│ Process: │ │
│ 1. Load template │ │
│ 2. Apply logo (position) │ │
│ 3. Replace colors │ │
│ 4. Insert studio name │ │
│ 5. Render final image │ │
│ │ │
│ Output: │ │
│ • Branded image URL │ │
│ • Thumbnail URL │ │
└────────────────────────────┘ │
│ │
▼ │
┌────────────────────┐ │
│ CREATE ASSET │ │
│ is_custom: false │ │
│ branded: true │ │
│ template_id: XXX │ │
└────────────────────┘ │
│ │
└──────────────┬───────────────────┘
▼
┌─────────────────┐
│ ASSET ACTIVE │
│ status: active │
│ priority: 0 │
└─────────────────┘
┌───────────────────────────────────────────────────────────────────────────────┐
│ PHASE 2: CAPTION GENERATION (Dynamic Variables) │
└───────────────────────────────────────────────────────────────────────────────┘
Template Caption:
"Join me at {studio_name}! 💪 Get {new_client_reward} when you sign up: {referral_link}"
Variable Replacement (at share time):
├─► {studio_name} → "FitLife Gym"
├─► {referral_link} → "app.com/refer/A7K9M2XQ"
├─► {member_reward} → "$25 credit"
├─► {new_client_reward} → "free 7-day trial"
└─► {member_name} → "Sarah"
Final Caption:
"Join me at FitLife Gym! 💪 Get free 7-day trial when you sign up: app.com/refer/A7K9M2XQ"
Tone Variants (based on brand voice):
┌────────────────────────────────────────────────────────────┐
│ FRIENDLY: │
│ "I love working out at {studio_name}! Join me and get │
│ {new_client_reward}. Here's my link: {referral_link}" │
│ │
│ ENERGETIC: │
│ "🔥 LET'S GO! Training at {studio_name} and it's INSANE! │
│ Get {new_client_reward} - link: {referral_link}" │
│ │
│ CALM: │
│ "Finding peace at {studio_name} 🧘 Would love for you to │
│ join this journey. {new_client_reward}: {referral_link}" │
│ │
│ LUXURY: │
│ "Experience premium wellness at {studio_name}. Exclusive │
│ offer: {new_client_reward}. Discover: {referral_link}" │
│ │
│ HUMOROUS: │
│ "I'm basically a fitness influencer now 😂 Join me at │
│ {studio_name}! {new_client_reward}: {referral_link}" │
└────────────────────────────────────────────────────────────┘
Hashtag Auto-Generation (by business type):
┌────────────────────────────────────────────────────────────┐
│ GYM: #fitness #gym #workout #gains #fitfam │
│ YOGA: #yoga #namaste #wellness #mindfulness │
│ MARTIAL_ARTS: #martialarts #training #discipline #warrior │
│ CROSSFIT: #crossfit #wod #functionalfitness #box │
│ PILATES: #pilates #core #strength #flexibility │
│ DANCE: #dance #dancefitness #movemore #rhythm │
└────────────────────────────────────────────────────────────┘
┌───────────────────────────────────────────────────────────────────────────────┐
│ PHASE 3: MEMBER SHARING FLOW │
└───────────────────────────────────────────────────────────────────────────────┘
Member opens asset gallery
│
▼
┌──────────────────────────┐
│ FILTER ASSETS │
│ • Only status: active │
│ • Only studio_id: match │
│ • Order by: priority │
└──────────────────────────┘
│
▼
Member clicks asset
│
▼
┌──────────────────────────────────────┐
│ SHOW SHARE MODAL │
│ • Asset preview │
│ • Caption with {referral_link} → │
│ member's actual link │
│ • Editable caption field │
│ • Platform share buttons │
└──────────────────────────────────────┘
│
├─► Instagram: Download image + Copy caption
├─► Facebook: Native share API with caption
├─► WhatsApp: Share link with caption
├─► Email: mailto: link with caption
└─► SMS: sms: link with caption
│
▼
┌──────────────────────────────────────┐
│ TRACK SHARE EVENT │
│ CREATE ShareEvent: │
│ • asset_id │
│ • member_id │
│ • platform │
│ • caption_used │
│ • referral_code │
│ • timestamp │
└──────────────────────────────────────┘
│
└─► Update Asset.performance.total_shares++
┌───────────────────────────────────────────────────────────────────────────────┐
│ PHASE 4: ANALYTICS & ATTRIBUTION │
└───────────────────────────────────────────────────────────────────────────────┘
When Lead signs up via referral link:
│
▼
┌──────────────────────────────────────────┐
│ CHECK for ShareEvent in last 7 days │
│ WHERE: │
│ • member_id matches attribution │
│ • referral_code matches │
│ • share_timestamp < lead.created_date │
└──────────────────────────────────────────┘
│
├─ IF found:
│ ├─► Increment ShareEvent.resulted_in_leads
│ ├─► Link ShareEvent.id to Lead
│ └─► Credit click to asset
│
└─ IF not found:
└─► Lead came from direct link share (not tracked share button)
When Lead converts:
│
▼
┌──────────────────────────────────────────┐
│ IF ShareEvent linked: │
│ ├─► Increment resulted_in_conversions │
│ ├─► Increment Asset.total_conversions │
│ └─► Attribution: platform X drove this │
└──────────────────────────────────────────┘
Analytics Queries:
• Best performing asset: ORDER BY total_conversions DESC
• Best performing platform: GROUP BY platform, SUM(conversions)
• Asset ROI: (conversions * avg_ltv) - (shares * 0)
• Member engagement: COUNT(shares) per member
{
"template_types": {
"join_community": {
"category": "community",
"description": "Invite friends to join the studio community",
"caption_variants": {
"friendly": "I'm part of an amazing fitness community at {studio_name}! Would love for you to join us. {referral_link}",
"energetic": "JOIN THE SQUAD at {studio_name}! 🔥 We're crushing goals together! {referral_link}",
"calm": "Finding my balance at {studio_name} 🧘 Join me on this wellness journey: {referral_link}",
"luxury": "I've discovered an exceptional fitness sanctuary at {studio_name}. Experience it: {referral_link}",
"humorous": "I found a gym where I actually show up 😂 Check out {studio_name}: {referral_link}"
},
"visual_elements": ["group workout photo", "community gathering", "high-five moments"],
"recommended_platforms": ["instagram", "facebook"]
},
"free_trial": {
"category": "free_trial",
"description": "Promote the free trial offer for new clients",
"caption_variants": {
"friendly": "Try {studio_name} with me! Get {new_client_reward} - no commitment: {referral_link}",
"energetic": "FREE TRIAL ALERT! 🎉 Get {new_client_reward} at {studio_name}! Link: {referral_link}",
"calm": "Explore wellness at {studio_name}. {new_client_reward} to start gently: {referral_link}",
"luxury": "Complimentary {new_client_reward} to experience {studio_name}: {referral_link}",
"humorous": "Free stuff alert! 🚨 Get {new_client_reward} at {studio_name}: {referral_link}"
},
"visual_elements": ["trial offer badge", "newcomer welcome", "first class photo"],
"recommended_platforms": ["instagram", "facebook", "email"]
},
"referral_reward": {
"category": "referral_reward",
"description": "Highlight what members earn for referring",
"caption_variants": {
"friendly": "We both win! 🎁 You get {new_client_reward}, I get {member_reward} at {studio_name}: {referral_link}",
"energetic": "WIN-WIN! 💰 Get {new_client_reward} + I earn {member_reward}! Join: {referral_link}",
"calm": "Share the journey, share the rewards. {new_client_reward} for you: {referral_link}",
"luxury": "Exclusive rewards for both of us. {new_client_reward} awaits: {referral_link}",
"humorous": "I get paid to brag about my gym 😎 You get {new_client_reward}: {referral_link}"
},
"visual_elements": ["reward icons", "gift imagery", "dual benefit visual"],
"recommended_platforms": ["instagram", "whatsapp", "sms"]
},
"member_spotlight": {
"category": "member_spotlight",
"description": "Feature member success stories",
"caption_variants": {
"friendly": "My fitness journey at {studio_name} has been incredible! Want to start yours? {referral_link}",
"energetic": "TRANSFORMATION ALERT! 💪 Look what {studio_name} helped me achieve: {referral_link}",
"calm": "My wellness transformation at {studio_name} 🌱 Begin yours: {referral_link}",
"luxury": "Achieving my best self at {studio_name}. Your journey begins here: {referral_link}"
},
"visual_elements": ["before/after", "member photo", "achievement badge"],
"recommended_platforms": ["instagram", "facebook"]
},
"special_offer": {
"category": "special_offer",
"description": "Limited-time promotions",
"caption_variants": {
"friendly": "Special offer at {studio_name}! Get {new_client_reward} - limited time: {referral_link}",
"energetic": "🚨 LIMITED TIME! Get {new_client_reward} at {studio_name}! GO: {referral_link}",
"calm": "A special wellness offer awaits you at {studio_name}: {referral_link}",
"luxury": "An exclusive offer from {studio_name}. {new_client_reward}: {referral_link}"
},
"visual_elements": ["countdown timer", "offer badge", "urgency elements"],
"recommended_platforms": ["instagram", "facebook", "email"]
},
"motivational_quote": {
"category": "motivation",
"description": "Inspirational content with CTA",
"caption_variants": {
"friendly": "[QUOTE] - This is what {studio_name} is all about. Join us: {referral_link}",
"energetic": "[QUOTE] 🔥 Living this at {studio_name}! Join the movement: {referral_link}",
"calm": "[QUOTE] 🙏 Finding this truth at {studio_name}: {referral_link}",
"luxury": "[QUOTE] - Embodying excellence at {studio_name}: {referral_link}"
},
"visual_elements": ["quote typography", "inspirational background", "minimalist design"],
"recommended_platforms": ["instagram", "facebook", "pinterest"]
},
"class_schedule": {
"category": "schedule",
"description": "Highlight specific classes or schedules",
"caption_variants": {
"friendly": "Check out the amazing classes at {studio_name}! Find your fit: {referral_link}",
"energetic": "EPIC CLASS LINEUP at {studio_name}! 💥 Find your vibe: {referral_link}",
"calm": "Discover your perfect class at {studio_name}. Explore: {referral_link}",
"luxury": "Curated experiences at {studio_name}. Reserve your session: {referral_link}"
},
"visual_elements": ["class grid", "schedule table", "instructor photos"],
"recommended_platforms": ["instagram", "facebook"]
},
"seasonal_campaign": {
"category": "seasonal",
"description": "Holiday or seasonal promotions",
"caption_variants": {
"friendly": "New year, new you at {studio_name}! 🎉 Get {new_client_reward}: {referral_link}",
"energetic": "SUMMER BODY STARTS NOW! 🌞 Get {new_client_reward} at {studio_name}: {referral_link}",
"calm": "Spring renewal at {studio_name} 🌸 Begin fresh: {referral_link}",
"luxury": "Holiday wellness at {studio_name}. Gift yourself {new_client_reward}: {referral_link}"
},
"visual_elements": ["seasonal imagery", "holiday themes", "time-sensitive badges"],
"recommended_platforms": ["instagram", "facebook", "email"]
}
}
}{
"asset": {
"id": "uuid",
"studio_id": "uuid (indexed)",
"template_id": "uuid | null (if from template)",
"name": "string (required)",
"description": "string",
"category": "enum: community | free_trial | referral_reward | special_offer | motivation | schedule | member_spotlight | instructor_spotlight | seasonal",
"format": "enum: square_post (1080x1080) | story_vertical (1080x1920) | banner_horizontal (1200x628)",
"dimensions": {
"width": "number",
"height": "number"
},
"file_url": "string (cloud storage URL)",
"thumbnail_url": "string",
"branded": "boolean (has studio branding applied)",
"is_custom": "boolean (uploaded by studio vs template)",
"recommended_caption": "string (with {variables})",
"recommended_platforms": "array<string> ['instagram', 'facebook', ...]",
"hashtags": "array<string> ['fitness', 'wellness', ...]",
"status": "enum: active | draft | archived",
"priority": "number (higher = shown first to members, default: 0)",
"performance": {
"total_shares": "number (how many times shared)",
"total_clicks": "number (clicks from this asset's shares)",
"total_conversions": "number (conversions attributed to this asset)"
},
"created_date": "datetime",
"updated_date": "datetime",
"indexes": ["studio_id", "status", "category", "priority"]
},
"asset_template": {
"id": "uuid",
"name": "string",
"description": "string",
"category": "enum (same as asset.category)",
"business_type": "enum: gym | yoga_studio | martial_arts | pilates | crossfit | dance | boutique_fitness | all",
"format": "enum (same as asset.format)",
"base_image_url": "string (template background)",
"layout_config": {
"logo_position": "enum: top_left | top_center | top_right | bottom_left | bottom_center | bottom_right | center",
"logo_size": "enum: small (80px) | medium (120px) | large (180px)",
"text_zones": [
{
"type": "string (headline, body, cta)",
"position": "string (coordinates or anchor)",
"max_chars": "number",
"font_size": "number",
"color": "string (hex, or 'primary', 'secondary')"
}
]
},
"caption_template": "string (with {variables})",
"caption_variants": {
"friendly": "string",
"energetic": "string",
"calm": "string",
"luxury": "string",
"humorous": "string"
},
"recommended_platforms": "array<string>",
"default_hashtags": "array<string>",
"active": "boolean",
"created_date": "datetime"
},
"share_event": {
"id": "uuid",
"asset_id": "uuid (indexed)",
"member_id": "uuid (indexed)",
"studio_id": "uuid (indexed)",
"platform": "enum: instagram | facebook | whatsapp | email | sms | twitter | linkedin | copy_link | other",
"share_method": "enum: native_share | copy_caption | direct_link | download_image",
"caption_used": "string (actual caption they shared)",
"referral_code": "string (member's code)",
"session_id": "string",
"device_type": "enum: mobile | tablet | desktop",
"resulted_in_clicks": "number (clicks tracked from this share)",
"resulted_in_leads": "number (leads from this share)",
"resulted_in_conversions": "number (conversions from this share)",
"share_timestamp": "datetime",
"created_date": "datetime",
"indexes": ["asset_id", "member_id", "platform", "share_timestamp"]
},
"branding_rules": {
"logo_application": {
"max_size_percent": "15% of image dimension",
"preferred_position": "top_right for square, bottom_center for story",
"background": "white rounded rectangle with 20% opacity",
"padding": "20px from edge"
},
"color_replacement": {
"primary_color_targets": ["CTA buttons", "accent elements", "borders"],
"secondary_color_targets": ["backgrounds", "gradient overlays"],
"text_color_auto": "Contrast check (WCAG AA), auto white/black"
},
"text_insertion": {
"studio_name": {
"font": "system_font_bold",
"size": "responsive (5-8% of height)",
"color": "primary_color or white (contrast dependent)"
},
"offer_text": {
"font": "system_font_semibold",
"size": "responsive (4-6% of height)",
"highlight": "background: secondary_color with padding"
}
}
}
}✗ "Please upload a PNG, JPG, or WEBP image"
✗ "File size must be less than 10MB"
✗ "Please provide a name and upload an image"
✗ "Failed to upload asset - please try again"
✗ "Image dimensions should be close to standard"
Scenario: Studio has no logo uploaded
→ Template generates without logo
→ Show warning: "Upload your logo in settings for better branding"
Scenario: Studio has default colors only
→ Use platform default colors (indigo/purple)
→ Suggest: "Customize brand colors in settings"
Scenario: Asset archived while member viewing
→ Show: "This asset is no longer available"
→ Action: Hide from gallery, prevent sharing
Scenario: Member tries to share unapproved asset
→ Check: asset.status === 'active'
→ Show: "This asset is not yet available for sharing"
✗ "Failed to download image - please try again"
✗ "Sharing not supported on this device"
✗ "Failed to copy to clipboard"
✗ "Please allow clipboard access to copy caption"
✓ "Asset uploaded successfully!"
✓ "Generated 3 branded assets!"
✓ "Caption copied!"
✓ "Asset downloaded!"
✓ "Image downloaded & caption copied! Now post to Instagram."
✓ "Priority updated"
✓ "Asset archived"
Page Title: "Asset Library"
Subtitle: "Manage shareable social media content for your members"
Button Labels: "Browse Templates" | "Upload Custom"
Stats Labels: "Total Assets" | "Active" | "Custom" | "Branded"
Filter Label: "All Categories" | "Community" | "Free Trial" | etc.
Empty State: "No Assets Found" → "Create your first asset to get started"
Page Title: "Share & Earn"
Subtitle: "Choose an asset to share with your network"
Info Banner: "Your unique referral link will be automatically added to the caption"
Share Modal Title: "Share: [Asset Name]"
Caption Label: "Your Caption"
Share Section: "Share To:"
Empty State: "No Assets Available" → "Your studio hasn't added any shareable assets yet"
💡 Caption Variables: "Use {referral_link} to auto-insert referral link"
💡 Referral Link: "Your referral link is automatically included"
💡 Instagram Sharing: "Image downloaded & caption copied! Now post to Instagram."
💡 Priority: "Higher priority assets appear first for members"
💡 Branding: "All assets will automatically include your logo and brand colors"
💡 Performance: "Track which assets drive the most conversions"
Instagram: "Image downloaded & caption copied! Paste when you post on Instagram"
Facebook: Opens native share dialog with pre-filled caption
WhatsApp: Opens WhatsApp with caption ready to send
Email: Opens email client with caption in body
SMS: Opens messages app with caption ready
Download: "Asset downloaded!" → saves to device
1. Load template base image (from AssetTemplate.base_image_url)
2. Load studio branding data:
├─ organization.logo_url
├─ organization.primary_color
└─ organization.secondary_color
3. Apply branding layers:
├─ Layer 1: Base template image
├─ Layer 2: Color replacement
│ └─ Replace template placeholder colors with studio colors
├─ Layer 3: Text injection
│ ├─ Insert studio name
│ ├─ Insert offer details
│ └─ Apply brand fonts (if custom)
└─ Layer 4: Logo overlay
├─ Resize logo to fit zone
├─ Add subtle drop shadow
└─ Position based on layout_config
4. Export final image:
├─ Format: JPEG (optimized for social)
├─ Quality: 90% (balance size/quality)
├─ Upload to cloud storage
└─ Return file_url
5. Create Asset record with:
├─ file_url (branded image)
├─ thumbnail_url (same)
├─ branded: true
└─ template_id reference
Available Variables:
{studio_name} → Studio.name{referral_link} → app.com/refer/[member.referral_code]{member_reward} → Campaign.reward_structure.description{new_client_reward} → Campaign client offer description{member_name} → Member.user.full_name{member_first_name} → Member.user.full_name.split(' ')[0]Replacement Logic:
Executed client-side when member opens share modal, ensures real-time data