Skip to content

About

No description, website, or topics provided.

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

A/B Testing Platform

Enterprise-grade A/B Testing platform with full experiment lifecycle management, traffic splitting, reporting, and governance capabilities.

Quick Start

Using Docker Compose (Recommended)

# Clone and start
git clone <repository-url>
cd user-group
./scripts/deploy.sh up

# Rebuild images and replace application containers (requires Node.js 22.x)
./deploy.sh

# Access the platform
open http://localhost:4000

Docker Desktop groups the containers under abtesting. For initial JWT setup and migrating the previous docker group while preserving its database, see the deployment guide.

After applying database migrations, initialize the first login account:

./scripts/init-admin.sh

This creates admin@example.com with a random password printed once, plus the default tenant, project, and project administrator role. Existing passwords are preserved on repeat runs. Open http://localhost:4000/login to sign in.

Manual Setup

# Install dependencies
pnpm install

# Start PostgreSQL
docker compose -f infra/docker/docker-compose.yml up postgres -d

# Generate Prisma client
pnpm db:generate

# Run migrations
pnpm db:migrate:deploy

# Seed database
pnpm db:seed

# Build and start
pnpm build
pnpm start

Architecture

┌─────────────────┐     ┌─────────────────┐     ┌─────────────────┐
│   Console Web   │     │  Control Plane  │     │ Diversion Svc   │
│   (Port 4000)   │────▶│   (Port 3100)   │────▶│   (Port 3200)   │
└─────────────────┘     └────────┬────────┘     └─────────────────┘
                                 │
                        ┌────────┴────────┐
                        │   PostgreSQL    │
                        │   (Port 5433)   │
                        └─────────────────┘

Services

Service Port Description
Console Web 4000 React + Ant Design frontend
Control Plane API 3100 Main API service (NestJS)
Diversion Service 3200 Traffic splitting service
Report Service 3300 Reporting and analytics

Monitoring Stack

Service Port URL Credentials
Prometheus 9090 http://localhost:9090 -
Alertmanager 9093 http://localhost:9093 -
Grafana 3000 http://localhost:3000 admin/admin
Loki 3101 http://localhost:3101 -

Features

Experiment Management

  • Create and manage A/B tests
  • Multiple experiment types: PROGRAM, MULTI_CROWD, TIME_SLICE, PARENT_CHILD
  • Traffic splitting with hash-based allocation
  • Debug device overrides and whitelists

Approval Workflows

  • Configurable approval processes
  • External approval system integration
  • Audit trail for all decisions

Reporting

  • Real-time experiment metrics
  • Report queries with async execution
  • Export to CSV, Excel, PDF

Enterprise Governance

  • Multi-tenant isolation
  • Feature flags and capabilities
  • Quota and rate limiting
  • Audit logging with risk levels
  • Retention policies

API Documentation

See API Documentation for complete endpoint reference.

Quick API Examples

# List experiments
curl -H "X-Tenant-Id: tenant1" -H "X-Project-Id: project1" \
  http://localhost:3100/api/v1/projects/project1/experiments

# Create experiment
curl -X POST -H "Content-Type: application/json" \
  -H "X-Tenant-Id: tenant1" -H "X-Project-Id: project1" \
  -d '{"name":"Test","type":"PROGRAM","subjectType":"LOGIN_ID","layerRatioPercent":50}' \
  http://localhost:3100/api/v1/projects/project1/experiments

# Health check
curl http://localhost:3100/api/v1/observability/health

# Metrics
curl http://localhost:3100/api/v1/observability/metrics

Development

Commands

pnpm build          # Build all packages
pnpm test           # Run all tests
pnpm test:program-workflow # Isolated real PROGRAM lifecycle + SDK + known-event report acceptance
pnpm test:complex-workflow # Five complex types against real services + SDK
pnpm test:planned-workflow # Frozen plans, automatic sealing, fixed/anytime + protocol regressions
pnpm test:eligibility-blank # Blank/feature gates with real services and automatic sealing
pnpm test:eligibility-dependencies # Parent/neighbor/formal-source eligibility closure
pnpm typecheck      # Type checking
pnpm lint           # Lint code
pnpm dev            # Start development mode

pnpm test includes console helper/SSR tests; it does not replace native browser journey acceptance. Run those frontend checks alone with pnpm --filter @ab/console-web test.

HTTP acceptance apps bind an explicit IPv4 loopback listener for each suite so existing local previews can remain open. See test isolation notes.

Database

pnpm db:generate    # Generate Prisma client
pnpm db:migrate:dev # Create migration
pnpm db:migrate:deploy # Apply migrations
pnpm db:seed        # Seed database
pnpm db:reset       # Reset database

Testing

pnpm --filter @ab/control-plane-api test   # Control plane tests
pnpm --filter @ab/report-service test      # Report service tests
pnpm --filter @ab/diversion-service test   # Diversion service tests

Documentation

Technology Stack

Category Technology
Frontend React 19, Ant Design 5, TypeScript
Backend NestJS, Prisma, PostgreSQL
Build pnpm, Turborepo, Vite
Monitoring Prometheus, Grafana, Loki
Deployment Docker, GitHub Actions

Project Status

The repository has a completed runtime baseline through Enterprise and the currently implemented Phase 8 gap-fill, with a smaller post-baseline gap list still open:

  • ✅ Phase 1-8 runtime baseline
  • ✅ Enterprise T61-T70
  • ✅ Console-Web frontend for core experiment/report/governance flows
  • ✅ Visual experiment editor, MULTILINK configuration, custom reports, and subject switching flows
  • ✅ Project-scoped metrics and audience management workspaces
  • ✅ Project-scoped tag management workspace
  • ✅ TypeScript/Web, Android, and iOS SDK baselines
  • ✅ API / SDK integration guide baseline
  • ✅ External analytics provider boundary design baseline
  • ✅ Docker Deployment
  • ✅ Monitoring & Alerting
  • ✅ Log Aggregation
  • ⏳ Remaining gaps: broader SDK ecosystem, runtime external analysis-platform integration, broader console/workflow polish, and further documentation productization

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests
  5. Submit a pull request

License

MIT

回滚兼容性本地审计:pnpm test:report-rollback(本地已有镜像/独立临时schema,不部署)。正式候选门禁追加--require-compatible;审计完成不表示兼容,当前旧镜像实际结果为不兼容。见运行指南。随机时间片的领域计划/ATE基础已提供,但控制面注册、period收集和结果入口仍在实施,不以基础测试替代完整功能。

About

No description, website, or topics provided.

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages