Skip to content

Latest commit

 

History

History
604 lines (506 loc) · 18.9 KB

File metadata and controls

604 lines (506 loc) · 18.9 KB

Service Category & Filter System

Clean, scalable approach for organizing SMM panel services using categories and filters instead of creating thousands of individual service entries.


System Architecture

Hierarchical Structure

Platform (Brand)
  └── Service Type (Subcategory)
      └── Provider Services (with attributes as filters)

Example Flow

Instagram
  ├── Followers
  │   ├── Provider A Service: USA Premium ($3.50/1k) [filters: country=USA, quality=premium]
  │   ├── Provider B Service: Brazil HQ ($1.20/1k) [filters: country=BR, quality=high]
  │   └── Provider C Service: India Standard ($0.30/1k) [filters: country=IN, quality=standard]
  │
  ├── Likes
  │   ├── Provider A: Instant Likes ($0.80/1k) [filters: speed=instant]
  │   ├── Provider B: Auto Likes ($15/month) [filters: type=subscription]
  │   └── Provider C: Random Likes ($0.40/1k) [filters: type=random]
  │
  ├── Views
  │   ├── Story Views ($0.30/1k)
  │   ├── Reel Views ($0.20/1k)
  │   └── IGTV Views ($0.25/1k)
  │
  └── Comments
      ├── Random Comments ($2/10)
      └── Custom Comments ($5/10)

Category Definitions

Level 1: Platform (Brand)

Main platforms users can select from:

const PLATFORMS = [
  { id: 'instagram', name: 'Instagram', icon: 'instagram.svg' },
  { id: 'tiktok', name: 'TikTok', icon: 'tiktok.svg' },
  { id: 'youtube', name: 'YouTube', icon: 'youtube.svg' },
  { id: 'facebook', name: 'Facebook', icon: 'facebook.svg' },
  { id: 'twitter', name: 'Twitter/X', icon: 'twitter.svg' },
  { id: 'spotify', name: 'Spotify', icon: 'spotify.svg' },
  { id: 'twitch', name: 'Twitch', icon: 'twitch.svg' },
  { id: 'kick', name: 'Kick', icon: 'kick.svg' },
  { id: 'telegram', name: 'Telegram', icon: 'telegram.svg' },
  { id: 'linkedin', name: 'LinkedIn', icon: 'linkedin.svg' },
  // ... more platforms
];

Level 2: Service Type (Subcategory)

Service types available per platform:

const SERVICE_TYPES = {
  instagram: [
    { id: 'followers', name: 'Followers', icon: 'users' },
    { id: 'likes', name: 'Likes', icon: 'heart' },
    { id: 'views', name: 'Views', icon: 'eye' },
    { id: 'comments', name: 'Comments', icon: 'message' },
    { id: 'saves', name: 'Saves', icon: 'bookmark' },
    { id: 'shares', name: 'Shares', icon: 'share' },
    { id: 'live', name: 'Live Stream', icon: 'video' },
    { id: 'igtv', name: 'IGTV', icon: 'tv' },
    { id: 'reels', name: 'Reels', icon: 'play' },
    { id: 'story', name: 'Story', icon: 'image' },
  ],
  tiktok: [
    { id: 'followers', name: 'Followers', icon: 'users' },
    { id: 'likes', name: 'Likes', icon: 'heart' },
    { id: 'views', name: 'Views', icon: 'eye' },
    { id: 'shares', name: 'Shares', icon: 'share' },
    { id: 'comments', name: 'Comments', icon: 'message' },
    { id: 'live', name: 'Live Stream', icon: 'video' },
  ],
  youtube: [
    { id: 'subscribers', name: 'Subscribers', icon: 'users' },
    { id: 'views', name: 'Views', icon: 'eye' },
    { id: 'likes', name: 'Likes', icon: 'thumbs-up' },
    { id: 'comments', name: 'Comments', icon: 'message' },
    { id: 'watch_time', name: 'Watch Time', icon: 'clock' },
    { id: 'shorts', name: 'Shorts', icon: 'play' },
    { id: 'live', name: 'Live Stream', icon: 'video' },
  ],
  twitch: [
    { id: 'followers', name: 'Followers', icon: 'users' },
    { id: 'live_viewers', name: 'Live Viewers', icon: 'video' },
    { id: 'channel_views', name: 'Channel Views', icon: 'eye' },
    { id: 'chat', name: 'Chat Activity', icon: 'message' },
    { id: 'clips', name: 'Clips', icon: 'play' },
  ],
  // ... more platforms
};

Level 3: Filters/Attributes

Filters applied to services to help users find what they need:

Common Filters (Apply to Most Services)

