$ show oprypin/nightly.link
nightly.link is a web application that provides shareable links to download the latest build artifacts from GitHub Actions workflows. It acts as a proxy that uses a GitHub App to obtain installation tokens for accessing repository artifacts, bypassing the requirement for users to be logged into GitHub. The application is built with Crystal and features a modular architecture with separate components for routing, GitHub API interaction, caching, and utilities. Key routes handle URL parsing, workflow run lookup, artifact retrieval, and redirect to temporary download URLs. The system caches installation tokens and API responses to minimize GitHub API calls and uses a SQLite database to persist installation data for user-authorized repositories.
The LLM identified 2 files worth highlighting for reuse:
Provides a reusable caching macro that generates cached and uncached versions of API data fetching methods, along with a self-cleaning cache mechanism. The macro encapsulates cache logic, automatic parameter normalization (like downcasing), and periodic cleanup via a cron job. This component is isolated (depends only on memory_cache and tasker shards) and demonstrates advanced metaprogramming skills for creating generic, reusable caching solutions.
Defines a DelimitedString structure for storing and manipulating lists of strings as a single delimited string (newline-separated). Includes safety checks to prevent newline characters in elements, ensuring data integrity when stored in databases. This utility is completely self-contained with zero dependencies, making it trivially extractable for any application needing to store comma/list data in a single database column or configuration setting.