État actuel du projet — Ce qui est fait, partiel, ou manquant
Implémenté ✓
Partiel / à compléter
Manquant / non commencé
Scaffold vide (TODO)
Infrastructure & Configuration
Config & Env
Complet
config/ · .env.example
- app.php, database.php, push.php, shopify.php
- Variables VAPID, FCM, MySQL, Shopify
- Routes définies dans config/routes.php
Base de données
Complet
sql/001_initial_schema.sql
- 13 tables : shops, subscribers, campaigns, notifications, push_queue, billing_*…
- Indexes de performance correctement définis
- Vue v_shop_monthly_stats
- Données initiales billing_plans insérées
Push Service (VAPID + FCM)
Complet
app/Services/PushService.php
- sendWebPush() via minishlink/web-push
- sendMobilePush() via FCM HTTP v1
- JWT Google auth pour FCM
- Queue async (queue/markSent/getPending)
Auth Admin (2FA)
Complet
app/Services/TwoFactorService.php · app/Middleware/auth.php
- Login email + code 6 chiffres TTL 10min
- JWT sessions
- Middleware require_auth()
- Routes protégées /api/admin/*
Shopify OAuth
Complet
app/Services/ShopifyOAuthService.php · src/auth/shopify/
- Flow install → authorize → callback
- Échange code → access_token
- HMAC verification webhooks
- makeRequest() générique vers Shopify API
Service Worker
Partiel
public/sw.js
- Fichier présent, servi depuis /sw.js
- Logique push event handler non vérifiée
- Click tracking (notificationclick) à compléter
Backend PHP — API & Services
API Push (/api/push/*)
Partiel
public/api/push/index.php
- GET /vapid-public-key
- POST /subscribe · POST /unsubscribe
- Colonne "subscription" au lieu de "subscription_web" — inconsistance avec le schéma
- Pas d'authentification Shopify sur /subscribe
API Shopify Webhooks
Partiel
public/api/shopify/index.php · src/auth/shopify/webhooks.php
- HMAC verification
- Router topics (orders/create, orders/updated, customers/create)
- handle_order_created() = TODO vide
- handle_customer_created() = TODO vide
- app/uninstalled non implémenté
API Admin (/api/admin/*)
Partiel
public/api/admin/index.php
- GET /dashboard (stats basiques)
- GET/PUT /profile
- Query SQL incorrecte (admin_id dans shops → n'existe pas)
- Pas d'endpoints CRUD campaigns, subscribers, shops
Automations Engine
Manquant
À créer : app/Services/AutomationService.php
- Abandoned cart trigger (30min post-add to cart)
- Back-in-stock trigger
- Price drop trigger
- Order tracking (shipped/delivered)
Billing Shopify
Manquant
À créer : app/Services/BillingService.php
- AppSubscription Shopify GraphQL
- Gestion upgrade/downgrade de plan
- Achat crédits supplémentaires
- Webhooks billing (app_subscriptions/update)
Analytics / ROI Service
Manquant
À créer : app/Services/AnalyticsService.php
- Tracking clics → attributions revenue
- CTR par campagne
- Revenue récupéré par automation
- Dashboard KPIs marchands
Segmentation
Manquant
À créer : app/Services/SegmentService.php
- Segments Shopify (customers, orders)
- Filtres custom (géo, comportement, tags)
- Sync Klaviyo segments
Shopify Service — API calls
Scaffold
app/Services/ShopifyService.php
- getShop() — basique, pas paginé
- createWebhook() — présent
- getCustomers() — non paginé (250 max)
- getOrders(), getProducts() manquants
Frontend React — Shopify App & Admin Panel
Shopify App (Polaris)
Scaffold
src/shopify-app/
- App.jsx — AppProvider basique
- Campaigns.jsx — DataTable vide, aucune data
- SubscriberList.jsx — présent mais vide
- Aucun appel API réel
- Pas de routing interne (React Router)
Admin Panel (React)
Scaffold
src/admin/
- Dashboard.jsx — stub sans données
- Header.jsx — layout présent
- Pages admin PHP (dashboard, shops, campaigns…) présentes mais hardcodées "0"
- Pas de routing React Router dans l'admin
Shared Hooks & Utils
Partiel
src/shared/
- useFetch.js — hook basique
- usePushSubscription.js — présent
- Pas de gestion d'erreurs robuste
- Pas d'intercepteur auth/token
Build System (Vite)
Complet
vite.config.js · package.json
- 2 entrées : shopify-app + admin
- Build vers public/assets/
- HMR en dev
Complétion globale estimée
Infrastructure & Config
90%
Auth Admin (2FA + JWT)
85%
Shopify OAuth
80%
Push Service (VAPID/FCM)
75%
Schéma BDD
70%
Webhooks Shopify
35%
Frontend App Shopify
10%
Automations Engine
0%
Billing Shopify
0%
Analytics / ROI
0%
Segmentation
0%
Intégrations (Klaviyo/Recharge…)
0%
Tables existantes — SQL initial_schema.sql
shops
- idPK · INT
- shop_domainUNIQUE
- access_tokenVARCHAR
- planfree/starter/growth/pro
- notifications_usedINT
- notifications_limitINT default 5000
admins
- idPK
- emailUNIQUE
- shop_idFK → shops
- roleowner/member
- is_activeBOOL
subscribers
- idPK
- shop_idFK
- customer_idShopify customer
- subscription_webJSON VAPID
- subscription_mobileFCM token
campaigns
- idPK
- shop_idFK
- statusdraft/scheduled/sent
- campaign_typemanual/automatic
- target_segmentall/custom
notifications
- idPK
- campaign_idFK
- subscriber_idFK
- statuspending/sent/failed
- clicked_atTIMESTAMP ← tracking
push_queue
- idPK
- payloadJSON
- attempts / max_attemptsretry logic
- statuspending/sent/failed
billing_plans
- namefree/starter/growth/pro
- price0/14/29/59
- featuresJSON
billing_subscriptions
- shopify_subscription_idVARCHAR
- statuspending/active/cancelled
- next_billing_dateDATE
webhooks
- topicShopify topic
- shopify_webhook_idref
- UNIQUE(shop_id, topic)
audit_logs
- actionVARCHAR 100
- changesJSON
- ip_addressVARCHAR
Tables à ajouter — Migrations requises pour les nouvelles features
subscriber_segments (NEW)
- segment_typeshopify/klaviyo/custom
- segment_idexternal ref
- filtersJSON
ab_tests (NEW)
- campaign_idFK
- variantA/B
- title / bodyvariants
- winnerA/B/null
integrations (NEW)
- typeklaviyo/recharge/judgeme
- credentialsJSON encrypted
- is_activeBOOL
- last_sync_atTIMESTAMP
revenue_attribution (NEW)
- notification_idFK
- order_idShopify order
- revenueDECIMAL
- attribution_window24h/7d
smart_delivery_profiles (NEW)
- subscriber_idFK
- timezoneIANA string
- best_hoursJSON [int]
- last_active_atTIMESTAMP
notification_i18n (NEW)
- campaign_idFK
- localefr/en/es/de
- title / bodytranslated
Analyse des gaps — Ce qui manque pour être compétitif
| Feature | Impact business | Où dans le code | Effort | Priorité |
|---|---|---|---|---|
| Webhooks handlers orders/create → automation triggers, customers/create → subscriber |
Blocant — sans ça, 0 automation | public/api/shopify/index.phpapp/Services/AutomationService.php | Moyen | P0 |
| Dashboard ROI marchand Revenue attribué, CTR, notifs envoyées cette semaine |
Rétention critique — évite le churn M1 | app/Services/AnalyticsService.phpsrc/shopify-app/pages/Analytics.jsx | Moyen | P0 |
| Billing Shopify AppSubscription GraphQL, upgrade/downgrade, crédits |
Blocant — pas de revenu sans ça | app/Services/BillingService.phppublic/api/admin/billing.php | Élevé | P0 |
| Frontend App Shopify Polaris complet : campaigns, subscribers, analytics, settings |
UX marchands — nécessaire au lancement | src/shopify-app/pages/src/shopify-app/App.jsx | Élevé | P0 |
| Segmentation audience Shopify Segments API + filtres custom |
Différenciateur vs PushOwl ($79 pour ça) | app/Services/SegmentService.phpsql/ (subscriber_segments table) | Moyen | P1 |
| Intégration Klaviyo Import segments, webhook entrant pour triggering |
Réduit friction adoption massivement | app/Services/KlaviyoService.phpsql/ (integrations table) | Moyen | P1 |
| Intégration Recharge Webhooks subscription renew/fail/pause |
Gap marché unique — personne ne le fait bien | app/Services/RechargeService.phppublic/api/recharge/webhooks.php | Moyen | P1 |
| Smart Delivery Envoi à l'heure optimale par timezone/activité |
+15-25% CTR estimé | app/Services/SmartDeliveryService.phpsql/ (smart_delivery_profiles) | Moyen | P2 |
| A/B Testing 2 variantes titre/body, vainqueur auto après seuil |
Feature premium — upsell Growth | app/Services/ABTestService.phpsql/ (ab_tests table) | Moyen | P2 |
| Géolocalisation Envoyer par pays/timezone depuis subscriber IP |
Marchands internationaux | subscribers table (country, timezone)SegmentService.php | Faible | P2 |
| Builder multilingue Saisir titre/body en plusieurs langues dans le builder |
DX marchands EU/international | sql/ (notification_i18n)Campaigns.jsx (langue selector) | Moyen | P2 |
| Judge.me / Yotpo Push post-livraison pour demander un avis |
Upsell automation UGC | app/Services/ReviewService.php | Faible | P3 |
| Intégration Brevo Utiliser SMTP Brevo comme provider email transactionnel |
Réduire coût d'infra push alternatif | app/Services/MailService.php (déjà présent) | Faible | P3 |
Vue d'ensemble — 4 phases de développement
Séquence d'implémentation recommandée
Phase 1 — Fondations
Webhooks handlers
Backend · P0
Billing Service
Backend · P0
Fix schema inconsistances
BDD · P0
API CRUD complet
Backend · P0
Phase 2 — App Shopify
Frontend Polaris complet
App Shopify · P0
Dashboard ROI
App + Backend · P0
Campaign Builder
App Shopify · P0
Service Worker complet
Frontend · P1
Phase 3 — Features compétitives
Segmentation Shopify
Backend · P1
Intégration Klaviyo
Backend · P1
Intégration Recharge
Backend · P1
Smart Delivery
Backend · P2
Phase 4 — Différenciateurs
A/B Testing
Backend + App · P2
Géolocalisation
Backend · P2
Builder multilingue
App + BDD · P2
Judge.me / Yotpo
Backend · P3
Phase 5 — Admin Panel
Dashboard admin réel
Admin · P1
Gestion shops/marchands
Admin · P1
Logs & monitoring
Admin · P2
Settings intégrations
Admin · P2
🏗️ Phase 1 — Fondations Backend
Requis avant tout le reste
01
Fix inconsistances schéma BDD
Harmoniser les noms de colonnes entre le schéma SQL et les requêtes PHP. Notamment
:
subscription_web vs subscription dans push/index.php,
shop_domain vs domain dans callback.php, admin_id inexistant dans
shops.sql/ (migration 002)public/api/push/index.phpsrc/auth/shopify/callback.php
02
Implémenter les webhook handlers Shopify
Compléter les 5 TODO dans les fichiers webhook : orders/create (déclencher
automation panier), orders/updated (tracking commande), customers/create (créer subscriber),
app/uninstalled (soft-delete shop), carts/update (abandoned cart window 30min).
public/api/shopify/index.phpsrc/auth/shopify/webhooks.phpapp/Services/AutomationService.php (créer)
03
Billing Service — Shopify AppSubscription
Créer BillingService.php avec : createSubscription() via GraphQL Shopify,
handleBillingWebhook() (app_subscriptions/update), upgradeplan(), purchaseCredits() en usage charge, et
sync du plan dans la table shops.
app/Services/BillingService.php (créer)public/api/admin/billing.php (créer)config/shopify.php
04
API CRUD Campaigns & Subscribers
Ajouter dans /api/admin/ : GET/POST/PUT/DELETE campaigns, GET subscribers avec
filtres, POST send-campaign (déclenche queue), GET campaign/{id}/stats. Ces endpoints alimentent le
frontend Polaris.
public/api/admin/index.phppublic/api/admin/campaigns.php (créer)public/api/admin/subscribers.php (créer)
05
Analytics Service — Revenue Attribution
Créer AnalyticsService.php : tracking click → session → order (fenêtre 24h), calcul
CTR par campagne, revenu attribué total, evolution 30j. Nouveaux endpoints GET /api/analytics/dashboard
et GET /api/analytics/campaign/{id}.
app/Services/AnalyticsService.php (créer)sql/ (revenue_attribution table)public/sw.js (click
event → beacon)
🛍️ Phase 2 — App Shopify (Polaris)
Interface marchands
06
Routing React + Pages complètes
Ajouter React Router dans l'app Shopify. Créer : Dashboard (KPIs + ROI), Campaigns
(liste + créer + détail), Subscribers (liste + segments), Analytics (graphiques CTR/revenue), Settings
(plans, intégrations). Connecter chaque page à l'API via useFetch.
src/shopify-app/App.jsxsrc/shopify-app/pages/ (5 pages)src/shared/hooks/useApi.js
07
Campaign Builder — Polaris Form
Composant de création de campagne : titre/body, image URL, URL d'action, segment
cible (dropdown), planification (DateTimePicker), preview de la notif en temps réel. Intégration Form +
validation Polaris.
src/shopify-app/components/CampaignBuilder.jsx
(créer)src/shopify-app/pages/CampaignCreate.jsx (créer)
08
Dashboard ROI — Page Analytics App
Page analytics avec : revenu total attribué (gros chiffre en haut), CTR moyen,
graphique 30j clics/envois, top 3 campagnes par revenu, comparaison semaine N-1. Utiliser Polaris
BarChart ou recharts en Polaris.
src/shopify-app/pages/Analytics.jsx (créer)src/shopify-app/components/ROICard.jsx (créer)
09
Service Worker — Click tracking & offline
Compléter public/sw.js : event push (affichage notif avec actions),
notificationclick (ouvrir URL + envoyer beacon /api/push/track-click avec notification_id),
backgroundsync pour retry hors-ligne.
public/sw.jspublic/api/push/index.php (ajouter POST /track-click)
🔗 Phase 3 — Intégrations
Klaviyo · Recharge · Segmentation
10
Segmentation — Shopify Segments API
Appeler l'API GraphQL Shopify Segments pour récupérer les segments existants du
marchand. Stocker dans subscriber_segments. Permettre de cibler une campagne sur un segment Shopify.
Sync périodique toutes les 6h via cron.
app/Services/SegmentService.php (créer)sql/ (migration subscriber_segments)public/api/admin/segments.php (créer)
11
Intégration Klaviyo
KlaviyoService.php : auth via API key (stocker dans integrations table), import
segments Klaviyo (GET /api/lists), webhook entrant Klaviyo → trigger push (ex: quand un profil entre
dans une liste). Page Settings dans l'app pour connecter la clé API.
app/Services/KlaviyoService.php (créer)sql/ (migration integrations)public/api/webhooks/klaviyo.php (créer)
12
Intégration Recharge Subscriptions
RechargeService.php : webhooks Recharge (subscription/activated,
subscription/cancelled, charge/failed, charge/upcoming). Mapper chaque event vers un trigger automation
: push "Ton renouvellement approche" (J-3), "Paiement échoué — mets à jour ta carte" (récupération
revenu direct).
app/Services/RechargeService.php (créer)public/api/webhooks/recharge.php (créer)config/routes.php (ajouter route)
⚡ Phase 4 — Différenciateurs
Smart Delivery · A/B · Géo · i18n
13
Smart Delivery
SmartDeliveryService.php : enregistrer timezone depuis IP lors du subscribe,
construire un profil "heures actives" (basé sur clics historiques), retarder l'envoi dans la queue
jusqu'à la fenêtre optimale du subscriber. Table smart_delivery_profiles.
app/Services/SmartDeliveryService.php (créer)sql/ (smart_delivery_profiles)app/Services/PushService.php (modifier queue)
14
A/B Testing de notifications
ABTestService.php : créer 2 variantes (A/B) d'une campagne, split 50/50 des
subscribers, suivre CTR par variante, déclarer un vainqueur automatiquement après N clics ou X heures.
UI dans le Campaign Builder (toggle "Activer A/B test").
app/Services/ABTestService.php (créer)sql/ (ab_tests table)src/shopify-app/components/CampaignBuilder.jsx
15
Géolocalisation basique
Enrichir la table subscribers avec country (ISO 3166) et timezone (IANA) lors du
subscribe via IP-to-geo (ex: ip-api.com gratuit). Ajouter filtres géo dans SegmentService. UI : filtres
dans Campaign Builder "Envoyer uniquement aux abonnés en France, Belgique…"
public/api/push/index.php (enrichir subscribe)sql/ (ajouter country, timezone à subscribers)
16
Builder multilingue
Table notification_i18n avec (campaign_id, locale, title, body). Dans le Campaign
Builder Polaris : tabs de langue (FR, EN, ES, DE), saisir titre/body par locale. Lors de l'envoi,
matcher la langue du subscriber à sa locale détectée.
sql/ (notification_i18n table)src/shopify-app/components/CampaignBuilder.jsxapp/Services/PushService.php (locale matching)
17
Intégration Judge.me / Yotpo
ReviewService.php : webhook order/fulfilled → attendre 3j → push "Comment s'est
passée ta commande ? Laisse un avis". Lien direct vers page review Judge.me ou Yotpo. Configurable dans
Settings avec délai personnalisable.
app/Services/ReviewService.php (créer)public/api/webhooks/ (ajouter trigger)
🎛️ Phase 5 — Panel Admin Toasty
Dashboard interne de gestion
18
Dashboard admin — Stats réelles
Connecter pages/admin/dashboard.php à des vraies requêtes SQL : boutiques actives
(plan != 'free'), notifications envoyées ce mois, revenue MRR estimé (SUM billing_subscriptions actifs),
churn derniers 30j. Remplacer les "0" hardcodés.
pages/admin/dashboard.phppublic/api/admin/index.php (fix query)src/admin/pages/Dashboard.jsx
19
Admin — Gestion shops, campaigns, subscribers
Rendre fonctionnelles les pages PHP admin déjà créées (campaigns.php, shops.php,
subscribers.php, logs.php) : requêtes SQL réelles, pagination, filtres de recherche, actions (suspendre
shop, modifier plan manuellement).
pages/admin/campaigns.phppages/admin/shops.phppages/admin/subscribers.php
20
Admin — Settings intégrations
Page settings/admin pour : gérer les clés Klaviyo/Recharge par défaut (sandbox),
voir les intégrations actives par shop, forcer une resync, gérer les VAPID keys, tester l'envoi d'une
push de test. Page pages/admin/settings.php déjà présente.
pages/admin/settings.phppublic/api/admin/settings.php (créer)
Récapitulatif effort total
Phase 1 — Fondations
~8j
Blocant — à faire en premier
Phase 2 — App Shopify
~9j
MVP lançable
Phase 3 — Intégrations
~7j
Compétitivité
Phase 4 — Différenciateurs
~8j
Avantage marché
Phase 5 — Admin
~4j
Outillage interne
Total estimé
~36j
~7-8 semaines solo