Skip to content

ispyisail/Hello-Club-Event-Attendance-Auto-Print

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

68 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Hello Club Event Attendance Auto-Print

Automated Windows service for printing Hello Club event attendance lists with system tray monitoring

License: MIT Node.js Tests

πŸ“‹ Table of Contents

🎯 Overview

Hello Club Event Attendance Auto-Print is a professional Windows application that automatically fetches, monitors, and prints attendee lists for upcoming Hello Club events. It runs as a Windows Service in the background and provides a system tray interface for easy monitoring and control.

How It Works

The application uses a smart two-stage process:

  1. Event Discovery - Periodically scans the Hello Club API for upcoming events
  2. Just-in-Time Processing - Fetches the latest attendee list moments before an event starts
  3. Automatic Printing - Generates a professional PDF and prints it (locally or via email)

System Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    System Tray App                      β”‚
β”‚              (Electron-based Monitor)                   β”‚
β”‚  β€’ Visual status indicator (green/yellow/red)           β”‚
β”‚  β€’ Service control (start/stop/restart)                 β”‚
β”‚  β€’ Log viewer & notifications                           β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                     β”‚
                     β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                  Windows Service                        β”‚
β”‚            (Always-Running Background)                  β”‚
β”‚  β€’ Fetches events every N hours                         β”‚
β”‚  β€’ Schedules processing for each event                  β”‚
β”‚  β€’ Auto-restarts on failure                             β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                     β”‚
        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
        β–Ό            β–Ό            β–Ό
   [Hello Club]  [SQLite DB]  [Printer]
      API        (Event Queue)  (Local/Email)

✨ Features

Core Features

  • βœ… Automated Event Fetching - Scans for upcoming events within configurable time windows
  • βœ… Smart Scheduling - Processes events at optimal times to capture last-minute sign-ups
  • βœ… Professional PDFs - Generates clean, printable attendee lists with custom layouts
  • βœ… Flexible Printing - Print locally or send via email to network printers
  • βœ… Category Filtering - Only process events from specified categories

Windows Service Features

  • βœ… Always Running - Starts automatically with Windows
  • βœ… Self-Healing - Automatically restarts if it crashes
  • βœ… Background Operation - Runs without user interaction
  • βœ… Production Ready - Built with node-windows for reliability

System Tray Features

  • 🟒 Visual Status - Color-coded icon (Green=Running, Red=Stopped, Yellow=Warning)
  • πŸ“Š Real-time Monitoring - Shows service status and recent activity
  • πŸ“ Log Viewer - Browse activity and error logs in a clean interface
  • πŸ”” Notifications - Desktop alerts when events are processed
  • πŸŽ›οΈ Service Control - Start, stop, and restart the service from the tray
  • βš™οΈ Settings GUI - Edit configuration and credentials without touching files
  • πŸ”Œ Connection Tests - Test API and Email connections with one click

Developer Features

  • βœ… Comprehensive Tests - 20+ unit tests with Jest
  • βœ… Type Safety - Joi schema validation for all configuration
  • βœ… Error Handling - Robust error handling with detailed logging
  • βœ… Modular Architecture - Clean separation of concerns
  • βœ… Well Documented - Extensive JSDoc comments

πŸš€ Quick Start

For End Users (Recommended)

Download and run the installer - The easiest way to get started:

  1. Download HelloClubEventAttendance-Setup-1.0.0.exe from the Releases page
  2. Run the installer (requires Administrator)
  3. Follow the friendly setup wizard:
    • Enter your Hello Club API key
    • Configure email printing (optional)
  4. The installer automatically:
    • Installs Node.js dependencies
    • Sets up the Windows service
    • Launches the tray monitor

That's it! The tray icon will appear in your taskbar. Right-click it to:

  • View logs and status
  • Edit settings
  • Test API and Email connections
  • Control the service

For Developers

If you want to run from source or contribute:

# 1. Clone the repository
git clone https://github.com/ispyisail/Hello-Club-Event-Attendance-Auto-Print.git
cd Hello-Club-Event-Attendance-Auto-Print

