MATIH Platform is in active MVP development. Documentation reflects current implementation status.
7. Tenant Lifecycle
Playground
Playground Environments

Playground Environments

The playground system provides free-tier trial environments for prospective users. It manages a fixed pool of 16 playground slots with automatic lifecycle management, waitlisting, and conversion to paid subscriptions. Served by PlaygroundController at /api/v1/playground.


How Playground Works

New users sign up for a playground slot. If a slot is available, it is allocated immediately with a 14-day expiration. If all slots are occupied, the user is added to a waitlist and notified when a slot becomes available.

User                    PlaygroundController          PlaygroundService
  |                            |                            |
  |--- POST /signup ---------->|                            |
  |                            |--- allocateSlot() -------->|
  |                            |                            |--- Check availability
  |                            |                            |--- Allocate or waitlist
  |<-- SignupResponse ---------|<-- AllocationResult --------|

Slot Lifecycle

StateDescription
AVAILABLESlot is free and can be allocated
ALLOCATEDSlot is assigned to a user
EXPIREDSlot's 14-day period has ended
GRACE_PERIODUser is in the post-expiry grace period
PURGEDSlot has been cleaned up and data removed
CONVERTEDUser converted to a paid subscription

Endpoints

MethodEndpointDescription
POST/api/v1/playground/signupRequest a playground slot
POST/api/v1/playground/waitlistJoin the waitlist explicitly
POST/api/v1/playground/waitlist/claimClaim waitlist slot
GET/api/v1/playground/statusGet playground status for user
GET/api/v1/playground/slots/availableGet available slot count
GET/api/v1/playground/waitlist/positionGet waitlist position
POST/api/v1/playground/convertConvert to paid customer
POST/api/v1/playground/slots/:slotId/activityRecord activity

Signup Response

{
  "allocated": true,
  "addedToWaitlist": false,
  "alreadyAllocated": false,
  "slotId": "uuid",
  "slotNumber": 7,
  "expiresAt": "2026-02-26T10:00:00Z",
  "message": "Playground slot 7 allocated! Expires in 14 days."
}

Waitlist Management

When no slots are available, users are placed on a FIFO waitlist. The waitlist response includes the position and estimated wait time.


Conversion to Paid

{
  "tenantId": "uuid",
  "planCode": "professional",
  "paymentMethodId": "pm_abc123"
}

Converting preserves all data and configurations from the playground environment.


Admin Operations

EndpointDescription
GET /api/v1/playground/admin/slotsList all slots with status
GET /api/v1/playground/admin/waitlistView entire waitlist
POST /api/v1/playground/admin/slots/:slotId/purgeManually purge a slot
POST /api/v1/playground/admin/process-expiredProcess expired slots
POST /api/v1/playground/admin/process-grace-periodProcess grace periods
POST /api/v1/playground/admin/process-waitlistProcess waitlist allocations