6

Building an app to search the APOD archive by color 🪐

 1 year ago
source link: https://blog.bryce.io/building-an-app-to-search-the-apod-archive-by-color
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Building an app to search the APOD archive by color 🪐

Cover image for Building an app to search the APOD archive by color 🪐

Building an app to search the APOD archive by color 🪐

Posted to dev.to on 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:

apod color search 🪐

Search for APOD photos by color! Consists of four functional parts:

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

Deno-based API that retrieves APOD information from database for images that match the given hex value.

cache

Node server acting as reverse cache proxy to maintain persistent Redis connection. Aside from connection limits, benchmarks seem to indicate this is more performant than connecting directly to Redis via Deno for each request.

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:

  • Building a request handler and image processor in Rust
  • Using GitHub Actions as a free cloud utility to batch process images
  • Building an API to retrieve and cache search results
  • Building a web application to display color-indexed images in a searchable interface

Stay tuned! 🔭

Built with Hono & Cloudflare Workers • View source on GitHub


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK