Developer Guide

Contribute to TallyHub or build custom integrations

Getting Started with Development

Prerequisites

  • โ€ข Node.js 20.9.0 or higher
  • โ€ข npm or yarn package manager
  • โ€ข Git for version control
  • โ€ข TypeScript knowledge recommended

Setup Development Environment

1

Fork and Clone

git clone https://github.com/YOUR_USERNAME/Tallyhub.git
cd Tallyhub
2

Install Dependencies

npm install
3

Start Development Server

npm run dev
4

Open in Browser

Navigate to http://localhost:3000

Available Scripts

npm run dev

Start development server with ts-node + nodemon (hot reload)

npm run build

Compile TypeScript to dist/ for production

npm start

Run compiled production build from dist/

npm run typecheck

TypeScript strict type checking (no emit)

npm run lint

Lint codebase (ESLint + TypeScript rules)

npm run lint:fix

Auto-fix lint issues where possible

npm run format

Format code with Prettier across the repo

npm run logs:prune

Remove log files older than 14 days

npx tallyhub

CLI launcher - builds and starts server

Project Structure

Tallyhub/
โ”œโ”€โ”€ src/                   # TypeScript source files
โ”‚   โ”œโ”€โ”€ index.ts          # Main entry point
โ”‚   โ”œโ”€โ”€ routes/           # API routes
โ”‚   โ”œโ”€โ”€ services/         # Business logic
โ”‚   โ””โ”€โ”€ types/            # TypeScript types
โ”œโ”€โ”€ public/               # Static assets
โ”‚   โ”œโ”€โ”€ firmware/         # Device firmware files
โ”‚   โ””โ”€โ”€ flash.html        # Firmware flasher UI
โ”œโ”€โ”€ dist/                 # Compiled JavaScript (build output)
โ”œโ”€โ”€ logs/                 # Application logs
โ”œโ”€โ”€ docker/               # Docker configuration
โ”œโ”€โ”€ firmware/             # Device firmware source
โ”œโ”€โ”€ bin/                  # CLI tools
โ””โ”€โ”€ docs/                 # Documentation

Contributing Guidelines

๐Ÿ“– Read CONTRIBUTING.md

Before contributing, please read our comprehensive contributing guide:

View CONTRIBUTING.md on GitHub โ†’

Branch Naming

  • โ€ข feature/ - New features
  • โ€ข fix/ - Bug fixes
  • โ€ข docs/ - Documentation updates
  • โ€ข refactor/ - Code refactoring
  • โ€ข test/ - Test additions or changes

Commit Message Style

Use conventional commits format:

feat: add support for TriCaster mixers
fix: resolve device discovery timeout
docs: update installation guide
refactor: improve WebSocket connection handling
chore: bump version to 1.2.0

Code Quality Gates

Before submitting a PR, ensure all quality checks pass:

npm run typecheck     # No TypeScript errors
npm run lint          # No linting errors
npm run format        # Code is formatted
npm run build         # Builds successfully

API & Integration

REST API

TallyHub provides a REST API for custom integrations:

GET/api/devices

List all registered devices

POST/api/devices

Register a new device

GET/api/assignments

Get camera assignments

PUT/api/assignments/:id

Update camera assignment

WebSocket API

Real-time tally updates via WebSocket:

// Connect to WebSocket
const ws = new WebSocket('ws://localhost:3000/api/tally');

// Listen for tally updates
ws.onmessage = (event) => {
  const data = JSON.parse(event.data);
  console.log('Tally update:', data);
};

Device Discovery Protocol

Devices can discover the hub using UDP broadcast or mDNS:

  • โ€ข UDP Port: 7411
  • โ€ข mDNS Service: _tallyhub._udp.local
  • โ€ข TXT Records: api=3000, udp=7411, ver=1.2.0

Environment Variables

NODE_ENVdevelopment | production

Set environment mode

LOG_LEVELerror | warn | info | debug

Set logging verbosity

PORTnumber

HTTP server port (default: 3000)

GITHUB_TOKENstring

GitHub personal access token for firmware downloads

DISABLE_MDNS1 | 0

Disable mDNS service advertising

Firmware Development

TallyHub firmware is written in C++ for ESP32 devices using Arduino framework.

Firmware Directory

firmware/
โ”œโ”€โ”€ esp32-1732s019/      # 1.9" display tally
โ”œโ”€โ”€ m5stick-c-plus/      # M5Stick C Plus 1.1
โ””โ”€โ”€ m5stick-c-plus2/     # M5Stick C Plus2

Building Firmware

Use PlatformIO or Arduino IDE to build firmware:

# Using PlatformIO
cd firmware/esp32-1732s019
pio run

# Build and upload
pio run --target upload

๐ŸŽจ Recent Firmware Improvements

  • โ€ข Unified battery smoothing & percent logic
  • โ€ข Always-on Wi-Fi outline and disconnect indicator
  • โ€ข Removed legacy calibration for leaner build
  • โ€ข Overlap-safe layout for battery and Wi-Fi icons

Testing

๐Ÿงช Test Suite (Coming Soon)

A comprehensive test suite is planned. Current testing workflow:

  • โ€ข Manual testing with real devices
  • โ€ข TypeScript type checking (npm run typecheck)
  • โ€ข Linting (npm run lint)
  • โ€ข Code formatting (npm run format)

Production Build

To build and run TallyHub in production:

# Build the project
npm run build

# Run production server
NODE_ENV=production LOG_LEVEL=info node dist/index.js

# Or use the CLI
NODE_ENV=production npx tallyhub

๐Ÿ“ Production Recommendations

  • โ€ข Set NODE_ENV=production
  • โ€ข Keep LOG_LEVEL=info unless debugging
  • โ€ข Rotate or prune logs regularly (npm run logs:prune)
  • โ€ข Use a process manager like PM2 or systemd
  • โ€ข Set up reverse proxy (nginx) for HTTPS

Release & Versioning

TallyHub follows semantic versioning (semver):

  • โ€ข Major (X.0.0) - Breaking changes
  • โ€ข Minor (0.X.0) - New features, backward compatible
  • โ€ข Patch (0.0.X) - Bug fixes

Current version: 1.2.0

Community & Support

License

TallyHub is open source software licensed under the MIT License.

You are free to use, modify, and distribute TallyHub for any purpose, including commercial use. See the LICENSE file for details.