Architecture

High-level technical architecture of the Mystery Gift platform.

System Overview

The Mystery Gift platform consists of several independent services that work together:

Services

Service Language Purpose
Livestream Server Node.js 24/7 raffle automation
Stream Overlay React OBS overlay for Twitch
Marketplace API TypeScript (CF Worker) Pack purchasing
Marketplace Client React Gacha machine web UI
Miss AI Node.js Conversational AI agent
Randomness TEE Rust + WASM Verifiable randomness
Vault TEE Rust + WASM Secure NFT custody

Shared Packages

  • blockchain - Solana utilities and RPC clients
  • database - Prisma ORM models and migrations
  • randomness - Randomness provider abstractions
  • shared - TypeScript types and utilities

Data Flow

  1. Token holders snapshotted via RPC
  2. Raffles scheduled and executed
  3. Winners selected via TEE randomness
  4. NFTs transferred from TEE vault to winners
  5. Announcements posted to social media

Security Model

  • TEE Services: Private keys never leave Intel TDX enclaves
  • On-chain Verifiability: All transfers verifiable on Solana/Base
  • Remote Attestation: TEE services provide cryptographic proofs

Next Steps