A browser extension that condenses Advent of Code puzzle descriptions using AI while preserving technical details and examples.
- Automatically detects AOC puzzle pages
- Simplifies verbose narratives into clear problem statements
- Caches results locally
- Toggle between original and simplified versions
- Axum - Web framework
- Rig - LLM client (via OpenRouter)
- Utoipa - OpenAPI docs generation
- Uses Gemini Flash 3 for simplification
- WXT - Modern browser extension framework
- Svelte 5 - UI with latest runes API
- Bun - Fast package manager and runtime
- Marked - Markdown to HTML conversion
- Tailwind - Styling
aoc-simplifier/
├── backend/ # Rust API server
│ ├── src/
│ │ ├── handlers.rs # API endpoints
│ │ ├── prompt.txt # LLM system prompt
│ │ └── ...
│ └── Cargo.toml
│
└── extension/ # Browser extension
├── src/
│ ├── entrypoints/
│ │ ├── background.ts # API calls & storage
│ │ ├── content.ts # Page interaction
│ │ └── popup/ # Extension popup UI
│ └── types/
└── package.json
-
Install Rust (if you haven't already):
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
-
Set up environment variables in
backend/.env:OPENROUTER_API_KEY=your_key_here BEARER_TOKEN=your_auth_token_for_extension
-
Run the server:
cd backend cargo runThe API will be available at
http://localhost:3000 -
Generate OpenAPI types (optional):
cargo run --bin export-openapi
-
Install Bun (if needed):
curl -fsSL https://bun.sh/install | bash -
Install dependencies:
cd extension bun install -
Set up environment variables in
extension/.env:VITE_BACKEND_API_URL=http://localhost:3000 VITE_BEARER_TOKEN=same_token_from_backend
-
Run in development mode:
bun run dev # Chrome/Edge bun run dev:firefox # Firefox
-
Load the extension:
- Chrome: Go to
chrome://extensions, enable Developer Mode, click "Load unpacked", select.output/chrome-mv3 - Firefox: Go to
about:debugging#/runtime/this-firefox, click "Load Temporary Add-on", select any file in.output/firefox-mv3
- Chrome: Go to
- Navigate to an Advent of Code puzzle
- Click the extension icon
- Click "Simplify Question"
- Toggle between original and simplified versions as needed
Results are cached locally for instant access on subsequent visits.
bun run dev # Start dev server (Chrome)
bun run dev:firefox # Start dev server (Firefox)
bun run build # Build for production
bun run check # Type check with Svelte
bun run typegen # Regenerate API types from OpenAPI speccargo run # Run server
cargo run --bin export-openapi # Generate OpenAPI spec
cargo build --release # Production buildThe extension uses auto-generated TypeScript types from the backend's OpenAPI spec. After changing API endpoints:
- Export new spec:
cd backend && cargo run --bin export-openapi - Regenerate types:
cd extension && bun run typegen
- Content script extracts puzzle HTML from the page
- Background script checks local cache
- If not cached, sends content to backend API
- Backend uses Gemini Flash 3 with a structured prompt to simplify
- Response is cached locally and rendered from Markdown
- Original HTML is preserved for toggling
The bearer token is embedded in the extension for API authentication. This is fine for personal use, but don't publish this extension publicly without implementing proper auth (e.g., user-provided API keys or OAuth).
Note: This was written mostly without AI as a learning project. AI was used minimally to do things like write the README or write the chrome extension CSS.