Coding
PromptBeginner5 minmarkdown
Nano Banana Pro
Agent skill for nano-banana-pro
6
Oxeye is a Discord bot + Minecraft Mod + backend service that tracks who's online on Minecraft servers and displays that information in Discord. It consists of:
Sign in to like and favorite skills
Oxeye is a Discord bot + Minecraft Mod + backend service that tracks who's online on Minecraft servers and displays that information in Discord. It consists of:
# Build the project cargo build --release # Run tests cargo test # Run with Discord token DISCORD_TOKEN=<token> cargo run # Check without building cargo check
oxeye/ ├── oxeye-backend/ # Main Rust HTTP server + Discord bot │ ├── src/ │ │ ├── main.rs # Entry point, runtime setup │ │ ├── lib.rs # Router creation, middleware setup │ │ ├── config.rs # Environment configuration │ │ ├── routes.rs # HTTP endpoint handlers │ │ ├── error.rs # Error types and HTTP mapping │ │ ├── helpers.rs # Utility functions │ │ ├── validation.rs # Input validation │ │ └── discord_commands.rs # Discord slash commands │ └── tests/ # Integration tests ├── oxeye-db/ # Database abstraction crate │ └── src/ │ ├── lib.rs # Database operations (~60 methods) │ ├── models.rs # Data types │ └── error.rs # Database errors ├── oxeye-mod/ # Minecraft Fabric Mod (Java/Gradle) ├── docs/ # Architecture documentation ├── Cargo.toml # Workspace root └── DESIGN.md # API specification
| Component | Technology | Notes |
|---|---|---|
| Web Framework | Axum 0.8 | HTTP server with middleware |
| Async Runtime | Tokio | Full features enabled |
| Discord Bot | Poise 0.6 | Command framework on Serenity |
| Database | tokio-rusqlite | Async SQLite with WAL mode |
| Serialization | Serde + serde_json | JSON encoding/decoding |
| Error Handling | thiserror | Ergonomic error types |
| Logging | tracing | Structured logging |
| Rate Limiting | tower-governor | IP-based rate limiting |
Rust Edition: 2024
HTTP Request → Validation (validation.rs) → Routes (routes.rs) → Database (oxeye-db) Discord Command → discord_commands.rs → Database (oxeye-db)
AppError enum in error.rsoxeye-sk-{32 alphanumeric}oxeye-{6 alphanumeric} (10-minute TTL)| Method | Path | Auth | Purpose |
|---|---|---|---|
| POST | /connect | None | Redeem connection code |
| POST | /join | Bearer | Report player joining |
| POST | /leave | Bearer | Report player leaving |
| POST | /sync | Bearer | Replace entire player list |
| GET | /status | Bearer | Check server connection |
| POST | /disconnect | Bearer | Unlink server |
/oxeye connect <name> - Admin-only, generates linking code/oxeye list - Shows all servers in guild/oxeye status <name> - Shows online players with join timesThree main tables:
pending_links - Connection codes with TTLservers - Linked Minecraft servers (api_key_hash, name, guild_id)online_players - Players currently online with join timestamps# Run all tests cargo test # Run specific test cargo test test_name # Run with output cargo test -- --nocapture
Tests use in-memory SQLite for speed. Coverage includes:
| Variable | Default | Required | Description |
|---|---|---|---|
| DISCORD_TOKEN | - | Yes | Discord bot token |
| PORT | 3000 | No | HTTP server port |
| DATABASE_PATH | oxeye.db | No | SQLite database file |
| REQUEST_BODY_LIMIT | 1048576 | No | Max request size (bytes) |
| REQUEST_TIMEOUT_SECS | 30 | No | Request timeout |
Rate limit variables also available (see
config.rs).
#[debug_handler] on Axum handlers for better error messageshelpers.rs for common operationslib.rs under appropriate rate-limit tierroutes.rsvalidation.rsoxeye-db/src/lib.rstests/integration_tests.rsdiscord_commands.rsmain.rsctx.data().dboxeye-db/src/lib.rsmodels.rs#[cfg(test)] moduleoxeye-backend/src/lib.rs:1-119 - Router setup, middleware, rate limiting tiersoxeye-backend/src/routes.rs:1-143 - All HTTP handlersoxeye-db/src/lib.rs:1-400 - Database schema and core operationsDESIGN.md - Complete API specificationdocs/architecture-decisions.md - Performance decisions and caching strategyMulti-architecture builds available:
Dockerfile.amd64 - x86-64Dockerfile.arm64 - ARM64 (Raspberry Pi, Apple Silicon)Final images are minimal scratch-based containers.