# Bulletin Tools - Rust Implementation This is a Rust rewrite of the Python church bulletin generation system. The system consists of two main binaries that work with a REST API to create and generate church bulletins. ## Project Structure - **`bulletin-shared/`** - Shared library containing common functionality - Configuration management - REST API client implementation - Data models (Bulletin, Event, Personnel) - **`bulletin-input/`** - Binary for creating bulletin data entries - Reads CSV schedules and conference charts - Prompts for sermon details - Creates bulletin records via REST API - **`bulletin-generator/`** - Binary for generating PDF bulletins - Fetches bulletin data from REST API - Renders HTML templates - Generates PDF using headless Chrome - Uploads PDF back via REST API ## Data Files The `data/` directory contains: - `Quarterly schedule2021 - 2025.csv` - Personnel assignments - `2025 Offering and Sunset Times Chart.txt` - Conference offering schedule and sunset times - `KJV.json` - King James Version Bible text for scripture lookups ## Configuration The shared configuration is in `shared/config.toml`: ```toml church_name = "Your Church Name" # Optional contact information for templates # contact_phone = "555-123-4567" # contact_website = "yourchurchwebsite.org" # contact_youtube = "youtube.com/yourchurchchannel" # contact_address = "123 Church St, Your City, ST 12345" ``` The system uses the REST API at `https://api.rockvilletollandsda.church` and requires an auth token via the `BULLETIN_API_TOKEN` environment variable or `--auth-token` parameter. ## Usage ### Building ```bash cargo build --release ``` ### Bulletin Input ```bash # Use upcoming Saturday (default) cargo run --bin bulletin-input # Specify a date cargo run --bin bulletin-input -- --date 2025-06-21 # Use different location for sunset times cargo run --bin bulletin-input -- --location "springfield" ``` ### Bulletin Generation ```bash # Generate for upcoming Saturday cargo run --bin bulletin-generator # Specify a date cargo run --bin bulletin-generator -- --date 2025-06-21 # Don't upload to PocketBase (local only) cargo run --bin bulletin-generator -- --no-upload # Custom output directory cargo run --bin bulletin-generator -- --output-dir custom_output ``` ## Templates The bulletin templates are located in `bulletin-generator/templates/`: - `bulletin_template.html` - Jinja2-style template for the bulletin layout - `style.css` - CSS styling for the PDF output ## Dependencies Key Rust dependencies: - **tokio** - Async runtime - **reqwest** - HTTP client for PocketBase API - **serde** - Serialization/deserialization - **chrono** - Date/time handling - **tera** - Template engine - **headless_chrome** - PDF generation - **csv** - CSV parsing - **regex** - Text parsing ## Migration from Python This Rust implementation maintains full compatibility with the original Python system: - Uses the new REST API backend - Processes the same data files - Generates identical bulletin layouts - Follows the same workflow The main benefits of the Rust version: - Faster execution - Single binary deployment - Better error handling - Type safety - Reduced runtime dependencies