repti-community powers user engagement through intelligent search, multi-channel notifications, community interactions, and advertising features that connect breeders and buyers.
POST /index/animals/{animal_id} # Index animal for searchDELETE /index/animals/{animal_id} # Remove from search indexPOST /index/breeders/{breeder_id} # Index breeder profilePOST /index/rebuild # Rebuild search indexGET /index/status # Index health statusPOST /index/optimize # Optimize search performance
GET /notifications # List user notificationsPOST /notifications/send # Send notificationPUT /notifications/{notification_id}/read # Mark as readDELETE /notifications/{notification_id} # Delete notificationGET /notifications/preferences # User notification settingsPUT /notifications/preferences # Update preferencesPOST /notifications/test # Test notification delivery
GET /community/forums # List forumsGET /community/forums/{forum_id}/posts # Forum postsPOST /community/forums/{forum_id}/posts # Create postGET /community/posts/{post_id} # Post detailsPOST /community/posts/{post_id}/replies # Reply to postPOST /community/posts/{post_id}/vote # Vote on postGET /community/users/{user_id}/activity # User activityPOST /community/follow # Follow user/topic
-- Search index for fast searchingCREATE TABLE search_index ( id UUID PRIMARY KEY DEFAULT gen_random_uuid(), entity_type VARCHAR(50) NOT NULL, -- 'animal', 'breeder', 'article' entity_id UUID NOT NULL, organization_id UUID, title VARCHAR(255) NOT NULL, content TEXT NOT NULL, tags VARCHAR(255)[] DEFAULT '{}', metadata JSONB DEFAULT '{}', visibility VARCHAR(20) DEFAULT 'public', search_vector tsvector, boost_score DECIMAL(3,2) DEFAULT 1.0, indexed_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(), updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(), UNIQUE(entity_type, entity_id));-- Search analyticsCREATE TABLE search_analytics ( id UUID PRIMARY KEY DEFAULT gen_random_uuid(), user_id UUID, query TEXT NOT NULL, entity_type VARCHAR(50), filters JSONB DEFAULT '{}', results_count INTEGER, clicked_result_id UUID, click_position INTEGER, search_duration_ms INTEGER, performed_at TIMESTAMP WITH TIME ZONE DEFAULT NOW());-- Saved searchesCREATE TABLE saved_searches ( id UUID PRIMARY KEY DEFAULT gen_random_uuid(), user_id UUID NOT NULL, name VARCHAR(255) NOT NULL, query_params JSONB NOT NULL, alert_enabled BOOLEAN DEFAULT FALSE, alert_frequency VARCHAR(20) DEFAULT 'daily', last_alerted_at TIMESTAMP WITH TIME ZONE, created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW());
Notification System
Copy
-- Notification preferencesCREATE TABLE notification_preferences ( id UUID PRIMARY KEY DEFAULT gen_random_uuid(), user_id UUID UNIQUE NOT NULL, email_enabled BOOLEAN DEFAULT TRUE, sms_enabled BOOLEAN DEFAULT FALSE, push_enabled BOOLEAN DEFAULT TRUE, in_app_enabled BOOLEAN DEFAULT TRUE, preferences JSONB DEFAULT '{}', -- Specific notification type preferences updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW());-- Notification templatesCREATE TABLE notification_templates ( id UUID PRIMARY KEY DEFAULT gen_random_uuid(), name VARCHAR(100) UNIQUE NOT NULL, template_type VARCHAR(50) NOT NULL, -- 'email', 'sms', 'push', 'in_app' subject_template VARCHAR(255), body_template TEXT NOT NULL, variables JSONB DEFAULT '{}', is_active BOOLEAN DEFAULT TRUE, created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(), updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW());-- Notification queueCREATE TABLE notification_queue ( id UUID PRIMARY KEY DEFAULT gen_random_uuid(), user_id UUID NOT NULL, template_id UUID REFERENCES notification_templates(id), channel VARCHAR(20) NOT NULL, -- 'email', 'sms', 'push', 'in_app' recipient VARCHAR(255) NOT NULL, subject VARCHAR(255), content TEXT NOT NULL, priority INTEGER DEFAULT 5, status VARCHAR(20) DEFAULT 'pending', scheduled_for TIMESTAMP WITH TIME ZONE DEFAULT NOW(), sent_at TIMESTAMP WITH TIME ZONE, delivered_at TIMESTAMP WITH TIME ZONE, error_message TEXT, metadata JSONB DEFAULT '{}', created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW());-- Notification delivery logsCREATE TABLE notification_delivery_logs ( id UUID PRIMARY KEY DEFAULT gen_random_uuid(), notification_id UUID REFERENCES notification_queue(id) ON DELETE CASCADE, event_type VARCHAR(50) NOT NULL, -- 'sent', 'delivered', 'opened', 'clicked', 'bounced' event_data JSONB DEFAULT '{}', occurred_at TIMESTAMP WITH TIME ZONE DEFAULT NOW());
Community Features
Copy
-- Forums and categoriesCREATE TABLE forums ( id UUID PRIMARY KEY DEFAULT gen_random_uuid(), name VARCHAR(255) NOT NULL, description TEXT, category VARCHAR(100), is_active BOOLEAN DEFAULT TRUE, post_count INTEGER DEFAULT 0, last_post_at TIMESTAMP WITH TIME ZONE, created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW());-- Forum postsCREATE TABLE forum_posts ( id UUID PRIMARY KEY DEFAULT gen_random_uuid(), forum_id UUID REFERENCES forums(id) ON DELETE CASCADE, parent_post_id UUID REFERENCES forum_posts(id), -- For replies author_id UUID NOT NULL, title VARCHAR(255), content TEXT NOT NULL, post_type VARCHAR(20) DEFAULT 'post', -- 'post', 'reply', 'question' status VARCHAR(20) DEFAULT 'active', is_pinned BOOLEAN DEFAULT FALSE, is_locked BOOLEAN DEFAULT FALSE, vote_score INTEGER DEFAULT 0, reply_count INTEGER DEFAULT 0, view_count INTEGER DEFAULT 0, last_activity_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(), created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(), updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW());-- Consider creating comments table-- Post votes and reactionsCREATE TABLE post_votes ( id UUID PRIMARY KEY DEFAULT gen_random_uuid(), post_id UUID REFERENCES forum_posts(id) ON DELETE CASCADE, user_id UUID NOT NULL, vote_type VARCHAR(10) CHECK (vote_type IN ('up', 'down')), created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(), UNIQUE(post_id, user_id));-- User following relationshipsCREATE TABLE user_follows ( id UUID PRIMARY KEY DEFAULT gen_random_uuid(), follower_id UUID NOT NULL, followed_id UUID NOT NULL, follow_type VARCHAR(20) DEFAULT 'user', -- 'user', 'forum', 'topic' followed_entity_id UUID, created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(), UNIQUE(follower_id, followed_id, follow_type, followed_entity_id));
Advertising Platform
Copy
-- Ad campaignsCREATE TABLE ad_campaigns ( id UUID PRIMARY KEY DEFAULT gen_random_uuid(), organization_id UUID NOT NULL, campaign_name VARCHAR(255) NOT NULL, campaign_type VARCHAR(50) NOT NULL, -- 'listing_boost', 'banner_ad', 'sponsored_content' target_entity_id UUID, -- listing_id, content_id, etc. targeting_criteria JSONB DEFAULT '{}', budget_cents INTEGER, daily_budget_cents INTEGER, bid_strategy VARCHAR(50) DEFAULT 'cpc', status VARCHAR(20) DEFAULT 'draft', start_date TIMESTAMP WITH TIME ZONE, end_date TIMESTAMP WITH TIME ZONE, created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(), updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW());-- Ad creative contentCREATE TABLE ad_creatives ( id UUID PRIMARY KEY DEFAULT gen_random_uuid(), campaign_id UUID REFERENCES ad_campaigns(id) ON DELETE CASCADE, creative_type VARCHAR(50) NOT NULL, headline VARCHAR(255), description TEXT, image_urls JSONB DEFAULT '[]', call_to_action VARCHAR(100), landing_url VARCHAR(500), is_active BOOLEAN DEFAULT TRUE, created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW());-- Ad performance trackingCREATE TABLE ad_impressions ( id UUID PRIMARY KEY DEFAULT gen_random_uuid(), campaign_id UUID REFERENCES ad_campaigns(id) ON DELETE CASCADE, creative_id UUID REFERENCES ad_creatives(id), user_id UUID, placement VARCHAR(100), event_type VARCHAR(20) NOT NULL, -- 'impression', 'click', 'conversion' cost_cents INTEGER DEFAULT 0, metadata JSONB DEFAULT '{}', occurred_at TIMESTAMP WITH TIME ZONE DEFAULT NOW());-- Ad credits and billingCREATE TABLE ad_credits ( id UUID PRIMARY KEY DEFAULT gen_random_uuid(), organization_id UUID NOT NULL, credit_amount_cents INTEGER NOT NULL, purchase_type VARCHAR(50) NOT NULL, -- 'purchase', 'bonus', 'refund' transaction_id VARCHAR(255), expires_at TIMESTAMP WITH TIME ZONE, created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW());
Click-Through Rate: Ad engagement and effectiveness
Conversion Rate: Ad clicks leading to desired outcomes
Revenue per User: Advertising revenue optimization
repti-community creates the engagement layer that connects ReptiDex users, enabling discovery, communication, and community building around shared interests in reptile breeding and care.