Eine kleine HTML Datei um das SF Quiz mitzuspielen

Hi!

Für alle die das Stay Forever Quiz genauso sehr mögen wie ich und immer „mitspielen“ habe ich eine kleine HTML für das Stay Forever Quiz mit KI erstellen lassen. Es ist eine einzelne HTML Datei, welche folgende Funktionen hat:

  • Nummer der aktuellen Frage
  • den aktuellen Punktestand von Gunnar, Fabian, Fabian und dem Spieler (euch)
  • Anzahl der Joker
  • individueller Spielernamen (also euren Namen)
  • löschen der bisherigen Eingaben (bis auf den Spielernamen)
  • lokale Speicherung der Eingaben im Browser

Download: LINK (das Forum erlaubt nur Bilder als Anhänge wegen Security Dingen)

Ich müsst nur die Datei „stayforeverquiz.html“ öffnen und schon könnt ihr loslegen. (optimiert und getestet auf MS Edge)
Wenn ihr die Datei auf dem Smartphone oder auf einem Webserver ablegt → die Webseite ist responsiv (optimiert und getestet auf iOS)

Viel Spaß euch damit!

@Stay Forever Team:

  • solltet ihr das nicht wünschen → bitte kurze PN, dann ist es sofort wieder weg
  • könntet ihr die ZIP-Datei vielleicht hier irgendwie im Thread abspeichern, ich weiß nicht ob meine Domain noch in 20 Jahren existieren wird :wink:
9 „Gefällt mir“

Da jetzt noch ne API dran bzw. irgendeine online Multiplayer-Möglichkeit und dann könnten alle auf der Con mitspielen. Habe das früher bei den RocketBeans geliebt wenn die Community miteinbezogen war.

3 „Gefällt mir“

Coole Idee! Kannst du das umsetzen?

Waere da grundsaetzlich bei einer Community Umsetzung dabei.

“Mal eben” ist das aber auch nicht gemacht. Koennen ja gerne mit paar TechnikerInnen hier brainstormen.

Aus Techstack Sicht waere ich bei: nextjs, typescript, springboot, CMS mit Wissen dabei.

Hosting (mit repo dran und deployments) koennte ich stellen.


Mal nen schneller AI Aufriss


name: Community Quiz App
overview: Build a Next.js PWA for real-time community voting where users scan QR codes to join rooms, vote on responses, and admins select correct answers to calculate results.


Community Quiz App Implementation Plan

Architecture Overview

The app will be built as a Next.js 16+ PWA with the following stack:

  • Frontend: Next.js with App Router, TypeScript, Tailwind CSS
  • Backend: Next.js API routes + Server Actions
  • Database: PostgreSQL (Neon for serverless deployment)
  • Real-time: PartyKit for WebSocket connections
  • Authentication: NextAuth.js for admin authentication
  • PWA: Progressive Web App with offline capabilities
  • QR Codes: Generation with qrcode, scanning with html5-qrcode
flowchart TB
    QR[QR Code Scanner] --> Join[Join Room Flow]
    Join --> Vote[Voting Interface] 
    Vote --> WS[PartyKit WebSocket]
    WS --> Results[Real-time Results]
    
    Admin[Admin Interface] --> CreateRoom[Create Room]
    CreateRoom --> QRGen[Generate QR Code]
    Admin --> SelectAnswer[Select Correct Answer]
    SelectAnswer --> WS
    
    subgraph backend [Backend Services]
        API[Next.js API Routes]
        DB[(PostgreSQL Database)]
        Auth[NextAuth.js]
    end
    
    Vote --> API
    Admin --> Auth
    API --> DB

Database Schema

Core tables for the voting system:

-- Rooms created by admins
CREATE TABLE rooms (
  id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
  slug VARCHAR(50) UNIQUE NOT NULL,
  title VARCHAR(200) NOT NULL,
  status VARCHAR(20) DEFAULT 'waiting', -- waiting, active, completed
  created_at TIMESTAMP DEFAULT NOW(),
  admin_id VARCHAR(100) NOT NULL
);

-- Participants who join rooms
CREATE TABLE participants (
  id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
  room_id UUID REFERENCES rooms(id) ON DELETE CASCADE,
  username VARCHAR(50) NOT NULL,
  joined_at TIMESTAMP DEFAULT NOW(),
  UNIQUE(room_id, username)
);

