Skip to content

tinkertanker/classroom-widgets

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

760 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Classroom Widgets Documentation

A suite of interactive classroom management tools with real-time student engagement features.

πŸ“š Table of Contents

🎯 Project Overview

Classroom Widgets is a real-time classroom management system that enables teachers to create interactive activities and engage with students through various widget tools. The system consists of:

  • Teacher Application: A React-based interface for creating and managing classroom activities
  • Student Application: A responsive web app for students to participate in activities.
  • Backend Server: An Express.js server handling real-time communication via Socket.io.

Available Widgets

  • Interactive: Poll, Questions, Drop Box, Handout, Real-time Feedback.
  • Utility: Timer, Randomiser, List, Task Cue, Traffic Light.
  • Display: Text Banner, Image Display, QR Code, Sound Effects, Stickers.

πŸš€ Quick Start

Prerequisites

  • Node.js 18+ and npm
  • Git
  • Docker and Docker Compose (for production deployment)

First Time Setup

# Clone the repository
git clone https://github.com/yourusername/classroom-widgets.git
cd classroom-widgets

# Install all dependencies
npm run install:all

Development

To run all services (recommended):

npm run dev

This automatically starts:

Production Build

npm run build:all

πŸ—οΈ Architecture

System Overview (Development Environment)

The project is a monorepo consisting of three main parts that run concurrently during development using npm run dev.

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Teacher App   β”‚         β”‚  Student App    β”‚
β”‚   (Vite + React)β”‚         β”‚ (Vite + React)  β”‚
β”‚  localhost:3000 β”‚         β”‚ localhost:3002  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜         β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚                           β”‚
         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                   β”‚
           β”Œβ”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”
           β”‚ Express Server β”‚
           β”‚  (Socket.io)   β”‚
           β”‚ localhost:3001 β”‚
           β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Note: In development, each frontend runs on its own Vite dev server for hot module replacement (HMR). In production, both are served as static files by the Express server.

Project Structure

The repository is structured as a monorepo with three package.json files, orchestrating the three main parts of the application.

classroom-widgets/
β”œβ”€β”€ src/                      # Teacher App source code (Vite + React)
β”‚   β”œβ”€β”€ components/           # Widget and UI components
β”‚   β”œβ”€β”€ features/             # Feature-based modules (widgets, session, etc.)
β”‚   β”œβ”€β”€ store/                # Zustand state management
β”‚   └── index.tsx             # Main entry point for the Teacher App
β”œβ”€β”€ server/                   # Backend and Student App workspace
β”‚   β”œβ”€β”€ src/                  # Server source code
β”‚   β”‚   β”œβ”€β”€ server.js         # Main Express + Socket.io server entry point
β”‚   β”‚   β”œβ”€β”€ config/           # Environment and app configuration
β”‚   β”‚   β”œβ”€β”€ middleware/       # Express middleware
β”‚   β”‚   β”œβ”€β”€ routes/           # API routes
β”‚   β”‚   β”œβ”€β”€ sockets/          # Socket.IO event handlers
β”‚   β”‚   └── student/          # Student App source code (Vite + React)
β”‚   β”‚       β”œβ”€β”€ src/          # Student App components and logic
β”‚   β”‚       └── package.json  # Student App dependencies
β”‚   β”œβ”€β”€ public/               # Built Student App (served by Express)
β”‚   └── package.json          # Backend server dependencies
β”œβ”€β”€ docs/                     # Project documentation
β”œβ”€β”€ package.json              # Root package (for Teacher App) and monorepo scripts
└── vite.config.js            # Vite config for the Teacher App

Technology Stack

  • Frontend: React 18, TypeScript, Tailwind CSS, Vite
  • Backend: Express.js, Socket.io
  • State Management: Zustand
  • Deployment: Docker, Nginx

✨ Features

Available Widgets

Interactive Widgets

  • Poll: Real-time voting with live results
  • Questions: Q&A submission and management
  • Drop Box: Collect links and text submissions from students
  • Handout: Push content (links, text) to all students
  • RT Feedback: Real-time understanding gauge (1-5 scale)