# 2. Install dependencies
npm install

# 3. Configure your API key
copy .env.example .env
# Edit .env and add your API_KEY

# 4. Install the Windows Service (requires admin)
npm run service:install

# 5. Start the tray monitor
npm run tray

πŸ“¦ Installation

Detailed Installation Steps

1. System Requirements

  • Operating System: Windows 10 or later
  • Node.js: Version 16.0.0 or higher
  • Build Tools: Required for native modules

2. Install Dependencies

npm install

This installs all required packages including:

  • node-windows - Windows service management
  • electron - System tray application
  • better-sqlite3 - Local database
  • pdfkit - PDF generation
  • winston - Logging
  • And more...

3. Configure the Application

Create .env file:

# Copy the example
copy .env.example .env

Edit .env and add your credentials:

# Required: Your Hello Club API key
API_KEY=your_api_key_here

# Optional: For email printing mode
PRINTER_EMAIL=[email protected]
SMTP_USER=[email protected]
SMTP_PASS=your_app_password
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587

Edit config.json:

{
  "categories": ["NBA - Junior Events", "Your Category"],
  "preEventQueryMinutes": 5,
  "fetchWindowHours": 24,
  "serviceRunIntervalHours": 1,
  "printMode": "local",
  "outputFilename": "attendees.pdf",
  "pdfLayout": {
    "fontSize": 10,
    "columns": [
      { "id": "name", "header": "Name", "width": 140 },
      { "id": "phone", "header": "Phone", "width": 100 },
      { "id": "signUpDate", "header": "Signed up", "width": 100 },
      { "id": "fee", "header": "Fee", "width": 60 },
      { "id": "status", "header": "Status", "width": 90 }
    ]
  }
}

4. Install as Windows Service

Important: This step requires Administrator privileges.

# Open PowerShell or Command Prompt as Administrator
npm run service:install

The service will be installed as "HelloClubEventAttendance" and set to start automatically with Windows.

5. Start the Tray Monitor

npm run tray

The tray icon will appear in your system tray (bottom-right corner of Windows taskbar).

Using the Installer (Recommended for End Users)

The installer provides a professional, guided setup experience with a modern wizard:

What You Get:

🎨 Modern Setup Wizard:

  • Friendly welcome screen with prerequisites checklist
  • Node.js detection and guidance
  • Step-by-step API configuration with helpful hints
  • Optional email printing setup with Gmail-specific tips
  • Smart validation (checks API key format)
  • Real-time progress with emoji indicators

βš™οΈ Automatic Setup:

  1. Installs all files to Program Files
  2. Runs npm install for you (3-5 minutes)
  3. Creates .env file from your input
  4. Installs and starts the Windows service
  5. Creates Start Menu and Desktop shortcuts
  6. Launches the tray monitor

πŸ“¦ What's Included:

  • Windows service (auto-starts on boot)
  • System tray monitor
  • All dependencies
  • Complete documentation
  • Automatic updates support

To Build Your Own Installer:

cd installer
build-installer.bat

The installer will be created in dist/HelloClubEventAttendance-Setup-1.0.0.exe (2MB)

βš™οΈ Configuration

Easy Configuration Options

For End Users: Use the Settings GUI in the tray app - no file editing needed!

For Developers: Edit configuration files manually or use the Settings GUI.

Configuration Files

The application uses two configuration files:

  1. .env - Secrets and credentials (never commit this! Already in .gitignore)
  2. config.json - Application settings (safe to commit - no secrets)

Note: When using the installer, it creates your .env file during setup. The Settings GUI allows you to edit both files safely with automatic backups.

Environment Variables (.env)

Variable Required Description Default
API_KEY βœ… Yes Hello Club API authentication key -
PRINTER_EMAIL For email mode Email address of network printer -
SMTP_USER For email mode SMTP username (e.g., Gmail address) -
SMTP_PASS For email mode SMTP password or app-specific password -
SMTP_HOST For email mode SMTP server hostname smtp.gmail.com
SMTP_PORT For email mode SMTP server port 587
EMAIL_FROM For email mode Sender email address Same as SMTP_USER