-- Questions (even though external app manages them, we track for voting)
CREATE TABLE questions (
  id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
  room_id UUID REFERENCES rooms(id) ON DELETE CASCADE,
  question_text TEXT NOT NULL,
  options JSONB NOT NULL, -- [{"id": "a", "text": "Option A"}, ...]
  correct_option_id VARCHAR(10), -- Set by admin
  status VARCHAR(20) DEFAULT 'pending', -- pending, voting, completed
  created_at TIMESTAMP DEFAULT NOW()
);

-- User votes
CREATE TABLE votes (
  id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
  question_id UUID REFERENCES questions(id) ON DELETE CASCADE,
  participant_id UUID REFERENCES participants(id) ON DELETE CASCADE,
  selected_option_id VARCHAR(10) NOT NULL,
  voted_at TIMESTAMP DEFAULT NOW(),
  UNIQUE(question_id, participant_id)
);

Project Structure

src/
├── app/
│   ├── (auth)/
│   │   └── admin/
│   │       ├── page.tsx          # Admin dashboard
│   │       ├── rooms/
│   │       │   ├── page.tsx      # Room management
│   │       │   ├── create/page.tsx
│   │       │   └── [roomId]/page.tsx
│   │       └── layout.tsx        # Admin layout with auth
│   ├── vote/
│   │   └── [roomSlug]/
│   │       ├── page.tsx          # Main voting interface
│   │       └── join/page.tsx     # Join room flow
│   ├── scan/
│   │   └── page.tsx              # QR code scanner
│   ├── api/
│   │   ├── auth/[...nextauth]/route.ts
│   │   ├── rooms/
│   │   │   ├── route.ts          # CRUD operations
│   │   │   └── [roomId]/
│   │   │       ├── join/route.ts
│   │   │       ├── vote/route.ts
│   │   │       └── results/route.ts
│   │   └── questions/[questionId]/
│   │       └── correct-answer/route.ts
│   ├── globals.css
│   ├── layout.tsx                # Root layout with PWA meta
│   └── page.tsx                  # Landing page
├── components/
│   ├── ui/                       # Reusable UI components
│   ├── QRScanner.tsx             # Camera-based QR scanner
│   ├── VotingInterface.tsx       # Real-time voting UI
│   ├── RoomManager.tsx           # Admin room management
│   └── ResultsDisplay.tsx        # Live results visualization
├── lib/
│   ├── db.ts                     # Database connection (Prisma)
│   ├── auth.ts                   # NextAuth configuration
│   ├── party-client.ts           # PartyKit client setup
│   └── qr-utils.ts               # QR generation utilities
├── party/
│   └── room-server.ts            # PartyKit room server
└── types/
    └── index.ts                  # TypeScript definitions

Implementation Phases

Phase 1: Project Setup & Database

  1. Initialize Next.js project with TypeScript, Tailwind CSS, and PWA configuration
  2. Setup Neon PostgreSQL database and Prisma ORM
  3. Configure NextAuth.js for admin authentication with credentials provider
  4. Setup PartyKit for real-time WebSocket connections
  5. Create database schema and run initial migrations

Key files:

  • [prisma/schema.prisma] - Database schema with room, participant, question, vote models
  • [lib/auth.ts] - NextAuth.js configuration with admin role checking
  • [party/room-server.ts] - PartyKit server for room-based real-time updates

Phase 2: Core Room Management

  1. Admin dashboard for creating and managing quiz rooms
  2. QR code generation for each room with secure join URLs
  3. Room joining flow where users enter username after scanning QR
  4. Basic room state management (waiting, active, completed)

Key components:

  • [app/(auth)/admin/rooms/create/page.tsx] - Room creation form with QR generation
  • [components/RoomManager.tsx] - Admin interface for room status and participant list
  • [lib/qr-utils.ts] - Utility functions for generating room QR codes

Phase 3: QR Scanning & Joining

  1. QR code scanner component using device camera
  2. Mobile-optimized joining flow with username input
  3. Room validation and participant registration
  4. PWA manifest and service worker for mobile experience

Key components:

  • [components/QRScanner.tsx] - Camera-based QR code scanner using html5-qrcode
  • [app/scan/page.tsx] - QR scanner page with camera permissions
  • [app/vote/[roomSlug]/join/page.tsx] - Username input and room joining
  • [app/manifest.json] - PWA manifest for mobile installation