Utility Widgets

  • Timer: Countdown and stopwatch functionality
  • Randomiser: Random selection with visual effects
  • List: Task management with completion tracking
  • Task Cue: Visual work mode indicators
  • Traffic Light: Status indicators

Display Widgets

  • Text Banner: Customizable text displays
  • Image Display: Image viewer
  • QR Code: Generate QR codes for sharing
  • Sound Effects: Audio playback
  • Sticker: Decorative elements

Session Management

  1. Teacher creates session: Automatic 5-character code generation
  2. Students join: Enter code at /student URL
  3. Real-time sync: All activities update instantly
  4. Multi-widget support: Multiple activities per session

UI Features

  • Drag & Drop: Position widgets anywhere on the workspace
  • Resize: Adjust widget sizes with aspect ratio constraints
  • Voice Commands: Hands-free widget control using speech recognition + AI
  • Backgrounds: Multiple pattern options
  • Dark Mode: System-aware theme switching
  • Toolbar Customization: Choose which widgets to display
  • Workspace Persistence: Auto-saves layout

Voice Command System

Control widgets hands-free using natural language:

  • Speech Recognition: Uses Annyang library for voice input
  • Hybrid Processing: Fast pattern matching (~5ms) + AI fallback via Ollama (~200-800ms)
  • Single Source of Truth: All commands defined in shared/voiceCommandDefinitions.json
  • Auto-Sync: TypeScript/JavaScript generated automatically to keep frontend/backend in sync

Example commands: "start a 5 minute timer", "launch the poll widget", "pick someone at random"

See VOICE_COMMAND_SHARED_DEFINITIONS.md for details.

πŸ’» Development

Available Scripts

The most important scripts are run from the root package.json:

# Install all dependencies in all workspaces
npm run install:all

# Run Teacher App, Student App, and Server concurrently
npm run dev

# Build all applications for production (auto-generates voice types)
npm run build:all

# Regenerate voice command type definitions (TypeScript/JavaScript)
npm run generate:voice-types

# Start the production server
npm start

# Run tests for the Teacher App
npm test

See Getting Started Guide for more development details.

Development with Claude Code

If you're using Claude Code to assist with development, ask it to check for a running tmux session. Claude Code can read the dev server logs directly from tmux using:

# List tmux sessions
tmux list-sessions

# Capture recent logs (last 100 lines)
tmux capture-pane -t 0 -p -S -100

Recommended setup:

  1. Start a tmux session: tmux new -s dev
  2. Run the dev servers: npm run dev (or npm run dev:concurrent)
  3. Claude Code can then monitor logs alongside you

Environment Variables

# Copy the example file to get started
cp .env.example .env

# Edit .env to add your API keys (optional)
nano .env

See Environment Setup Guide for complete environment configuration guide.

Adding New Widgets

See Adding New Widget Guide for a step-by-step guide.

πŸ“¦ Deployment

Use npm version to bump the version, commit, and tag in one step β€” the version is displayed in the app UI and is read from the root package.json:

npm version 1.2.3
git push origin master --tags

Pushing a v* tag triggers the GitHub Actions workflow which auto-deploys to production.

Note: This workflow is untested end-to-end. Verify that npm version correctly creates the git tag and that the version displayed in the app reflects the root package.json before relying on it.

See Deployment Guide for full instructions including CD setup, Docker, and environment configuration.

πŸ“– Documentation

All comprehensive documentation is in the docs/ directory:

For Developers

For Deployment

Reference

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Commit changes: git commit -m 'Add amazing feature'
  4. Push to branch: git push origin feature/amazing-feature
  5. Open a Pull Request

πŸ“„ License

This project is licensed under the MIT License.

About

Classroom widgets, for the classroom. To use in classes. In rooms.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • TypeScript 81.8%
  • JavaScript 16.7%
  • Other 1.5%