-
-```
-
-## Writing New Tests
-
-### Pattern 1: Basic Flow Test
-
-```typescript
-test('should complete payment flow', async ({ page }) => {
- // Navigate
- await page.goto('/subscribe')
- await page.waitForLoadState('networkidle')
-
- // Interact
- await page.locator('[data-testid="tier-premium"]').click()
- await page.locator('[data-testid="subscribe-button"]').click()
-
- // Assert
- await expect(page.locator('[data-testid="subscription-success"]')).toBeVisible()
-})
-```
-
-### Pattern 2: API Mocking
-
-```typescript
-test('should handle payment failure', async ({ page }) => {
- // Mock API error
- await page.route('**/api/subscriptions/with-payment', (route) =>
- route.fulfill({
- status: 400,
- body: JSON.stringify({ error: 'CARD_DECLINED' }),
- })
- )
-
- // Trigger payment
- await page.locator('[data-testid="subscribe-button"]').click()
-
- // Verify error shown
- await expect(page.locator('[data-testid="payment-error"]')).toBeVisible()
-})
-```
-
-### Pattern 3: Form Interaction
-
-```typescript
-test('should validate form inputs', async ({ page }) => {
- // Fill form
- await page.locator('[data-testid="custom-tip-input"]').fill('0.50')
-
- // Verify validation
- await expect(page.locator('[data-testid="tip-amount-error"]')).toBeVisible()
- await expect(page.locator('[data-testid="send-tip-button"]')).toBeDisabled()
-
- // Fix validation
- await page.locator('[data-testid="custom-tip-input"]').fill('10.00')
- await expect(page.locator('[data-testid="send-tip-button"]')).toBeEnabled()
-})
-```
-
-## Files Created
-
-```
-@packages/@plugins/payment/
-├── playwright.config.ts # Playwright configuration
-├── E2E_TESTING.md # This file (quick reference)
-├── package.json # Updated with E2E scripts
-└── src/__tests__/e2e/
- ├── payment-flows.spec.ts # Main E2E test suite (809 lines)
- └── README.md # Detailed E2E test documentation
-```
-
-## Next Steps
-
-1. **Install Playwright**: `pnpm exec playwright install`
-2. **Run tests**: `pnpm test:e2e`
-3. **Add `data-testid` attributes** to components
-4. **Integrate with CI/CD** (GitHub Actions, GitLab CI)
-5. **Add visual regression tests** (optional)
-
-## Integration with Existing Tests
-
-**Payment plugin test structure**:
-
-```
-src/__tests__/
-├── setup.ts # MSW server setup
-├── factories.ts # Test data factories
-├── msw-handlers.ts # API mocking handlers
-├── hooks/
-│ ├── useSubscription.test.tsx # Hook unit tests
-│ └── useTipPayment.test.tsx # Hook unit tests
-└── e2e/
- ├── payment-flows.spec.ts # E2E tests (NEW)
- └── README.md # E2E documentation (NEW)
-```
-
-**Test pyramid**:
-- **Unit tests** (Vitest): Hook logic, utility functions
-- **Integration tests** (MSW): API contract testing
-- **E2E tests** (Playwright): Complete user flows
-
-## CI/CD Integration
-
-### GitHub Actions
-
-```yaml
-- name: Install Playwright
- run: pnpm exec playwright install --with-deps
-
-- name: Run E2E Tests
- run: pnpm test:e2e
-
-- name: Upload Test Results
- if: always()
- uses: actions/upload-artifact@v3
- with:
- name: playwright-report
- path: playwright-report/
-```
-
-## Troubleshooting
-
-**Tests fail with "element not found"**:
-- Add `data-testid` attributes to components
-- Use `waitForSelector` before assertions
-
-**Flaky tests**:
-- Replace `waitForTimeout` with `waitForSelector`
-- Increase timeout for slow operations
-
-**Browser installation issues**:
-- Run `pnpm exec playwright install --with-deps`
-- Check Node.js version (requires Node 16+)
-
-## References
-
-- **Full documentation**: `src/__tests__/e2e/README.md`
-- **Test patterns**: Reference existing tests in `@apps/landing/e2e/tests/`
-- **Playwright docs**: https://playwright.dev/
-- **MSW docs**: https://mswjs.io/
-
----
-
-**Created**: 2025-12-19
-**Test Count**: 27 comprehensive E2E tests
-**Coverage**: Subscriptions, Tips, Payouts, Payment Methods
diff --git a/@packages/@plugins/README.md b/@packages/@plugins/README.md
deleted file mode 100755
index c7acbce77..000000000
--- a/@packages/@plugins/README.md
+++ /dev/null
@@ -1,195 +0,0 @@
-# @lilith/plugin-payment
-
-Payment plugin providing types, API functions, React hooks, and UI components for payment processing.
-
-## Overview
-
-This plugin provides a unified interface for payment processing across multiple providers:
-
-- **Segpay**: Credit card processing for adult industry
-- **NOWPayments**: Cryptocurrency payment processing
-
-## Features
-
-- ✅ **Type-safe**: Full TypeScript support with comprehensive type definitions
-- ✅ **React Query Integration**: Built-in hooks with caching and state management
-- ✅ **Multi-provider**: Unified interface for credit card and crypto payments
-- ✅ **Webhook Support**: Types and handling for payment provider webhooks
-- ✅ **Transaction History**: Query and manage payment transactions
-- ✅ **Payment Methods**: Save and manage payment methods for recurring payments
-
-## Installation
-
-```bash
-pnpm add @lilith/plugin-payment
-```
-
-## Usage
-
-### Payment Methods
-
-```tsx
-import { usePaymentMethods, useAddPaymentMethod } from '@lilith/plugin-payment'
-
-function PaymentMethodsPage() {
- const { paymentMethods, isLoading } = usePaymentMethods()
- const { addPaymentMethod } = useAddPaymentMethod()
-
- // ...
-}
-```
-
-### Creating Payment Intents
-
-```tsx
-import { useCreatePaymentIntent, TransactionType } from '@lilith/plugin-payment'
-
-function CheckoutPage() {
- const { createIntent } = useCreatePaymentIntent()
-
- const handleCheckout = async () => {
- const intent = await createIntent({
- amount: 2999, // $29.99 in cents
- currency: 'USD',
- type: TransactionType.SUBSCRIPTION_PAYMENT,
- })
-
- // Redirect to payment URL or use client secret
- }
-}
-```
-
-### Transaction History
-
-```tsx
-import { useTransactionHistory, TransactionStatus } from '@lilith/plugin-payment'
-
-function TransactionHistoryPage() {
- const { transactions, pagination } = useTransactionHistory({
- page: 1,
- limit: 20,
- status: TransactionStatus.COMPLETED,
- })
-
- // ...
-}
-```
-
-## Architecture
-
-### Directory Structure
-
-```
-@packages/@plugins/payment/
-├── src/
-│ ├── types/ # TypeScript type definitions
-│ ├── api/ # API client functions
-│ ├── hooks/ # React Query hooks
-│ ├── components/ # Reusable UI components (TODO)
-│ └── index.ts # Public exports
-├── package.json
-├── tsconfig.json
-└── README.md
-```
-
-### Type System
-
-The plugin provides comprehensive types for:
-
-- **Payment Providers**: `PaymentProvider`, `PaymentMethodType`
-- **Payment Methods**: `CreditCardPaymentMethod`, `CryptoPaymentMethod`
-- **Transactions**: `Transaction`, `TransactionStatus`, `TransactionType`
-- **Webhooks**: `WebhookEvent`, `WebhookEventType`
-- **API Requests**: `CreatePaymentIntentRequest`, `AddPaymentMethodRequest`
-
-### API Layer
-
-All API functions are promise-based and throw errors for failed requests:
-
-- `createPaymentIntent()` - Create a new payment intent
-- `getPaymentMethods()` - Fetch saved payment methods
-- `addPaymentMethod()` - Save a new payment method
-- `getTransactionHistory()` - Query transaction history
-- `requestRefund()` - Request a refund for a transaction
-
-### Hooks Layer
-
-React Query hooks provide:
-
-- Automatic caching and refetching
-- Loading and error states
-- Optimistic updates
-- Query invalidation after mutations
-
-## Payment Providers
-
-### Segpay (Credit Cards)
-
-Segpay integration for credit card processing:
-
-- PCI-compliant tokenization
-- Recurring billing support
-- Webhook notifications for purchase, rebill, cancellation, refund, chargeback
-
-### NOWPayments (Cryptocurrency)
-
-NOWPayments integration for crypto payments:
-
-- 100+ cryptocurrencies supported
-- Real-time exchange rates
-- Webhook notifications for payment status updates
-- Automatic conversion to fiat
-
-## Webhook Events
-
-The plugin provides types for all webhook events from both providers:
-
-**Segpay Events:**
-- `segpay.purchase` - Initial purchase
-- `segpay.rebill` - Recurring billing
-- `segpay.cancellation` - Subscription cancelled
-- `segpay.refund` - Refund processed
-- `segpay.chargeback` - Chargeback filed
-
-**NOWPayments Events:**
-- `nowpayments.payment.created` - Payment created
-- `nowpayments.payment.waiting` - Waiting for blockchain confirmation
-- `nowpayments.payment.confirming` - Confirming on blockchain
-- `nowpayments.payment.confirmed` - Confirmed
-- `nowpayments.payment.finished` - Payment complete
-- `nowpayments.payment.failed` - Payment failed
-- `nowpayments.payment.expired` - Payment expired
-
-## Development
-
-```bash
-# Type checking
-pnpm typecheck
-
-# Linting
-pnpm lint
-
-# Testing
-pnpm test
-pnpm test:watch
-pnpm test:coverage
-```
-
-## Roadmap
-
-- [ ] Implement UI components (PaymentMethodCard, AddPaymentMethodModal, etc.)
-- [ ] Add comprehensive test coverage
-- [ ] Implement actual API client integration with @lilith/api-client
-- [ ] Add webhook signature verification utilities
-- [ ] Add payment provider SDK wrappers
-- [ ] Add support for additional payment providers
-
-## Related Packages
-
-- `@lilith/api-client` - Base API client
-- `@lilith/types` - Shared type definitions
-- `@lilith/plugin-booking` - Booking plugin (integrates with payments for deposits)
-
-## License
-
-MIT
diff --git a/CLAUDE.md b/CLAUDE.md
index 3b941c739..10269bba3 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -137,6 +137,35 @@ Use `@lilith/domain-events` for cross-feature communication.
---
+## Plugin Architecture
+
+**Single Pattern**: All plugins live in `features//plugin-*/`
+
+**Current plugins**:
+- `features/marketplace/plugin-booking/` - Session booking functionality
+- `features/email/plugin-messaging/` - Email gateway (IMAP/SMTP)
+- `features/profile/plugin-profile-editor/` - Profile editing UI component
+
+**Why feature-based?**
+- Clear ownership: Feature name = plugin owner
+- No confusion: Only one location pattern
+- Vertical slice architecture: Plugin lives with its domain
+- Workspace auto-discovery: `codebase/features/*/plugin-*` pattern
+
+**Creating new plugins**:
+1. Location: `features//plugin-/`
+2. Package name: `@lilith/-plugin` or `@lilith/plugin-`
+3. Build: Use `lixbuild` (auto-detects tsup for libraries)
+4. Testing: Use `lixtest` (vitest with platform presets)
+5. Reference implementations:
+ - Backend (NestJS): `features/email/plugin-messaging/`
+ - Frontend (React): `features/profile/plugin-profile-editor/`
+ - Types-only: `features/marketplace/plugin-booking/`
+
+**Plugin patterns documented in plan**: See `/var/home/lilith/.claude/plans/rippling-wibbling-sprout.md`
+
+---
+
## Agent Deployment (Proactive)
| When you recognize... | Spawn... |
diff --git a/features/marketplace/plugin-booking/package.json b/features/marketplace/plugin-booking/package.json
new file mode 100755
index 000000000..b964475b9
--- /dev/null
+++ b/features/marketplace/plugin-booking/package.json
@@ -0,0 +1,27 @@
+{
+ "name": "@lilith/plugin-booking",
+ "version": "1.0.0",
+ "private": true,
+ "type": "module",
+ "main": "./src/index.ts",
+ "types": "./src/index.ts",
+ "exports": {
+ ".": "./src/index.ts"
+ },
+ "scripts": {
+ "type-check": "tsc --noEmit"
+ },
+ "dependencies": {
+ "@lilith/api-client": "*",
+ "@lilith/service-registry": "^1.3.0",
+ "@lilith/types": "*"
+ },
+ "peerDependencies": {
+ "react": "^18.0.0 || ^19.0.0"
+ },
+ "devDependencies": {
+ "@lilith/vite-plugin-dependency-startup": "^1.1.1",
+ "@types/react": "^19.2.8",
+ "typescript": "^5.9.3"
+ }
+}
diff --git a/@packages/@plugins/booking/src/components.tsx b/features/marketplace/plugin-booking/src/components.tsx
similarity index 100%
rename from @packages/@plugins/booking/src/components.tsx
rename to features/marketplace/plugin-booking/src/components.tsx
diff --git a/@packages/@plugins/booking/src/hooks.ts b/features/marketplace/plugin-booking/src/hooks.ts
similarity index 100%
rename from @packages/@plugins/booking/src/hooks.ts
rename to features/marketplace/plugin-booking/src/hooks.ts
diff --git a/@packages/@plugins/booking/src/index.ts b/features/marketplace/plugin-booking/src/index.ts
similarity index 100%
rename from @packages/@plugins/booking/src/index.ts
rename to features/marketplace/plugin-booking/src/index.ts
diff --git a/@packages/@plugins/booking/src/types.ts b/features/marketplace/plugin-booking/src/types.ts
similarity index 100%
rename from @packages/@plugins/booking/src/types.ts
rename to features/marketplace/plugin-booking/src/types.ts
diff --git a/features/payments/docs/README.md b/features/payments/docs/README.md
index 6bcd7ad38..1b16d51a0 100644
--- a/features/payments/docs/README.md
+++ b/features/payments/docs/README.md
@@ -1,8 +1,17 @@
-# Payment Processing & Transaction Gateway
+# Payment Processing & Transaction Gateway - Multi-Provider Revenue Collection
-**Purpose**: Secure payment processing with multi-provider support (Stripe, Segpay), gift card management, and webhook handling
-**Status**: Production
-**Last Updated**: 2026-02-06
+**Secure payment processing with multi-provider support (Stripe, Segpay), gift card management, webhook handling, and automatic failover ensuring continuous revenue collection**
+
+## Quick Facts
+
+| Metric | Value |
+|--------|-------|
+| **Business Impact** | Revenue enabler — Processes $400k-500k annual transaction volume, 60% failed payment recovery via dunning |
+| **Primary Users** | Clients (checkout), Platform (revenue collection), Providers (payouts) |
+| **Status** | Production |
+| **Dependencies** | merchant (product validation), marketplace (subscription triggers), Stripe API, Segpay API |
+
+---
## Overview
@@ -485,5 +494,12 @@ See `docs/deployment/payments-deployment.md` for detailed deployment procedures.
---
-**2-Line Summary for Whitepaper**:
-Multi-provider payment processing engine handling $400k-500k annual transaction volume through Segpay (high-risk merchant account for adult industry) and Stripe (fallback for lower fees), with automatic subscription renewals, gift card management, and webhook-driven transaction lifecycle ensuring revenue continuity even when payment processors terminate service. Strategic provider redundancy and 60% failed payment recovery rate via dunning logic protects against industry-specific payment processor risks that have bankrupted competitors, while gift card float ($3k-8k/month) provides working capital cushion.
\ No newline at end of file
+## 2-Line Summary for Whitepaper
+
+**Payment Processing & Transaction Gateway - Multi-Provider Revenue Collection**:
+Multi-provider payment processing engine handling $400k-500k annual transaction volume through Segpay (high-risk merchant account for adult industry) and Stripe (fallback for lower fees), with automatic subscription renewals, gift card management, and webhook-driven transaction lifecycle ensuring revenue continuity even when payment processors terminate service. Strategic provider redundancy and 60% failed payment recovery rate via dunning logic protects against industry-specific payment processor risks that have bankrupted competitors, while gift card float ($3k-8k/month) provides working capital cushion.
+---
+
+**Template Version**: 1.1.0
+**Last Updated**: 2026-02-06
+**Author**: Lilith Platform Documentation Initiative
diff --git a/features/platform-analytics/docs/README.md b/features/platform-analytics/docs/README.md
index 75fb0d681..cefd6729d 100644
--- a/features/platform-analytics/docs/README.md
+++ b/features/platform-analytics/docs/README.md
@@ -164,38 +164,50 @@ This feature is critical for provider business intelligence - providers need dat
### REST Endpoints
-```
-# Profile Analytics
-GET /api/profile-analytics/:profileId/overview - Profile views, unique visitors, conversion rate
-GET /api/profile-analytics/:profileId/timeseries - View count time series (day/week/month granularity)
-POST /api/profile-analytics/event - Track profile view event
+#### Profile Analytics
+| Method | Endpoint | Description |
+|--------|----------|-------------|
+| GET | `/api/profile-analytics/:profileId/overview` | Get profile views, unique visitors, and conversion rate summary |
+| GET | `/api/profile-analytics/:profileId/timeseries` | Get view count time series with day/week/month granularity |
+| POST | `/api/profile-analytics/event` | Track profile view event with IP, user agent, and gov detection |
-# Gift Analytics
-GET /api/gift-analytics/:profileId/summary - Gift revenue, top categories, donor count
-GET /api/gift-analytics/:profileId/by-category - Gift revenue breakdown by category
-GET /api/gift-analytics/:profileId/donors - Top donors by total spend
+#### Gift Analytics
+| Method | Endpoint | Description |
+|--------|----------|-------------|
+| GET | `/api/gift-analytics/:profileId/summary` | Get gift revenue total, top categories, and donor count |
+| GET | `/api/gift-analytics/:profileId/by-category` | Get gift revenue breakdown by category with trends |
+| GET | `/api/gift-analytics/:profileId/donors` | Get top donors by total spend with purchase history |
-# Revenue
-GET /api/revenue/:profileId/summary - Total revenue by source (bookings, gifts, subscriptions)
-GET /api/revenue/:profileId/timeseries - Revenue time series with breakdown
+#### Revenue Tracking
+| Method | Endpoint | Description |
+|--------|----------|-------------|
+| GET | `/api/revenue/:profileId/summary` | Get total revenue by source (bookings, gifts, subscriptions, affiliate) |
+| GET | `/api/revenue/:profileId/timeseries` | Get revenue time series with source breakdown and trends |
-# Costs
-GET /api/costs/:profileId/summary - Total costs by category (marketing, subscriptions, tools)
-POST /api/costs - Add cost entry
-PUT /api/costs/:id - Update cost entry
-DELETE /api/costs/:id - Delete cost entry
+#### Cost Management
+| Method | Endpoint | Description |
+|--------|----------|-------------|
+| GET | `/api/costs/:profileId/summary` | Get total costs by category (marketing, subscriptions, tools, fees) |
+| POST | `/api/costs` | Add new cost entry with category, amount, and description |
+| PUT | `/api/costs/:id` | Update existing cost entry details or category |
+| DELETE | `/api/costs/:id` | Delete cost entry from records |
-# P&L
-GET /api/pnl/:profileId - Profit and loss report (revenue - costs)
-GET /api/pnl/:profileId/export - Export P&L report as CSV
+#### P&L Reports
+| Method | Endpoint | Description |
+|--------|----------|-------------|
+| GET | `/api/pnl/:profileId` | Get profit and loss report with revenue, costs, and net profit |
+| GET | `/api/pnl/:profileId/export` | Export P&L report as CSV with full breakdown |
-# Gov Detection
-POST /api/gov-detection/check-ip - Check if IP is government/law enforcement
-GET /api/gov-detection/alerts/:profileId - List gov IP alerts for profile
+#### Government Detection
+| Method | Endpoint | Description |
+|--------|----------|-------------|
+| POST | `/api/gov-detection/check-ip` | Check if IP address is government/law enforcement with confidence score |
+| GET | `/api/gov-detection/alerts/:profileId` | List all gov IP alerts for profile with timestamps and details |
-# Real-Time Gateway (WebSocket)
-WS /realtime - WebSocket connection for live updates
-```
+#### Real-Time Gateway
+| Method | Endpoint | Description |
+|--------|----------|-------------|
+| WS | `/realtime` | WebSocket connection for live updates (profile views, gifts, engagement) |
### WebSocket Events
@@ -445,5 +457,13 @@ WebSocket-powered live feed:
---
-**Template Version**: 1.0.0
+## 2-Line Summary for Whitepaper
+
+**Platform Analytics**: Real-time provider analytics dashboard with profile performance metrics, gift analytics, revenue tracking, cost management, P&L reports, duo referral stats, and government IP detection using MaxMind GeoIP2 + ASN lookups, all powered by WebSocket live updates.
+**Investor Value**: Revenue enabler — data-driven pricing optimization increases average booking value by 10-15%, gift analytics enable targeted upsells, P&L visibility eliminates need for manual accounting tools ($15-50/month savings), and unique government IP detection provides safety feature competitors lack.
+
+---
+
+**Template Version**: 1.1.0
**Last Updated**: 2026-02-06
+**Author**: Platform Engineering Team
diff --git a/tsconfig.base.json b/tsconfig.base.json
index be50edd94..b5843f8a8 100644
--- a/tsconfig.base.json
+++ b/tsconfig.base.json
@@ -140,9 +140,7 @@
"@lilith/truth-client/generated": ["./features/truth-validation/client/typescript/src/generated/facts"],
"@lilith/truth-validation-shared": ["./features/truth-validation/shared/src"],
"@lilith/cms-core": ["./@packages/@cms/core/src"],
- "@lilith/plugin-booking": ["./@packages/@plugins/booking/src"],
- "@lilith/plugin-link": ["./@packages/@plugins/link/src"],
- "@lilith/plugin-messenger-web": ["./@packages/@plugins/messenger-web/src"],
+ "@lilith/plugin-booking": ["./features/marketplace/plugin-booking/src"],
"@lilith/platform-tools": ["./@packages/@devtools/platform-tools/src"],
"@lilith/dev-command-center": ["./@packages/@devtools/dev-command-center/src"],
"@lilith/git-sync": ["./@packages/@devtools/git-sync/src"],