Skip to main content

Wheel Game

The Wheel Game is an interactive spinning wheel platform that allows users to create customizable wheel configurations, manage prizes, and generate shareable links for game instances.

Overview

The Wheel Game is built as a standalone Next.js application with:
  • Multi-tenant architecture using Nile SDK for data isolation
  • RESTful API with full CRUD operations
  • OpenAPI specification for API documentation
  • TypeScript client auto-generated from OpenAPI spec
  • Material-UI components with Pegasus theme

Architecture

Deployment

  • Frontend: Deployed at sstxt.us/w* (slug-based routing)
  • API: Deployed at api.sstxt.us/games/wheel/*
  • Dashboard: Admin interface at root /

Database Schema

All tables are tenant-scoped for multi-tenancy:

Profiles

Wheel configuration profiles that define the basic structure.
ColumnTypeDescription
id_profileUUIDPrimary key
tenant_idUUIDTenant identifier
nameVARCHARProfile name
versionVARCHARVersion number
configVARCHAR(64)SHA256 hash of configuration

Prizes

Prize definitions with images.
ColumnTypeDescription
id_prizeUUIDPrimary key
tenant_idUUIDTenant identifier
nameVARCHARPrize name
imageTEXTURL to prize image

Configs

SHA256-hashed configurations containing prizes, audio, volume, activation, and expiration settings.
ColumnTypeDescription
id_configVARCHAR(64)SHA256 hash (primary key)
tenant_idUUIDTenant identifier
prizesJSONBArray of prize configurations
audioJSONBAudio settings (wheel, present)
volumeJSONBVolume settings (wheel, present)
activationJSONBActivation settings
expirationJSONBExpiration settings

Instances

Active game instances linking profiles, configs, and links.
ColumnTypeDescription
id_instanceUUIDPrimary key
tenant_idUUIDTenant identifier
id_profileUUIDForeign key to profiles
id_linkUUIDForeign key to links
configVARCHAR(64)SHA256 hash reference
statusVARCHARactive, completed, or expired
resultJSONBGame result data
Shareable links mapping domains and slugs to instances.
ColumnTypeDescription
id_linkUUIDPrimary key
tenant_idUUIDTenant identifier
domainVARCHARDomain name (e.g., sstxt.us)
slugVARCHARURL slug (e.g., w12345)
id_instanceUUIDForeign key to instances

API Endpoints

All API endpoints are prefixed with /api/games/wheel/ and require a x-tenant-id header.

Profiles

  • GET /api/games/wheel/profiles - List all profiles
  • POST /api/games/wheel/profiles - Create a profile
  • GET /api/games/wheel/profiles/{id} - Get profile by ID
  • PATCH /api/games/wheel/profiles/{id} - Update profile
  • DELETE /api/games/wheel/profiles/{id} - Delete profile

Prizes

  • GET /api/games/wheel/prizes - List all prizes
  • POST /api/games/wheel/prizes - Create a prize
  • GET /api/games/wheel/prizes/{id} - Get prize by ID
  • PATCH /api/games/wheel/prizes/{id} - Update prize
  • DELETE /api/games/wheel/prizes/{id} - Delete prize

Configs

  • GET /api/games/wheel/configs - List all configs
  • POST /api/games/wheel/configs - Create a config
  • GET /api/games/wheel/configs/{id} - Get config by hash
  • DELETE /api/games/wheel/configs/{id} - Delete config

Instances

  • GET /api/games/wheel/instances - List all instances
  • POST /api/games/wheel/instances - Create an instance
  • GET /api/games/wheel/instances/{id} - Get instance by ID
  • PATCH /api/games/wheel/instances/{id} - Update instance
  • DELETE /api/games/wheel/instances/{id} - Delete instance
  • GET /api/games/wheel/links - List all links
  • POST /api/games/wheel/links - Create a link
  • GET /api/games/wheel/links/{id} - Get link by ID
  • GET /api/games/wheel/links/lookup?domain={domain}&slug={slug} - Lookup by domain+slug
  • PATCH /api/games/wheel/links/{id} - Update link
  • DELETE /api/games/wheel/links/{id} - Delete link

Getting Started

See the Quickstart Guide for setup instructions.

Resources