====== Sprint 10-A.1 — Platform API & Developer Portal Core ======
===== Objectif =====
Ouvrir la plateforme Enterprise à l'écosystème développeurs et partenaires.
Cette couche permet :
Public API
API Keys
OAuth2
Developer Portal
API Documentation
SDK Foundation
afin de transformer la plateforme en écosystème extensible.
À l'issue de cette étape :
✓ Public API
✓ API Keys
✓ OAuth2
✓ Developer Portal
✓ API Documentation
✓ SDK Foundation
✓ Developer Platform
----
====== Architecture cible ======
Platform Core
↓
API Platform
├── Public REST API
├── OAuth2 Provider
├── API Keys
├── Developer Portal
├── API Documentation
├── SDK Registry
└── Usage Analytics
↓
Partners
Developers
Integrators
Marketplace Apps
----
====== Sprint 10-A.1-A ======
===== Extension Prisma =====
----
====== Étape 1 — ApiApplication ======
===== Ajouter dans schema.prisma =====
model ApiApplication {
id String
@id
@default(uuid())
tenantId String?
name String
description String?
clientId String
@unique
clientSecretHash String
applicationType ApiApplicationType
status ApiApplicationStatus
createdBy String
createdAt DateTime
@default(now())
updatedAt DateTime
@updatedAt
apiKeys ApiKey[]
@@index([status])
}
----
====== Étape 2 — ApiKey ======
===== Ajouter =====
model ApiKey {
id String
@id
@default(uuid())
applicationId String
keyPrefix String
keyHash String
scopes String[]
active Boolean
@default(true)
expiresAt DateTime?
lastUsedAt DateTime?
createdAt DateTime
@default(now())
application ApiApplication
@relation(
fields:[applicationId],
references:[id],
onDelete:Cascade
)
@@index([applicationId])
@@index([active])
}
----
====== Étape 3 — OAuthClient ======
===== Ajouter =====
model OAuthClient {
id String
@id
@default(uuid())
applicationId String
redirectUris String[]
grantTypes String[]
scopes String[]
active Boolean
@default(true)
createdAt DateTime
@default(now())
@@index([applicationId])
}
----
====== Étape 4 — ApiAccessLog ======
===== Ajouter =====
model ApiAccessLog {
id String
@id
@default(uuid())
applicationId String?
endpoint String
method String
statusCode Int
responseTimeMs Int
ipAddress String?
createdAt DateTime
@default(now())
@@index([applicationId])
@@index([createdAt])
@@index([endpoint])
}
----
====== Étape 5 — ApiRateLimit ======
===== Ajouter =====
model ApiRateLimit {
id String
@id
@default(uuid())
applicationId String
requestsPerMinute Int
requestsPerHour Int
requestsPerDay Int
createdAt DateTime
@default(now())
@@unique([applicationId])
}
----
====== Étape 6 — Enums ======
===== Ajouter =====
enum ApiApplicationType {
INTERNAL
PARTNER
PUBLIC
MARKETPLACE
}
enum ApiApplicationStatus {
PENDING
ACTIVE
SUSPENDED
REVOKED
}
----
====== Étape 7 — Migration ======
npx prisma migrate dev \
--name platform_api_core
----
====== Sprint 10-A.1-B ======
===== Platform API Module =====
----
====== Étape 8 — Structure ======
src/modules/platform-api
├── applications
├── api-keys
├── oauth
├── documentation
├── analytics
├── portal
└── platform-api.module.ts
----
====== Étape 9 — Services ======
ApiApplicationService
ApiKeyService
OAuthService
ApiDocumentationService
ApiAnalyticsService
DeveloperPortalService
----
====== Sprint 10-A.1-C ======
===== API Keys =====
----
====== Étape 10 — ApiKeyService ======
===== Créer =====
api-key.service.ts
----
===== Fonctionnalités =====
Generate Key
Rotate Key
Revoke Key
Scope Management
Expiration
----
====== Étape 11 — Format ======
pk_live_xxxxxxxxx
pk_test_xxxxxxxxx
----
====== Étape 12 — Méthodes ======
generateApiKey()
rotateApiKey()
revokeApiKey()
validateApiKey()
----
====== Sprint 10-A.1-D ======
===== OAuth2 Provider =====
----
====== Étape 13 — OAuthService ======
===== Créer =====
oauth.service.ts
----
===== Supporter =====
Authorization Code
Client Credentials
Refresh Token
PKCE
----
====== Étape 14 — Endpoints OAuth ======
GET /oauth/authorize
POST /oauth/token
POST /oauth/revoke
GET /oauth/userinfo
----
====== Étape 15 — Scopes ======
crm.read
crm.write
property.read
reservation.read
reservation.write
analytics.read
----
====== Sprint 10-A.1-E ======
===== Public API =====
----
====== Étape 16 — API Gateway ======
===== Exposer =====
CRM API
Property API
Reservation API
Finance API
Marketing API
----
====== Étape 17 — Versioning ======
===== Supporter =====
/api/v1
/api/v2
----
====== Étape 18 — Standards ======
REST
OpenAPI 3
JSON API
Pagination
Filtering
Sorting
----
====== Sprint 10-A.1-F ======
===== Documentation API =====
----
====== Étape 19 — ApiDocumentationService ======
===== Créer =====
api-documentation.service.ts
----
===== Générer =====
Swagger
OpenAPI
Postman Collection
SDK Examples
----
====== Étape 20 — Documentation ======
===== Fournir =====
Authentication
Endpoints
Examples
Errors
Rate Limits
----
====== Sprint 10-A.1-G ======
===== Developer Portal =====
----
====== Étape 21 — DeveloperPortalService ======
===== Créer =====
developer-portal.service.ts
----
===== Fonctionnalités =====
Applications
API Keys
Usage Analytics
Documentation
SDK Downloads
----
====== Étape 22 — Dashboard ======
===== Afficher =====
Requests
Errors
Latency
Quota Usage
Top APIs
----
====== Sprint 10-A.1-H ======
===== SDK Foundation =====
----
====== Étape 23 — SDK Registry ======
===== Créer =====
sdk-registry.service.ts
----
===== Préparer =====
TypeScript SDK
Node.js SDK
Python SDK
PHP SDK
Java SDK
----
====== Étape 24 — Génération ======
===== Basée sur =====
OpenAPI
Codegen
Versioning
----
====== Étape 25 — Exemple ======
const client = new PlatformClient({
apiKey: process.env.API_KEY
});
const properties =
await client.properties.list();
----
====== Sprint 10-A.1-I ======
===== API Analytics =====
----
====== Étape 26 — ApiAnalyticsService ======
===== Créer =====
api-analytics.service.ts
----
===== Mesurer =====
Requests
Errors
Latency
Rate Limits
Usage By Endpoint
----
====== Étape 27 — Endpoints ======
GET /developer/apps
POST /developer/apps
POST /developer/api-keys
GET /developer/analytics
GET /developer/docs
GET /developer/sdk
----
====== Étape 28 — Exemple ======
{
"application":"Partner PMS",
"requestsToday":124550,
"avgLatency":78,
"errorRate":0.12,
"quotaUsage":68
}
----
====== Sprint 10-A.1-J ======
===== Gouvernance =====
----
====== Étape 29 — Permissions ======
developer.read
developer.apps.manage
developer.keys.manage
developer.analytics.read
developer.docs.manage
developer.admin
----
====== Étape 30 — Audit ======
API_KEY_CREATED
API_KEY_ROTATED
OAUTH_CLIENT_CREATED
APPLICATION_REGISTERED
API_RATE_LIMIT_TRIGGERED
SDK_GENERATED
----
====== Étape 31 — Jobs ======
Toutes les heures
API Analytics Aggregation
Toutes les nuits
Usage Rollup
Quota Refresh
SDK Publication Check
----
====== Préparation Sprint 10-A.2 ======
Compatible avec :
Webhooks
Event Bus
Realtime Events
Partner Integrations
Marketplace Apps
----
====== Définition de terminé ======
Le Sprint 10-A.1 est terminé lorsque :
✓ Public API créée
✓ API Keys créées
✓ OAuth2 créé
✓ Developer Portal créé
✓ API Documentation créée
✓ SDK Foundation créée
✓ Developer Platform opérationnelle
----
====== Livrables ======
ApiApplication
ApiKey
OAuthClient
ApiAccessLog
ApiRateLimit
ApiApplicationService
ApiKeyService
OAuthService
ApiDocumentationService
DeveloperPortalService
ApiAnalyticsService
SDK Registry
Developer Platform
----
====== Sprint 10-A.2 — Webhooks, Events & Integration Platform ======
===== Objectif =====
Construire la plateforme d'intégration Enterprise permettant à l'écosystème externe de réagir en temps réel aux événements métier.
Cette couche permet :
Webhook Engine
Event Bus
Event Catalog
Realtime Events
Partner Integrations
Integration Dashboard
afin d'interconnecter la plateforme avec :
PMS
ERP
CRM
OTA
Paiements
Marketing
Marketplace Apps
Partenaires
À l'issue de cette étape :
✓ Webhook Engine
✓ Event Bus
✓ Event Catalog
✓ Realtime Events
✓ Partner Integrations
✓ Integration Dashboard
✓ Integration Platform
----
====== Architecture cible ======
Platform Core
↓
Domain Events
↓
Event Bus
├── CRM Events
├── Property Events
├── Reservation Events
├── Finance Events
├── Marketing Events
├── Loyalty Events
└── Marketplace Events
↓
Webhook Engine
↓
Partner Integrations
↓
External Systems
----
====== Sprint 10-A.2-A ======
===== Extension Prisma =====
----
====== Étape 1 — EventDefinition ======
===== Ajouter dans schema.prisma =====
model EventDefinition {
id String
@id
@default(uuid())
code String
@unique
category EventCategory
name String
description String?
schemaVersion String
active Boolean
@default(true)
createdAt DateTime
@default(now())
@@index([category])
}
----
====== Étape 2 — EventSubscription ======
===== Ajouter =====
model EventSubscription {
id String
@id
@default(uuid())
tenantId String
applicationId String
eventCode String
active Boolean
@default(true)
createdAt DateTime
@default(now())
@@index([tenantId])
@@index([applicationId])
@@index([eventCode])
}
----
====== Étape 3 — WebhookEndpoint ======
===== Ajouter =====
model WebhookEndpoint {
id String
@id
@default(uuid())
tenantId String
applicationId String?
name String
targetUrl String
secretKeyHash String
active Boolean
@default(true)
retryEnabled Boolean
@default(true)
createdAt DateTime
@default(now())
@@index([tenantId])
@@index([active])
}
----
====== Étape 4 — WebhookDelivery ======
===== Ajouter =====
model WebhookDelivery {
id String
@id
@default(uuid())
endpointId String
eventCode String
payload Json
status WebhookDeliveryStatus
responseCode Int?
responseTimeMs Int?
retryCount Int
@default(0)
deliveredAt DateTime?
createdAt DateTime
@default(now())
@@index([endpointId])
@@index([status])
@@index([createdAt])
}
----
====== Étape 5 — IntegrationConnection ======
===== Ajouter =====
model IntegrationConnection {
id String
@id
@default(uuid())
tenantId String
provider IntegrationProvider
externalAccountId String?
status IntegrationStatus
configuration Json
lastSyncAt DateTime?
createdAt DateTime
@default(now())
@@index([tenantId])
@@index([provider])
@@index([status])
}
----
====== Étape 6 — EventLog ======
===== Ajouter =====
model EventLog {
id String
@id
@default(uuid())
tenantId String?
eventCode String
aggregateType String
aggregateId String
payload Json
publishedAt DateTime
@default(now())
@@index([eventCode])
@@index([publishedAt])
}
----
====== Étape 7 — Enums ======
===== Ajouter =====
enum EventCategory {
CRM
PROPERTY
RESERVATION
PAYMENT
FINANCE
MARKETING
LOYALTY
REFERRAL
MARKETPLACE
}
enum WebhookDeliveryStatus {
PENDING
PROCESSING
SUCCESS
FAILED
RETRYING
DEAD_LETTER
}
enum IntegrationProvider {
AIRBNB
BOOKING
EXPEDIA
STRIPE
HUBSPOT
SALESFORCE
ZAPIER
MAKE
CUSTOM
}
enum IntegrationStatus {
PENDING
ACTIVE
FAILED
DISCONNECTED
}
----
====== Étape 8 — Migration ======
npx prisma migrate dev \
--name integration_platform
----
====== Sprint 10-A.2-B ======
===== Integration Platform Module =====
----
====== Étape 9 — Structure ======
src/modules/integrations
├── events
├── webhooks
├── subscriptions
├── providers
├── dashboard
└── integrations.module.ts
----
====== Étape 10 — Services ======
EventBusService
EventCatalogService
WebhookEngineService
WebhookDeliveryService
IntegrationConnectionService
IntegrationDashboardService
----
====== Sprint 10-A.2-C ======
===== Event Bus =====
----
====== Étape 11 — EventBusService ======
===== Créer =====
event-bus.service.ts
----
===== Fonctions =====
Publish
Subscribe
Replay
Retry
Dead Letter Queue
----
====== Étape 12 — Méthodes ======
publish()
subscribe()
unsubscribe()
replayEvent()
moveToDeadLetter()
----
====== Étape 13 — Événements standards ======
CUSTOMER_CREATED
PROPERTY_CREATED
RESERVATION_CREATED
PAYMENT_COMPLETED
CHECKIN_COMPLETED
CHECKOUT_COMPLETED
LOYALTY_POINTS_EARNED
----
====== Sprint 10-A.2-D ======
===== Event Catalog =====
----
====== Étape 14 — EventCatalogService ======
===== Créer =====
event-catalog.service.ts
----
===== Fournir =====
Schemas
Payloads
Versions
Examples
Compatibility
----
====== Étape 15 — Exemple ======
{
"event":"RESERVATION_CREATED",
"version":"1.0",
"reservationId":"..."
}
----
====== Sprint 10-A.2-E ======
===== Webhook Engine =====
----
====== Étape 16 — WebhookEngineService ======
===== Créer =====
webhook-engine.service.ts
----
===== Supporter =====
HTTPS
HMAC Signature
Retries
Backoff
Dead Letter Queue
----
====== Étape 17 — Sécurité ======
===== Headers =====
X-Webhook-Signature
X-Webhook-Event
X-Webhook-Timestamp
----
====== Étape 18 — Méthodes ======
registerEndpoint()
dispatchWebhook()
verifySignature()
retryDelivery()
----
====== Étape 19 — Politique Retry ======
1 min
5 min
15 min
1 h
6 h
----
====== Sprint 10-A.2-F ======
===== Realtime Events =====
----
====== Étape 20 — Temps réel ======
===== Utiliser =====
Kafka
RabbitMQ
NATS
Redis Streams
selon l'architecture cible.
----
====== Étape 21 — Topics ======
crm.*
reservation.*
property.*
payment.*
marketing.*
----
====== Étape 22 — Streaming ======
===== Supporter =====
Event Replay
Consumer Groups
Partitioning
Event Retention
----
====== Sprint 10-A.2-G ======
===== Partner Integrations =====
----
====== Étape 23 — IntegrationConnectionService ======
===== Créer =====
integration-connection.service.ts
----
===== Connecteurs =====
Airbnb
Booking
Expedia
Stripe
HubSpot
Salesforce
Zapier
Make
----
====== Étape 24 — Méthodes ======
connect()
disconnect()
sync()
refreshToken()
testConnection()
----
====== Étape 25 — Connecteurs custom ======
===== Supporter =====
REST
Webhook
OAuth2
API Key
----
====== Sprint 10-A.2-H ======
===== Dashboard Intégration =====
----
====== Étape 26 — IntegrationDashboardService ======
===== Créer =====
integration-dashboard.service.ts
----
===== Afficher =====
Events Published
Webhook Success Rate
Retry Queue
Failed Deliveries
Active Integrations
----
====== Étape 27 — KPIs ======
Delivery Rate
Average Latency
Retry Rate
Consumer Lag
Integration Health
----
====== Sprint 10-A.2-I ======
===== API Intégration =====
----
====== Étape 28 — Endpoints ======
GET /integrations/events
GET /integrations/subscriptions
POST /integrations/webhooks
GET /integrations/webhooks/deliveries
GET /integrations/connections
POST /integrations/connections
GET /integrations/dashboard
----
====== Étape 29 — Exemple ======
{
"eventsPublished":152340,
"deliveryRate":99.87,
"failedDeliveries":42,
"activeIntegrations":28,
"avgLatencyMs":74
}
----
====== Sprint 10-A.2-J ======
===== Gouvernance =====
----
====== Étape 30 — Permissions ======
integration.read
integration.webhooks.manage
integration.events.manage
integration.connections.manage
integration.analytics.read
integration.admin
----
====== Étape 31 — Audit ======
EVENT_PUBLISHED
WEBHOOK_REGISTERED
WEBHOOK_DELIVERED
WEBHOOK_FAILED
INTEGRATION_CONNECTED
INTEGRATION_DISCONNECTED
----
====== Étape 32 — Jobs ======
Toutes les minutes
Webhook Retry Processor
Dead Letter Processor
Toutes les heures
Integration Health Check
Event Retention Cleanup
Analytics Aggregation
----
====== Préparation Sprint 10-B.1 ======
Compatible avec :
Marketplace Apps
App Store
Extensions
Plugins
Embedded Apps
----
====== Définition de terminé ======
Le Sprint 10-A.2 est terminé lorsque :
✓ Webhook Engine créé
✓ Event Bus créé
✓ Event Catalog créé
✓ Realtime Events créés
✓ Partner Integrations créées
✓ Integration Dashboard créé
✓ Integration Platform opérationnelle
----
====== Livrables ======
EventDefinition
EventSubscription
WebhookEndpoint
WebhookDelivery
IntegrationConnection
EventLog
EventBusService
EventCatalogService
WebhookEngineService
WebhookDeliveryService
IntegrationConnectionService
IntegrationDashboardService
Integration Platform
----
====== Sprint 10-B.1 — Marketplace Apps & Extension Framework ======
===== Objectif =====
Construire l'écosystème applicatif Enterprise permettant aux partenaires, intégrateurs et développeurs de distribuer des extensions sur la plateforme.
Cette couche permet :
App Marketplace
App Installation
Extension Framework
Embedded Apps
Plugin SDK
App Management
afin de transformer la plateforme en véritable système extensible.
À l'issue de cette étape :
✓ App Marketplace
✓ App Installation
✓ Extension Framework
✓ Embedded Apps
✓ Plugin SDK
✓ App Management
✓ Ecosystem Platform
----
====== Architecture cible ======
Developer Platform
↓
Marketplace Platform
├── App Registry
├── App Store
├── Installation Engine
├── Extension Framework
├── Embedded Apps
├── Plugin SDK
└── App Analytics
↓
Customers
Partners
Developers
Marketplace Ecosystem
----
====== Sprint 10-B.1-A ======
===== Extension Prisma =====
----
====== Étape 1 — MarketplaceApp ======
===== Ajouter dans schema.prisma =====
model MarketplaceApp {
id String
@id
@default(uuid())
developerId String
code String
@unique
name String
description String?
version String
category AppCategory
status AppStatus
logoUrl String?
websiteUrl String?
documentationUrl String?
verified Boolean
@default(false)
publishedAt DateTime?
createdAt DateTime
@default(now())
updatedAt DateTime
@updatedAt
@@index([category])
@@index([status])
}
----
====== Étape 2 — AppInstallation ======
===== Ajouter =====
model AppInstallation {
id String
@id
@default(uuid())
tenantId String
appId String
installedBy String
status AppInstallationStatus
configuration Json?
installedAt DateTime
@default(now())
updatedAt DateTime
@updatedAt
@@unique([tenantId, appId])
@@index([tenantId])
@@index([status])
}
----
====== Étape 3 — AppPermission ======
===== Ajouter =====
model AppPermission {
id String
@id
@default(uuid())
appId String
permissionCode String
required Boolean
@default(true)
createdAt DateTime
@default(now())
@@index([appId])
@@index([permissionCode])
}
----
====== Étape 4 — AppExtension ======
===== Ajouter =====
model AppExtension {
id String
@id
@default(uuid())
appId String
extensionPoint String
componentType ExtensionComponentType
configuration Json
active Boolean
@default(true)
createdAt DateTime
@default(now())
@@index([appId])
@@index([extensionPoint])
}
----
====== Étape 5 — AppUsageMetric ======
===== Ajouter =====
model AppUsageMetric {
id String
@id
@default(uuid())
appId String
tenantId String
metricDate DateTime
activeUsers Int
@default(0)
apiCalls Int
@default(0)
executions Int
@default(0)
createdAt DateTime
@default(now())
@@index([appId])
@@index([tenantId])
@@index([metricDate])
}
----
====== Étape 6 — Enums ======
===== Ajouter =====
enum AppCategory {
CRM
PROPERTY
RESERVATION
FINANCE
MARKETING
LOYALTY
ANALYTICS
OPERATIONS
INTEGRATION
PRODUCTIVITY
}
enum AppStatus {
DRAFT
REVIEW
PUBLISHED
SUSPENDED
DEPRECATED
}
enum AppInstallationStatus {
PENDING
INSTALLED
DISABLED
FAILED
UNINSTALLED
}
enum ExtensionComponentType {
PAGE
WIDGET
ACTION
WEBHOOK
AUTOMATION
SIDEBAR
}
----
====== Étape 7 — Migration ======
npx prisma migrate dev \
--name marketplace_apps_core
----
====== Sprint 10-B.1-B ======
===== Marketplace Module =====
----
====== Étape 8 — Structure ======
src/modules/marketplace
├── apps
├── installations
├── extensions
├── sdk
├── analytics
├── reviews
└── marketplace.module.ts
----
====== Étape 9 — Services ======
MarketplaceAppService
AppInstallationService
ExtensionFrameworkService
PluginSDKService
MarketplaceAnalyticsService
AppManagementService
----
====== Sprint 10-B.1-C ======
===== App Marketplace =====
----
====== Étape 10 — MarketplaceAppService ======
===== Créer =====
marketplace-app.service.ts
----
===== Fonctionnalités =====
Publish App
Update App
Archive App
Verify App
Search Apps
----
====== Étape 11 — Catégories ======
CRM
Reservations
Finance
Marketing
Analytics
Operations
Integrations
----
====== Étape 12 — Méthodes ======
publishApp()
submitForReview()
verifyApp()
searchMarketplace()
getFeaturedApps()
----
====== Sprint 10-B.1-D ======
===== App Installation =====
----
====== Étape 13 — AppInstallationService ======
===== Créer =====
app-installation.service.ts
----
===== Supporter =====
Install
Upgrade
Disable
Enable
Uninstall
----
====== Étape 14 — Workflow ======
Marketplace
↓
Review Permissions
↓
Install
↓
Configure
↓
Activate
----
====== Étape 15 — Méthodes ======
installApp()
upgradeApp()
enableApp()
disableApp()
uninstallApp()
----
====== Sprint 10-B.1-E ======
===== Extension Framework =====
----
====== Étape 16 — ExtensionFrameworkService ======
===== Créer =====
extension-framework.service.ts
----
===== Extension Points ======
Dashboard Widgets
Property Pages
Reservation Pages
CRM Pages
Sidebar Menus
Custom Actions
----
====== Étape 17 — Runtime ======
===== Supporter =====
Manifest
Permissions
Lifecycle Hooks
Sandbox
Isolation
----
====== Étape 18 — Méthodes ======
registerExtension()
loadExtension()
executeExtension()
validateManifest()
----
====== Sprint 10-B.1-F ======
===== Embedded Apps =====
----
====== Étape 19 — Embedded Apps ======
===== Supporter =====
iFrame Apps
Micro Frontends
Remote Modules
Widget Embedding
----
====== Étape 20 — Sécurité ======
CSP
Sandbox
OAuth Context
Scoped Permissions
Tenant Isolation
----
====== Étape 21 — Exemple Manifest ======
{
"name":"Revenue Optimizer",
"version":"1.0.0",
"permissions":[
"analytics.read",
"property.read"
],
"extensions":[
{
"type":"widget",
"location":"dashboard"
}
]
}
----
====== Sprint 10-B.1-G ======
===== Plugin SDK =====
----
====== Étape 22 — PluginSDKService ======
===== Créer =====
plugin-sdk.service.ts
----
===== Fournir =====
TypeScript SDK
React SDK
REST SDK
Webhook SDK
Event SDK
----
====== Étape 23 — Exemple ======
import {
AppSDK
} from '@platform/sdk';
const sdk = new AppSDK();
sdk.dashboard.registerWidget({
id: 'revenue-widget'
});
----
====== Étape 24 — Capacités ======
API Access
Events
Storage
Notifications
UI Extensions
----
====== Sprint 10-B.1-H ======
===== App Management =====
----
====== Étape 25 — AppManagementService ======
===== Créer =====
app-management.service.ts
----
===== Gérer =====
Versions
Permissions
Usage
Errors
Licensing
----
====== Étape 26 — Monitoring ======
===== Mesurer =====
Installs
Active Apps
Crashes
Latency
Usage
----
====== Sprint 10-B.1-I ======
===== API Marketplace =====
----
====== Étape 27 — Endpoints ======
GET /marketplace/apps
GET /marketplace/apps/{id}
POST /marketplace/apps
POST /marketplace/apps/{id}/publish
POST /marketplace/installations
DELETE /marketplace/installations/{id}
GET /marketplace/analytics
----
====== Étape 28 — Exemple ======
{
"app":"Revenue Optimizer",
"category":"ANALYTICS",
"installs":824,
"rating":4.8,
"verified":true
}
----
====== Sprint 10-B.1-J ======
===== Gouvernance =====
----
====== Étape 29 — Permissions ======
marketplace.read
marketplace.publish
marketplace.install
marketplace.manage
marketplace.analytics
marketplace.admin
----
====== Étape 30 — Audit ======
APP_PUBLISHED
APP_VERIFIED
APP_INSTALLED
APP_UNINSTALLED
EXTENSION_REGISTERED
SDK_GENERATED
----
====== Étape 31 — Jobs ======
Toutes les heures
Marketplace Analytics Refresh
Toutes les nuits
App Health Check
Permission Audit
Version Compatibility Scan
----
====== Préparation Sprint 10-B.2 ======
Compatible avec :
Partner Ecosystem
Monetization
Billing Marketplace
Revenue Sharing
App Store Economy
----
====== Définition de terminé ======
Le Sprint 10-B.1 est terminé lorsque :
✓ App Marketplace créé
✓ App Installation créée
✓ Extension Framework créé
✓ Embedded Apps créées
✓ Plugin SDK créé
✓ App Management créé
✓ Marketplace Platform opérationnelle
----
====== Livrables ======
MarketplaceApp
AppInstallation
AppPermission
AppExtension
AppUsageMetric
MarketplaceAppService
AppInstallationService
ExtensionFrameworkService
PluginSDKService
MarketplaceAnalyticsService
AppManagementService
Marketplace Platform
----
====== Sprint 10-B.2 — Marketplace Monetization & Partner Ecosystem ======
===== Objectif =====
Finaliser l'écosystème Marketplace Enterprise en ajoutant la monétisation, la gestion des partenaires et l'économie applicative.
Cette couche permet :
App Billing
Subscriptions
Revenue Sharing
Partner Portal
App Analytics
Marketplace Economy
afin de créer une plateforme économique complète autour du Marketplace.
À l'issue de cette étape :
✓ App Billing
✓ Subscriptions
✓ Revenue Sharing
✓ Partner Portal
✓ App Analytics
✓ Marketplace Economy
✓ Partner Ecosystem Platform
----
====== Architecture cible ======
Marketplace Platform
↓
Marketplace Economy Layer
├── Billing Engine
├── Subscription Management
├── Revenue Sharing
├── Partner Portal
├── Marketplace Analytics
├── Payout Engine
└── Ecosystem Intelligence
↓
Partners
Developers
Vendors
Integrators
----
====== Sprint 10-B.2-A ======
===== Extension Prisma =====
----
====== Étape 1 — MarketplaceSubscription ======
===== Ajouter dans schema.prisma =====
model MarketplaceSubscription {
id String
@id
@default(uuid())
tenantId String
appId String
planCode String
status SubscriptionStatus
monthlyPrice Decimal
@db.Decimal(14,2)
startedAt DateTime
expiresAt DateTime?
cancelledAt DateTime?
createdAt DateTime
@default(now())
@@index([tenantId])
@@index([appId])
@@index([status])
}
----
====== Étape 2 — MarketplaceInvoice ======
===== Ajouter =====
model MarketplaceInvoice {
id String
@id
@default(uuid())
subscriptionId String
invoiceNumber String
@unique
amount Decimal
@db.Decimal(14,2)
currency String
status InvoiceStatus
dueDate DateTime
paidAt DateTime?
createdAt DateTime
@default(now())
@@index([subscriptionId])
@@index([status])
}
----
====== Étape 3 — RevenueShare ======
===== Ajouter =====
model RevenueShare {
id String
@id
@default(uuid())
appId String
partnerId String
grossRevenue Decimal
@db.Decimal(14,2)
platformFee Decimal
@db.Decimal(14,2)
partnerRevenue Decimal
@db.Decimal(14,2)
settlementPeriod String
calculatedAt DateTime
@default(now())
@@index([appId])
@@index([partnerId])
}
----
====== Étape 4 — PartnerProfile ======
===== Ajouter =====
model PartnerProfile {
id String
@id
@default(uuid())
companyName String
legalName String?
website String?
contactEmail String
status PartnerStatus
verificationStatus VerificationStatus
joinedAt DateTime
@default(now())
@@index([status])
@@index([verificationStatus])
}
----
====== Étape 5 — MarketplacePayout ======
===== Ajouter =====
model MarketplacePayout {
id String
@id
@default(uuid())
partnerId String
payoutPeriod String
amount Decimal
@db.Decimal(14,2)
currency String
status PayoutStatus
processedAt DateTime?
createdAt DateTime
@default(now())
@@index([partnerId])
@@index([status])
}
----
====== Étape 6 — MarketplaceAnalyticsSnapshot ======
===== Ajouter =====
model MarketplaceAnalyticsSnapshot {
id String
@id
@default(uuid())
snapshotDate DateTime
totalApps Int
activeSubscriptions Int
monthlyRevenue Decimal
@db.Decimal(14,2)
partnerRevenue Decimal
@db.Decimal(14,2)
activePartners Int
createdAt DateTime
@default(now())
@@index([snapshotDate])
}
----
====== Étape 7 — Enums ======
===== Ajouter =====
enum SubscriptionStatus {
TRIAL
ACTIVE
PAST_DUE
CANCELLED
EXPIRED
}
enum InvoiceStatus {
DRAFT
ISSUED
PAID
VOID
OVERDUE
}
enum PartnerStatus {
ACTIVE
SUSPENDED
TERMINATED
}
enum VerificationStatus {
PENDING
VERIFIED
REJECTED
}
enum PayoutStatus {
PENDING
PROCESSING
COMPLETED
FAILED
}
----
====== Étape 8 — Migration ======
npx prisma migrate dev \
--name marketplace_monetization
----
====== Sprint 10-B.2-B ======
===== Marketplace Economy Module =====
----
====== Étape 9 — Structure ======
src/modules/marketplace-economy
├── billing
├── subscriptions
├── revenue-sharing
├── partners
├── payouts
├── analytics
└── marketplace-economy.module.ts
----
====== Étape 10 — Services ======
MarketplaceBillingService
SubscriptionService
RevenueSharingService
PartnerPortalService
PayoutService
MarketplaceEconomyAnalyticsService
----
====== Sprint 10-B.2-C ======
===== App Billing =====
----
====== Étape 11 — MarketplaceBillingService ======
===== Créer =====
marketplace-billing.service.ts
----
===== Supporter =====
Free
Subscription
Usage-Based
Hybrid
Enterprise Contract
----
====== Étape 12 — Méthodes ======
createInvoice()
collectPayment()
refundInvoice()
generateBillingCycle()
----
====== Étape 13 — Intégration ======
===== Utiliser =====
Stripe
Invoices
Taxes
Payment Methods
----
====== Sprint 10-B.2-D ======
===== Subscription Management =====
----
====== Étape 14 — SubscriptionService ======
===== Créer =====
subscription.service.ts
----
===== Supporter =====
Trial
Monthly
Annual
Enterprise
----
====== Étape 15 — Méthodes ======
startSubscription()
upgradePlan()
downgradePlan()
cancelSubscription()
renewSubscription()
----
====== Étape 16 — Plans ======
Starter
Professional
Business
Enterprise
----
====== Sprint 10-B.2-E ======
===== Revenue Sharing =====
----
====== Étape 17 — RevenueSharingService ======
===== Créer =====
revenue-sharing.service.ts
----
===== Supporter =====
70/30
80/20
85/15
Custom Contracts
----
====== Étape 18 — Méthodes ======
calculateRevenueShare()
generateSettlement()
calculatePartnerRevenue()
reconcileRevenue()
----
====== Étape 19 — Exemple ======
1000 €
↓
Plateforme 20%
↓
Partenaire 80%
----
====== Sprint 10-B.2-F ======
===== Partner Portal =====
----
====== Étape 20 — PartnerPortalService ======
===== Créer =====
partner-portal.service.ts
----
===== Fournir =====
Applications
Revenue
Installs
Subscriptions
Payouts
Analytics
----
====== Étape 21 — Dashboard ======
===== Afficher =====
MRR
ARR
Installs
Active Customers
Revenue Share
----
====== Étape 22 — Vérification ======
===== Supporter =====
KYC
Tax Forms
Identity
Bank Accounts
----
====== Sprint 10-B.2-G ======
===== Payout Engine =====
----
====== Étape 23 — PayoutService ======
===== Créer =====
payout.service.ts
----
===== Supporter =====
Bank Transfer
SEPA
ACH
Stripe Connect
----
====== Étape 24 — Méthodes ======
generatePayout()
approvePayout()
executePayout()
trackPayout()
----
====== Étape 25 — Cycle ======
Monthly
Bi-Monthly
Quarterly
----
====== Sprint 10-B.2-H ======
===== Marketplace Analytics =====
----
====== Étape 26 — MarketplaceEconomyAnalyticsService ======
===== Créer =====
marketplace-economy-analytics.service.ts
----
===== Mesurer =====
Marketplace MRR
Marketplace ARR
Partner Revenue
Install Growth
App Retention
Revenue Per App
----
====== Étape 27 — KPIs ======
Marketplace GMV
Take Rate
Partner LTV
Partner Churn
Subscription Growth
----
====== Sprint 10-B.2-I ======
===== API Marketplace Economy =====
----
====== Étape 28 — Endpoints ======
GET /marketplace/partners
POST /marketplace/partners
GET /marketplace/subscriptions
POST /marketplace/subscriptions
GET /marketplace/payouts
GET /marketplace/revenue-sharing
GET /marketplace/economy/dashboard
----
====== Étape 29 — Exemple ======
{
"marketplaceMrr":125000,
"activePartners":84,
"monthlyPayouts":92000,
"takeRate":18.4,
"subscriptionGrowth":12.8
}
----
====== Sprint 10-B.2-J ======
===== Gouvernance =====
----
====== Étape 30 — Permissions ======
marketplace.partner.read
marketplace.partner.manage
marketplace.billing.manage
marketplace.payout.manage
marketplace.economy.read
marketplace.admin
----
====== Étape 31 — Audit ======
PARTNER_REGISTERED
PARTNER_VERIFIED
SUBSCRIPTION_STARTED
INVOICE_GENERATED
PAYOUT_EXECUTED
REVENUE_SHARE_CALCULATED
----
====== Étape 32 — Jobs ======
Toutes les nuits
Revenue Share Calculation
Billing Cycle Processing
Subscription Renewal
Marketplace KPI Refresh
Toutes les semaines
Partner Health Review
----
====== Clôture Sprint 10 ======
À la fin du Sprint 10-B.2 :
✓ Developer Platform
✓ Integration Platform
✓ Marketplace Platform
✓ Marketplace Economy
✓ Partner Portal
✓ Revenue Sharing
✓ Ecosystem Platform
sont entièrement opérationnels.
----
====== Préparation Sprint 11 ======
Compatible avec :
Enterprise Platform Operations
Observability
SRE
Platform Reliability
Security Operations
Compliance Operations
----
====== Définition de terminé ======
Le Sprint 10-B.2 est terminé lorsque :
✓ App Billing créé
✓ Subscription Management créé
✓ Revenue Sharing créé
✓ Partner Portal créé
✓ Marketplace Analytics créé
✓ Marketplace Economy finalisée
----
====== Livrables ======
MarketplaceSubscription
MarketplaceInvoice
RevenueShare
PartnerProfile
MarketplacePayout
MarketplaceAnalyticsSnapshot
MarketplaceBillingService
SubscriptionService
RevenueSharingService
PartnerPortalService
PayoutService
MarketplaceEconomyAnalyticsService
Marketplace Economy Platform