Clojure and Doom Emacs on a brand new M1 computer

I've recently landed my first Clojure position and received an m1-powered MacBook. Two months before that, I had also bought myself an m1 MacBook air and had to set up Clojure to use it in my projects. Since I had no experience using macOS whatsoever I had to do some googling and managed to get a pretty simple setup running.

There are lots of tutorials out there on how to set up m1 laptops for Clojure usage, but there are a few quirks that aren't yet documented, such as how to get clj-kondo and parinfer to work in it. I'll try to cover these steps in this post, while also showing how to set up doom emacs and some other stuff I ended up using myself.

Continue reading →

Pre-signed uploads to AWS S3 using Clojure(script)

I've recently stumbled upon a task: uploading images from an input and saving those. This can be done in several ways, such as storing files directly to your server's storage, saving these files inside a database, or uploading them to some cloud provider's service, such as AWS's S3. There are various reasons one may choose each of these strategies, but I decided to stick with the latter.

From my previous JavaScript/React experience I knew this could be done using S3's pre-signed URLs, but didn't know how to do this in Clojure, even though the overall process/technique isn't much different.

How a pre-signed upload works using S3:

  • your client-side application sends your server some metadata about the file.
  • the server validates the metadata (this is kind of optional though).
  • the server then responds with a unique URL that can be used to perform a request to S3 to upload this file.
  • the client uploads the image/file to S3 and sends the server the URL so it can be stored in some kind of database.

Continue reading →

My Clojure(script) journey

I've been learning Functional Programming for quite some time: I studied a bit of Haskell, played around with ReasonML, and ultimately started to work with Elixir. At some point, though, I realized I wanted to try a different language: this is when Clojure comes in - it simply looked really different from the code I was used to writing, which made me decide on trying to learn it.

Clojure is a really nice language and the whole "REPL oriented development" thing is magic, but it took me some time to actually enjoy the language and learn what the REPL meant for the whole development experience. I'll use this post to talk a little about my Clojure(script) journey and how I eventually started loving it.

Continue reading →