RackTracker Shared Code

This directory contains shared code that is used by both the frontend and backend of the RackTracker pool match scoring system.

Structure

  • types.ts - TypeScript interfaces and types used throughout the application
  • utils.ts - Utility functions for common operations

Types

The types.ts file defines the core data structures used in the application:

  • Player - Player information
  • Match - Match details and scoring
  • Rack - Individual rack results
  • RackEvent - Special events during racks (BR, RO, fouls, etc.)
  • Tournament - Tournament information
  • PlayerStats - Player statistics

Utilities

The utils.ts file provides helper functions:

  • formatDate - Format Unix timestamps into readable dates
  • calculatePlayerStats - Calculate derived statistics from raw data
  • generateMatchSummary - Create a formatted match summary text
  • formatPlayerName - Format player names in various styles

Usage

These shared files ensure consistency between frontend and backend code. They should be imported directly:

import { Match, Player } from '../shared/types'; import { formatDate, calculatePlayerStats } from '../shared/utils';