Application Settings (config.json)

See CONFIGURATION.md for detailed configuration documentation.

πŸ“– Usage

System Tray Interface

The system tray icon provides quick access to all functionality:

Icon Colors:

  • 🟒 Green - Service running normally
  • πŸ”΄ Red - Service stopped or error
  • 🟑 Yellow - Service starting or warning

Right-click Menu:

  • View Logs - Open log viewer window with real-time updates
  • Settings βš™οΈ NEW! - Edit configuration via GUI
    • Environment variables (API key, SMTP credentials)
    • Application settings (categories, timing, PDF layout)
    • Automatic validation and backup
  • Test API Connection πŸ”Œ NEW! - Verify Hello Club API connectivity
  • Test Email Connection πŸ”Œ NEW! - Verify SMTP settings
  • Check Status Now - Force status refresh
  • Start/Stop/Restart Service - Control the service
  • Open Services Manager - Windows services.msc
  • Open Project Folder - Browse application files
  • Quit - Exit tray application (service continues running)

New Features Guide

βš™οΈ Settings GUI: After installation, you can edit all configuration without touching files:

  1. Right-click tray icon β†’ Settings
  2. Environment Variables Tab:
    • Edit API key and SMTP credentials
    • Password fields with show/hide toggle
    • Real-time validation
  3. Configuration Tab:
    • Manage event categories (add/remove)
    • Adjust timing settings
    • Change print mode (local/email)
    • Edit PDF layout
  4. Click Save - automatic backups created
  5. Restart service to apply changes

πŸ”Œ Connection Tests: Verify your configuration before processing events:

  • Test API Connection:

    • Click to test Hello Club API
    • Shows response time and success/failure
    • Validates API key format
    • Provides troubleshooting hints
  • Test Email Connection:

    • Click to verify SMTP settings
    • Tests connection without sending email
    • Detects common Gmail/authentication issues
    • Confirms printer email is configured

Command Line Interface

You can also run the application from the command line:

# Fetch events once
node src/index.js fetch-events

# Process pending events once
node src/index.js process-schedule

# Run as continuous service (in console)
node src/index.js start-service

# View help
node src/index.js --help

Service Management

# Install the service
npm run service:install

# Check service status
npm run service:status

# Uninstall the service
npm run service:uninstall

# Windows services.msc
services.msc

Log Files

Logs are written to the project root:

  • activity.log - Normal operations, events processed
  • error.log - Errors and warnings only

View logs via:

  • System tray β†’ "View Logs"
  • Open files directly in any text editor
  • Command: npm run logs (if you add this script)

πŸ“š Documentation

Document Description
ARCHITECTURE.md System design and architecture
API.md Module and function reference
CONFIGURATION.md Detailed configuration guide
DEVELOPMENT.md Developer setup and contribution guide
WINDOWS-SERVICE-SETUP.md Windows service installation guide
TRAY-APP-GUIDE.md System tray application guide
INSTALLER-USER-GUIDE.md Installer creation guide
TESTING-GUIDE.md Testing documentation
TROUBLESHOOTING.md Common issues and solutions

πŸ“ Project Structure

