projects
bluesky-moon-tracker
bluesky-moon-tracker is a Rust bot that posts daily moon phase updates to Bluesky at 00:00 UTC. Messages are tailored to the lunar phase and current month, with a lycanthropic flavour, British references, and occasional Pride references in June.
Built with atrium-rs for AT Protocol, compiled to a ~3 MB static binary with rustls-tls (no OpenSSL).
Moon Phase Data
The bot fetches moon phase data from multiple sources with automatic fallback:
- Skytime — free, no auth, 60 req/min
- Farmsense — free, no auth
- Local calculation — pure-math Meeus synodic period algorithm, no network dependency
If all APIs are down, the local calculation ensures the bot can still post. Accuracy is ±1 day for phase boundaries, ±5% for illumination — good enough for a daily bot.
Ollama LLM Generation
Set OLLAMA_MODEL to generate unique posts via a local Ollama LLM instead of the built-in template system.
The LLM is prompted with the moon phase, illumination, month, and the bot's personality (lycanthropic, British, pagan). If Ollama fails or times out, the bot falls back to templates.
Setup
git clone git@github.com:ewanc26/bluesky-moon-tracker
cd bluesky-moon-tracker
cargo build --release
Create .env (or copy .env.example):
BLUESKY_USERNAME="your_username"
BLUESKY_PASSWORD="your_password"
BLUESKY_PDS_URL="https://bsky.social"
DEBUG_MODE="false"
# Optional: Ollama LLM post generation
OLLAMA_MODEL="llama3.2"
OLLAMA_URL="http://localhost:11434"
OLLAMA_TIMEOUT="30000"
Run:
cargo run --release
If the current time is past 00:00 UTC, the bot posts immediately and then schedules the next post for the following day.
Setting DEBUG_MODE=true with credentials causes an immediate test post; without credentials it logs all possible message combinations to the console instead.
Structure
src/main.rs— Entry point, env loading, debug/production modesrc/config.rs— Environment variable parsingsrc/bluesky.rs— Authentication and posting via atrium-apisrc/scheduler.rs— UTC midnight sleep loop with graceful shutdownsrc/moon/constants.rs— Phase enum, emojis, hashtags, phrase bankssrc/moon/calc.rs— Local moon phase calculation (Meeus algorithm)src/moon/api.rs— Multi-source moon phase fetching (Skytime → Farmsense → Local)src/moon/messages.rs— Message generation (Ollama → template fallback)
Licence
MIT.
← all docs