go back

Placeholder for post cover image
Cover image for post

Building an app to search the APOD archive by color 🪐

February 18, 2023

tl;dr, I built apod-color-search!

The news of the James Webb Space Telescope (JWST) being successfully deployed in orbit reminded me how fascinating outer space is. Hubble has already showed us how spectacular and unfathomably large the visible universe is, and now with JWST it's like Earth just received a much better glasses prescription!

If you haven't been following, here's a compelling side-by-side comparison of the same nebula as seen by both telescopes posted to NASA's Instagram:

Long before these pictures started being shared via social media however, Astronomy Picture of the Day (APOD) established itself as one of the first websites for this purpose. Every day since July 16 1995, a new picture (or video) with some accompanying information has been posted and it has cemented itself as the OG source of space-related content.

The archive is a trove of absolutely stunning images with otherworldly color palettes. The sheer amount of them and their easy accessibility, combined with my personal desire for a new side-project led to the thought: why not make the APOD image database searchable by color? 🎨

The finished product 👨‍🚀

With more images from JWST continuing to be transmitted back to us, I've been wanting to build something to do just that. Feeling inspired, I set out to build apod-color-search!

Do give it a try and let me know what you think. I've been putting time into it on & off over the past couple months but finally feel ready to release it to the public.

Part of this was to maximize the various free tiers of cloud services that it utilizes - only given so many hours for GitHub Actions to run to process almost two decades of images! Happy to say that I didn't spend a single cent on any cloud infrastructure, though that came at the cost of some additional complexity which I'll go into detail about later.

Here's the source if you want to poke around in the meantime:

GitHub logo brycedorn / apod-color-search

Search for Astronomy Picture of the Day images by color 🎨

apod color search 🪐

Search for APOD photos by color! Consists of three parts:

web

A Svelte app to provide search interface. Uses vanilla-colorful for color picker.

api

Deno-based API that retrieves APOD information from database for images that match the given hex value. Uses Redis to store & retrieve query results.

src

Rust utility to analyze and process images. Used to populate database with historical data, now scheduled to run monthly to process new APODs.

  1. Fetches APOD metatada via apod-api.
  2. Analyzes image to get highest-frequency non-grayscale colors.
  3. Saves result to Postgres.

Runs via GitHub Actions UI to then trigger additional workflows. This was used to leverage GitHub Actions to batch process a large amount of images concurrently & remotely.





This will be the beginning of a series of posts about how I built it consisting of multiple parts, including:

Stay tuned! 🔭

go back