High-performance API for recording and retrieving A/B test metrics in the Sophra System
ResultsSchema
defines the structure for submitting A/B test results:
testId
: Unique identifier for the A/B testvariantId
: Identifier for the specific variantmetrics
: Key-value pairs of metric names and their numeric valuessessionId
: Unique identifier for the user sessionmetadata
: Optional additional contextual informationPOST
and GET
functions return a NextResponse
object, containing either the operation result or error information.
Data Flow
Validation Errors
Database Errors
Runtime Errors
createMany
for efficient batch inserts of metricstestId
and variantId
for fast queriesNODE_ENV
: Determines the execution environment (development/production)PORT
: Specifies the port on which the API server runsABTest
and ABTestMetric
) as defined in the Prisma schema.