Phase 4: Voting System

  1. Voting interface for participants to select answers
  2. Real-time vote tracking without showing results initially
  3. Vote validation (one vote per question per user)
  4. Admin interface for monitoring active voting

Key components:

  • [components/VotingInterface.tsx] - Question display with option selection
  • [app/api/rooms/[roomId]/vote/route.ts] - API endpoint for submitting votes
  • [app/vote/[roomSlug]/page.tsx] - Main voting page with real-time connection

Phase 5: Results & Admin Controls

  1. Admin answer selection interface for marking correct responses
  2. Results calculation based on admin-selected correct answers
  3. Real-time results broadcast to all participants after admin selection
  4. Results visualization with vote counts and percentages

Key components:

  • [components/ResultsDisplay.tsx] - Live results with charts and vote counts
  • [app/api/questions/[questionId]/correct-answer/route.ts] - Admin endpoint for setting correct answers
  • Real-time updates via PartyKit when admin selects correct answer

Phase 6: Polish & Production

  1. Mobile optimizations for PWA experience
  2. Error handling and loading states
  3. Rate limiting and basic security measures
  4. Deployment configuration for Vercel with Neon database

Real-time Communication Flow

PartyKit Integration Pattern:

// party/room-server.ts - Room-specific WebSocket server
export default class RoomServer {
  async onMessage(message: string, sender: Party.Connection) {
    const data = JSON.parse(message);
    
    switch (data.type) {
      case 'vote_submitted':
        // Broadcast vote count update (without revealing answers)
        this.party.broadcast(JSON.stringify({
          type: 'vote_count_update',
          questionId: data.questionId,
          totalVotes: await this.getVoteCount(data.questionId)
        }));
        break;
        
      case 'admin_selected_answer':
        // Broadcast results when admin selects correct answer
        const results = await this.calculateResults(data.questionId);
        this.party.broadcast(JSON.stringify({
          type: 'results_revealed',
          questionId: data.questionId,
          results
        }));
        break;
    }
  }
}

Security Considerations

  1. Room access control via signed URLs in QR codes
  2. Admin authentication with session-based protection
  3. Rate limiting on vote submission endpoints
  4. Input validation for usernames and vote options
  5. HTTPS enforcement for camera access and PWA features

This plan provides a complete foundation for your community quiz app with real-time voting capabilities, QR code integration, and admin controls for managing quiz results.

6 „Gefällt mir“

Wer Interesse hat, schreibt mich gerne hier im Forum oder im SF Discord (lnhh00) an.

1 „Gefällt mir“

Ich bau die Tage mal einen Prototyp ohne fancy Frameworks :slight_smile: Klingt aber in großen Teilen danach, als könnte man sowas auch mit https://kahoot.it/ machen. Wäre quasi ein Mini-Nachbau.

2 „Gefällt mir“

Und, ist was draus geworden?

Die Verwaltung von Fragen läuft soweit, man kann auch dann mehrere Fragen zu einem Quiz hinzufügen. Weiter bin ich noch nicht gekommen…

1 „Gefällt mir“

Ist noch sehr grob…

1 „Gefällt mir“

Quiz 01 will jemand ausprobieren? Sind KI-Generierte Musterfragen…

Bin hier gerade durch Zufall reingestolpert und habe es mal ausprobiert.

Funktionierte einwandfrei (iPhone 16)

Kann jetzt inhaltlich wenig beitragen, machte aber einen insgesamt ganz runden Eindruck.

1 „Gefällt mir“

Multiplayer geht nun auch… wenn man das Quiz startet, bekommt man Links für die Teilnehmer, die können sich dann optional mit einklinken. Man kann es lokal testen, wenn man zwei verschiedene Browser (Safari/Chrome oder Firefox/Chrome oder so) nutzt.

2 „Gefällt mir“

Also es wäre nun bereit für einen Alpha-Test, wenn jemand Lust hat :slight_smile:

1 „Gefällt mir“

Und? Weiterbauen oder ist Quatsch? :sweat_smile:

Admin muesste schon die Runden steuern koennen. Solange jeder im eigenen Tempo durchschalten kann, ist das Quiz ja “quatsch”. Ergo, denke Websockets?

Das Quiz läuft erst weiter wenn alle eingeloggt haben :slight_smile:

Und wenn sich Spieler X 20min Zeit nimmt?

Sollte man sich bessere Freunde suchen :face_with_peeking_eye::sweat_smile:

Du brauchst schon Push, wenn du Polling vermeiden willst.