const FILTERS = {
  // Quality/Tier
  quality: [
    { value: 'premium', label: 'Premium (90-100% real)', color: 'purple' },
    { value: 'high', label: 'High Quality (70-90% real)', color: 'blue' },
    { value: 'standard', label: 'Standard (40-70% real)', color: 'gray' },
    { value: 'economy', label: 'Economy (<40% real)', color: 'slate' },
  ],

  // Geographic
  country: [
    { value: 'USA', label: 'United States 🇺🇸', tier: 'premium' },
    { value: 'UK', label: 'United Kingdom 🇬🇧', tier: 'premium' },
    { value: 'CA', label: 'Canada 🇨🇦', tier: 'premium' },
    { value: 'BR', label: 'Brazil 🇧🇷', tier: 'standard' },
    { value: 'IN', label: 'India 🇮🇳', tier: 'economy' },
    { value: 'TR', label: 'Turkey 🇹🇷', tier: 'economy' },
    { value: 'WW', label: 'Worldwide 🌍', tier: 'standard' },
    // ... more countries
  ],

  // Speed
  speed: [
    { value: 'instant', label: 'Instant (0-1 hour)' },
    { value: 'fast', label: 'Fast (1-6 hours)' },
    { value: 'medium', label: 'Medium (6-24 hours)' },
    { value: 'slow', label: 'Slow/Natural (1-7 days)' },
  ],

  // Refill Guarantee
  refill: [
    { value: '0', label: 'No Refill' },
    { value: '7', label: '7 Days Refill' },
    { value: '30', label: '30 Days Refill' },
    { value: '60', label: '60 Days Refill' },
    { value: '90', label: '90 Days Refill' },
    { value: '365', label: '1 Year Refill' },
    { value: 'lifetime', label: 'Lifetime Refill' },
  ],

  // Price Range
  priceRange: [
    { value: 'budget', label: 'Budget ($0-1/1k)' },
    { value: 'standard', label: 'Standard ($1-3/1k)' },
    { value: 'premium', label: 'Premium ($3-5/1k)' },
    { value: 'luxury', label: 'Luxury ($5+/1k)' },
  ],

  // Features
  features: [
    { value: 'drip_feed', label: 'Drip Feed Available' },
    { value: 'auto_refill', label: 'Auto Refill' },
    { value: 'non_drop', label: 'Non-Drop Guarantee' },
    { value: 'instant_start', label: 'Instant Start' },
    { value: 'cancel_anytime', label: 'Cancel Anytime' },
  ],
};

Service-Specific Filters

const SPECIFIC_FILTERS = {
  // For Followers
  followers: {
    gender: [
      { value: 'mixed', label: 'Mixed Gender' },
      { value: 'male', label: 'Male Only' },
      { value: 'female', label: 'Female Only' },
    ],
    age: [
      { value: 'teen', label: 'Teen (13-17)' },
      { value: 'young', label: 'Young Adult (18-24)' },
      { value: 'adult', label: 'Adult (25-34)' },
      { value: 'mature', label: 'Mature (35+)' },
    ],
    niche: [
      { value: 'crypto', label: 'Crypto/NFT' },
      { value: 'fitness', label: 'Fitness & Health' },
      { value: 'fashion', label: 'Fashion & Beauty' },
      { value: 'gaming', label: 'Gaming' },
      { value: 'tech', label: 'Technology' },
      { value: 'travel', label: 'Travel' },
      { value: 'food', label: 'Food & Cooking' },
      { value: 'business', label: 'Business' },
    ],
  },

  // For Comments
  comments: {
    type: [
      { value: 'random', label: 'Random Comments' },
      { value: 'custom', label: 'Custom Comments' },
      { value: 'positive', label: 'Positive Only' },
      { value: 'emoji', label: 'Emoji Comments' },
    ],
  },

  // For Likes
  likes: {
    type: [
      { value: 'instant', label: 'Instant Likes' },
      { value: 'auto', label: 'Auto Likes (Subscription)' },
      { value: 'random', label: 'Random Distribution' },
    ],
  },

  // For Views
  views: {
    subtype: [
      { value: 'post', label: 'Post Views' },
      { value: 'story', label: 'Story Views' },
      { value: 'reel', label: 'Reel Views' },
      { value: 'igtv', label: 'IGTV Views' },
    ],
    retention: [
      { value: 'low', label: 'Low Retention (30-50%)' },
      { value: 'medium', label: 'Medium Retention (50-70%)' },
      { value: 'high', label: 'High Retention (70-90%)' },
      { value: 'premium', label: 'Premium Retention (90-100%)' },
    ],
  },

  // For Live Stream Services
  live_viewers: {
    duration: [
      { value: '30min', label: '30 Minutes' },
      { value: '1hour', label: '1 Hour' },
      { value: '2hours', label: '2 Hours' },
      { value: '5hours', label: '5 Hours' },
    ],
    type: [
      { value: 'concurrent', label: 'Concurrent Viewers' },
      { value: 'chat_active', label: 'With Chat Activity' },
      { value: 'premium', label: 'Premium Engagement' },
    ],
  },
};