hello-club-event-attendance/
β”œβ”€β”€ src/                          # Application source code
β”‚   β”œβ”€β”€ core/                     # Core business logic
β”‚   β”‚   β”œβ”€β”€ api-client.js         # Hello Club API integration
β”‚   β”‚   β”œβ”€β”€ database.js           # SQLite database management
β”‚   β”‚   β”œβ”€β”€ functions.js          # Event processing logic
β”‚   β”‚   └── service.js            # Service scheduler
β”‚   β”œβ”€β”€ services/                 # Supporting services
β”‚   β”‚   β”œβ”€β”€ email-service.js      # SMTP email sending
β”‚   β”‚   β”œβ”€β”€ logger.js             # Winston logging configuration
β”‚   β”‚   └── pdf-generator.js      # PDF creation
β”‚   β”œβ”€β”€ utils/                    # Utilities and helpers
β”‚   β”‚   β”œβ”€β”€ args-parser.js        # CLI argument parsing
β”‚   β”‚   └── config-schema.js      # Configuration validation
β”‚   └── index.js                  # Application entry point
β”‚
β”œβ”€β”€ service/                      # Windows Service management
β”‚   β”œβ”€β”€ install.js                # Service installation script
β”‚   β”œβ”€β”€ uninstall.js              # Service removal script
β”‚   └── status.js                 # Service status checker
β”‚
β”œβ”€β”€ tray-app/                     # Electron system tray app
β”‚   β”œβ”€β”€ main.js                   # Electron main process
β”‚   β”œβ”€β”€ log-viewer.html           # Log viewer UI
β”‚   β”œβ”€β”€ icons/                    # Tray icons
β”‚   └── start-tray.bat            # Tray launcher script
β”‚
β”œβ”€β”€ installer/                    # Inno Setup installer
β”‚   β”œβ”€β”€ setup.iss                 # Inno Setup script
β”‚   β”œβ”€β”€ build-installer.bat       # Build automation
β”‚   └── *.bat                     # Helper scripts
β”‚
β”œβ”€β”€ tests/                        # Unit tests
β”‚   β”œβ”€β”€ functions.test.js         # Core logic tests
β”‚   └── pdf-generator.test.js     # PDF generation tests
β”‚
β”œβ”€β”€ migrations/                   # Database migrations
β”‚   └── 001-initial-schema.sql    # Initial database schema
β”‚
β”œβ”€β”€ docs/                         # Documentation
β”‚   β”œβ”€β”€ ARCHITECTURE.md
β”‚   β”œβ”€β”€ API.md
β”‚   β”œβ”€β”€ CONFIGURATION.md
β”‚   └── ...
β”‚
β”œβ”€β”€ bin/                          # Generated binaries (gitignored)
β”‚   └── daemon/                   # Windows service daemon files
β”‚
β”œβ”€β”€ .env                          # Environment variables (gitignored)
β”œβ”€β”€ .env.example                  # Environment template
β”œβ”€β”€ config.json                   # Application configuration
β”œβ”€β”€ package.json                  # Node.js project manifest
└── README.md                     # This file

πŸ§ͺ Testing

Run Tests

# Run all tests
npm test

# Run with coverage report
npm run coverage

# Run specific test file
npx jest tests/functions.test.js

# Run in watch mode (for development)
npx jest --watch

Test Coverage

Current test coverage:

  • 20 unit tests passing
  • Core business logic fully tested
  • PDF generation tested with mocks
  • API client error handling tested

πŸ› Troubleshooting

Common Issues

Service won't start

  • Ensure you installed as Administrator
  • Check error.log for details
  • Verify API_KEY in .env is correct

No events being processed

  • Check category filters in config.json
  • Verify events exist in the time window
  • Run node src/index.js fetch-events manually

Tray icon not showing

  • Check Windows notification area settings
  • Restart the tray app: npm run tray
  • Look for errors in console

PDF not printing

  • Local mode: Install SumatraPDF on Windows
  • Email mode: Verify SMTP credentials in .env
  • Check error.log for printing errors

401 Unauthorized errors

  • Your API_KEY is invalid or expired
  • Get a new key from Hello Club
  • Update .env and restart service

See TROUBLESHOOTING.md for more solutions.

🀝 Contributing

Contributions are welcome! Please see DEVELOPMENT.md for:

  • Development setup
  • Code style guidelines
  • Testing requirements
  • Pull request process

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

πŸ“ž Support

  • Issues: GitHub Issues
  • Documentation: See the docs/ folder
  • Email: Check the package.json for contact information

Made with ❀️ for Hello Club users

About

No description, website, or topics provided.

Resources

License

Security policy

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •