# Round 29 — Plugin Distribution & Marketplace UI

**Date**: 2026-04-30
**Status**: ✅ COMPLETE

---

## 🎯 שאלה

**איך marketplace UI נראה? איך developer מעלה? איך tenant מתקין?**

---

## 🏆 Verdict: 3 surfaces — Discover, Install, Develop

---

## 🛍️ Surface 1 · Discover (`apps.clastop.app`)

### UI Layout
```
┌──────────────────────────────────────────┐
│  🔍 Search:  [_____________] [filter]   │
│                                            │
│  Categories                               │
│  • All (482)                              │
│  • Writers (56)                           │
│  • Distribution (89)                      │
│  • Multimedia (124)                       │
│  • Integrations (76)                      │
│  • Vertical (45)                          │
│  • Games (32)                             │
│  • AI (60)                                │
│                                            │
│  Featured (3 plugins this week)           │
│  ┌──────┐ ┌──────┐ ┌──────┐              │
│  │ icon │ │ icon │ │ icon │              │
│  │ name │ │ name │ │ name │              │
│  │ desc │ │ desc │ │ desc │              │
│  │ ★4.8 │ │ ★4.9 │ │ ★4.7 │              │
│  └──────┘ └──────┘ └──────┘              │
│                                            │
│  Top Rated                                │
│  ┌──────┐ ┌──────┐ ┌──────┐ ┌──────┐    │
│  │      │ │      │ │      │ │      │    │
│  └──────┘ └──────┘ └──────┘ └──────┘    │
└──────────────────────────────────────────┘
```

### A2UI representation
ה-marketplace **עצמו** רץ ב-A2UI! ה-`AppStoreView` component מ-Round 5 (existing in maariv-cms/sections/appstore).

```json
{
  "id": "marketplace-root",
  "component": "AppStoreView",
  "categories": [...],
  "plugins": { "template": "plugin-card", "data": "/plugins" }
}
```

dogfood — Master Jason renders the marketplace OF Master Jason plugins.

---

## 🚀 Surface 2 · Install Flow

### Steps
1. tenant admin clicks "Install" on plugin card
2. ה-BottomSheet (Round 8 vaul) פותח עם:
   - Plugin details
   - Capabilities requested (e.g. "Read articles", "Send emails")
   - Pricing info
   - Reviews
3. Click "Install for $99/month"
4. Stripe checkout (already integrated — clastop has Stripe)
5. Plugin installed in tenant scope
6. Confirmation toast

### Backend
```python
async def install_plugin(tenant_id, plugin_id):
    # 1. Verify pricing accepted
    subscription = await stripe.create_subscription(...)

    # 2. Validate plugin manifest
    plugin = await fetch_plugin(plugin_id)
    if not plugin.compatible_with(get_tenant(tenant_id)):
        raise IncompatibleError

    # 3. Install
    await db.insert("tenant_plugins", tenant_id=tenant_id, plugin_id=plugin_id)
    await clastop_mega.plugin_install(plugin)
    await assets_router.register(plugin.assets)

    # 4. Notify
    await emit_event("on_plugin_installed", tenant_id=tenant_id, plugin_id=plugin_id)
```

---

## 👨‍💻 Surface 3 · Developer Console

### Sections
- **My Plugins** — list, status (draft/review/published)
- **Submit New** — upload ZIP
- **Earnings** — Stripe Connect dashboard
- **Analytics** — installs, usage, revenue
- **Reviews** — incoming user feedback

### Submit Flow
1. Upload ZIP → automatic validation
2. If valid → enter "Pending Review" queue
3. Marketplace team reviews (manual + automated tests)
4. If approved → publish + notify developer
5. If rejected → email with reasons

### Stripe Connect setup
Developer connects their bank account → automatic monthly payouts (70% of revenue).

---

## 📊 Economics

עבור marketplace בשלב בוגר (year 2):
- 500 plugins
- 50 paying tenants × avg 5 plugins each = 250 active subscriptions
- avg $50/month per subscription = **$12,500/month MRR**
- clastop 30% = $3,750/month revenue
- developers split $8,750/month
- **Revenue at scale**: $150K/year clastop + $1M/year for ecosystem

---

## ✅ Closure
✅ **Round 29 closed.**