Database Schema

Simplified Schema

// Service Categories (Platform > Type)
model ServiceCategory {
  id          String   @id @default(uuid())
  platform    Platform
  type        String   // followers, likes, views, etc.
  name        String
  description String?
  icon        String?
  order       Int      @default(0)
  isActive    Boolean  @default(true)

  services    Service[]

  @@unique([platform, type])
}

// Provider Services (actual services from providers)
model Service {
  id              String           @id @default(uuid())
  categoryId      String
  providerId      String

  // Provider Details
  providerServiceId String         // Provider's internal service ID
  name              String
  description       String?

  // Pricing
  minQuantity       Int
  maxQuantity       Int
  price             Float          // Cost from provider
  resellerPrice     Float?         // Your markup price

  // Attributes (stored as JSON for flexibility)
  attributes        Json           // { quality: 'premium', country: 'USA', speed: 'fast', ... }

  // Service Details
  refillDays        Int?
  averageTime       String?

  // Status
  status            ServiceStatus   @default(ACTIVE)
  isActive          Boolean         @default(true)
  lastSynced        DateTime        @default(now())

  // Relations
  category          ServiceCategory @relation(fields: [categoryId], references: [id])
  provider          ApiProvider     @relation(fields: [providerId], references: [id])
  orders            Order[]

  createdAt         DateTime        @default(now())
  updatedAt         DateTime        @updatedAt

  @@index([categoryId])
  @@index([providerId])
  @@index([status])
}

// Provider Information
model ApiProvider {
  id          String    @id @default(uuid())
  name        String
  apiUrl      String
  apiKey      String    @db.Text
  apiType     String    // 'justanotherpanel', 'perfectpanel', etc.

  isActive    Boolean   @default(true)
  priority    Int       @default(0)

  // Stats
  totalServices  Int     @default(0)
  successRate    Float   @default(100)
  avgResponseTime Int?   // milliseconds

  services    Service[]

  createdAt   DateTime  @default(now())
  updatedAt   DateTime  @updatedAt
}

Attributes JSON Structure

{
  "quality": "premium",
  "country": "USA",
  "speed": "fast",
  "refillDays": 30,
  "features": ["drip_feed", "auto_refill", "non_drop"],
  "gender": "mixed",
  "niche": "crypto",
  "accountType": "active",
  "retention": "high"
}

User Interface Flow

Step 1: Select Platform

┌─────────────────────────────────────────────┐
│         Choose Platform                      │
├─────────────────────────────────────────────┤
│  [Instagram]  [TikTok]  [YouTube]           │
│  [Facebook]   [Twitter] [Spotify]           │
│  [Twitch]     [Kick]    [More...]           │
└─────────────────────────────────────────────┘

Step 2: Select Service Type

Platform: Instagram

┌─────────────────────────────────────────────┐
│         Choose Service Type                  │
├─────────────────────────────────────────────┤
│  👥 Followers                                │
│  ❤️ Likes                                    │
│  👁️ Views                                    │
│  💬 Comments                                 │
│  🔖 Saves                                    │
│  🎬 Reels                                    │
│  📺 IGTV                                     │
│  📱 Story                                    │
└─────────────────────────────────────────────┘

Step 3: Filter Services

Instagram > Followers

┌─────────────────────────────────────────────┐
│         Filters                              │
├─────────────────────────────────────────────┤
│  Quality:    [All] Premium HQ Standard      │
│  Country:    [All] 🇺🇸 USA 🇬🇧 UK 🇧🇷 BR      │
│  Speed:      [All] Instant Fast Medium      │
│  Refill:     [All] 30d 60d 90d Lifetime     │
│  Price:      $0 ━━●━━━━━━ $10 per 1000      │
│  Features:   ☐ Drip Feed ☐ Auto Refill      │
└─────────────────────────────────────────────┘

