The Crystal Programming Language Forum

Live coding a URL status checker in Crystal

Hi all :wave: I’d like to share a bunch of live coding sessions I’ve streamed on Twitch.

The idea is to explore Crystal’s concurrency, with emphasis on Channels, Fibers and the CSP model, by means of building a simple terminal-based app.

Here is the table of content so far.

Session 1

  1. Initialising a Crystal app
  2. Making HTTP calls
  3. Reading from config files
  4. Concurrently checking URLs with Channels and Fibers

Session 2

  1. Classes and aliases
  2. Extracting tasks into modules
  3. Scheduling periodic tasks

Session 3

  1. Type-safe config handling
  2. Sensible monkey patching
  3. Logging across Fibers
  4. Signals, timers and select statement

Session 4

  1. Fibers owning Channels
  2. Terminating groups of Fibers
  3. Propagating Channel closure throughout a pipeline
  4. Waiting for a pipeline to be done

I recommend watching the videos at 1.5x the regular speed for better enjoyment :robot:
I’ll add new ones as they come, in the comment section.

I would love to hear your suggestion on related topic I could include! I’m currently running a poll to pick this Sunday’s subject:


Thank you so much for doing this! Especially Fibers related stuff.

1 Like

Session 5 is out!

We talk about two-way communication between Fibers, taking inspiration from Elixir’s GenServer and Akka’s Actor. Hope you enjoy this!


Session 6 is out :tada:

We talk about

  1. Partitioning and merging channels
  2. Processing data on a sliding window. In particular, we define a processor to compute the moving average on a set of response times.

Make sure you don’t watch all the videos in parallel :grin:


Session 7 was all about testing concurrent code.

  1. Writing robust tests for our channel partitioning method :weight_lifting_woman:
  2. Refactoring to decouple concurrency and business logic :merman:
  3. Testing non-deterministic output :woman_shrugging:
  4. Writing time-dependent tests :timer_clock:

I feel like much more can be said on the topic, It would be great if you could share your testing strategies for concurrent code.


I have worked through the first two sessions today and I must say: I love these videos.

Having a knowledgable and measured host is lovely, having that host be exceedingly likable and considerate is divine.

I’ve been trudging through the Programming Crystal book these past few days, though stumbling upon these videos has accelerated the progress of my learning in a most appealing manner.

Thank you for them :)


Thanks for your kind words. It means a lot to know that someone is finding the series useful :blue_heart:

I’ll be doing some more live coding on Twitch today at 8pm UTC.
You can preview the slides here :clipboard:

We’ll spend some more time on graceful termination of concurrent apps, implement a simple alerting system and polish the terminal UI :sparkles:



The season finale is out! We talk about

  1. Bringing rogue fibers to order with a more robust termination strategy
  2. Adding an alerting stage to our pipeline :rotating_light:
  3. Polishing the terminal UI with ncurses
1 Like