┌─────────────────────────────────────────────┐
│  Results (24 services found)                 │
├─────────────────────────────────────────────┤
│  [⭐ RECOMMENDED]                            │
│  Instagram Followers - USA Premium          │
│  ✓ 95% Real  ✓ 30d Refill  ✓ Fast          │
│  $3.50 per 1000                             │
│  [Order Now]                                 │
├─────────────────────────────────────────────┤
│  Instagram Followers - Worldwide HQ         │
│  ✓ 80% Real  ✓ 60d Refill  ✓ Medium        │
│  $1.80 per 1000                             │
│  [Order Now]                                 │
├─────────────────────────────────────────────┤
│  Instagram Followers - Brazil Standard      │
│  ✓ 60% Real  ✓ 7d Refill  ✓ Fast           │
│  $0.85 per 1000                             │
│  [Order Now]                                 │
└─────────────────────────────────────────────┘

Filter Logic Examples

Example 1: User Looking for Premium USA Instagram Followers

  1. Select Platform: Instagram
  2. Select Type: Followers
  3. Apply Filters:
    • Quality: Premium
    • Country: USA
  4. System shows all services matching:
    WHERE category.platform = 'INSTAGRAM'
      AND category.type = 'followers'
      AND attributes->>'quality' = 'premium'
      AND attributes->>'country' = 'USA'
    ORDER BY price DESC

Example 2: Budget-Friendly TikTok Views

  1. Platform: TikTok
  2. Type: Views
  3. Filters:
    • Price Range: Budget ($0-1/1k)
    • Speed: Any
  4. System shows:
    WHERE category.platform = 'TIKTOK'
      AND category.type = 'views'
      AND resellerPrice <= 1.00
    ORDER BY resellerPrice ASC

Provider Service Sync Process

Auto-Sync Flow

async function syncProviderServices(providerId) {
  // 1. Fetch services from provider API
  const providerServices = await fetchProviderServices(providerId);

  // 2. For each service, categorize it
  for (const svc of providerServices) {
    // Parse service name to extract platform and type
    const { platform, type, attributes } = parseServiceName(svc.name);

    // Find or create category
    const category = await findOrCreateCategory(platform, type);

    // Create or update service
    await upsertService({
      categoryId: category.id,
      providerId: providerId,
      providerServiceId: svc.service,
      name: svc.name,
      price: svc.rate,
      resellerPrice: svc.rate * 1.20, // 20% markup
      minQuantity: svc.min,
      maxQuantity: svc.max,
      attributes: attributes, // Store as JSON
      refillDays: extractRefillDays(svc.name),
      averageTime: svc.averageTime,
    });
  }
}

Service Name Parsing Example

function parseServiceName(serviceName) {
  // Input: "Instagram Followers - USA Premium [30d Refill]"

  const rules = [
    { pattern: /instagram/i, platform: 'INSTAGRAM' },
    { pattern: /followers/i, type: 'followers' },
    { pattern: /USA|United States/i, country: 'USA' },
    { pattern: /premium|ultra|HQ/i, quality: 'premium' },
    { pattern: /\[(\d+)d refill\]/i, refillDays: '$1' },
  ];

  return {
    platform: 'INSTAGRAM',
    type: 'followers',
    attributes: {
      country: 'USA',
      quality: 'premium',
      refillDays: 30,
    }
  };
}

Benefits of This Approach

Scalability

  • Add unlimited providers
  • Each provider adds their services automatically
  • No manual service creation

Flexibility

  • Attributes stored as JSON = easily add new filters
  • No schema changes needed for new service variations
  • Provider-specific attributes preserved

Clean UX

  • Simple navigation: Platform → Type → Filter
  • Users find exactly what they need
  • No overwhelming service lists

Easy Maintenance

  • Auto-sync keeps services updated
  • Providers manage their own inventory
  • You just manage categories

Competition

  • Multiple providers for same category
  • Best price wins
  • Automatic failover

Migration from Current System

If you have existing services:

-- Step 1: Create categories from existing services
INSERT INTO ServiceCategory (platform, type, name)
SELECT DISTINCT platform,
       LOWER(category) as type,
       category as name
FROM Service;

-- Step 2: Link existing services to categories
UPDATE Service s
SET categoryId = (
  SELECT id FROM ServiceCategory sc
  WHERE sc.platform = s.platform
    AND sc.type = LOWER(s.category)
);

-- Step 3: Extract attributes from service names/descriptions
UPDATE Service
SET attributes = jsonb_build_object(
  'quality', extractQuality(name),
  'country', extractCountry(name),
  'speed', extractSpeed(name)
);

Summary

This category-based system gives you:

  1. Clean hierarchy: Platform → Type → Filtered Services
  2. Flexible attributes: JSON-based filters for any variation
  3. Auto-sync: Providers manage inventory, you manage categories
  4. Simple UX: Easy navigation and filtering
  5. Infinite scalability: Add providers and services without schema changes

The catalog document serves as your reference guide for understanding all possible variations, but you don't create them manually - providers fill them in automatically!