Latest Posts (8 found)
ptrchm 1 weeks ago

Event-driven Modular Monolith

The main Rails app I currently work on has just turned eight. It’s not a huge app. It doesn’t deal with web-scale traffic or large volumes of data. Only six people working on it now. But eight years of pushing new code adds up. This is a quick overview of some of the strategies we use to keep the codebase maintainable. After the first few years, our codebase suffered from typical ailments: tight coupling between domains, complex database queries spread across various parts of the app, overgrown models, a maze of side effects triggered by ActiveRecord callbacks , endlessly chained associations (e.g. ) – with an all-encompassing model sitting on top of the pile. Modular Monolith Pub/Sub (Events) Patterns Service Objects Repositories for Database Queries Slim and Dumb Models Bonus: A Separate Frontend App How Do I Start?

0 views
ptrchm 1 years ago

Base32 Encoding Explained

Base64 is one of those things I’ve used countless times, without ever fully understanding what it does. For my UUID shortener , I chose to implement Base32 — a more readable and URL-friendly alternative to Base64. I didn’t want to rely on any third-party libraries for the encoding part. This meant going back to basics and learning what actually happens when you encode data to a Base2ⁿ format. This post is my attempt to explain and visualize how Base32 encoding works at the bit level and how it relates to other Base2ⁿ formats, like Base64.

0 views
ptrchm 1 years ago

BasedUUID: URL-friendly, Base32-encoded UUIDs for Rails Models

Recently, I wrote about UUIDv7 and how to use it in Rails. The time-sorted UUIDv7 addresses some performance issues associated with UUIDv4-based primary keys, but the experience of using UUIDs is still far from perfect: The default string representation of a UUID is unnecessarily long (36 characters) and awkward to copy with a double click. Another annoyance is that if you’re looking at a UUID in isolation, it’s hard to tell which model it represents 1 .

0 views
ptrchm 1 years ago

How to Use UUIDv7 in Rails for Primary Keys

Using UUIDs for primary keys offers many benefits, but there are some downsides to consider. The most widely-used UUIDv4 is fully random, which is ideal for minimizing the risk of collision. However, random IDs as primary keys do not index and sort efficiently, leading to index bloat and performance issues. There is a new standard that addresses this problem by including a UNIX timestamp 1 in the initial bits: UUIDv7 2 . As of this writing, selecting in Rails defaults to using UUIDv4 for primary keys, with the generation deferred to Postgres.

0 views
ptrchm 2 years ago

Building an Image Processing Service in Go

The project described in this post no longer exists. However, some parts of it now live under a new project, available on GitHub . Many of the details below no longer apply, but I’ve decided to keep this post as a historical record. Over the course of the last few months, I’ve ported ImgKit, my image processing service, from Ruby to Go. This was my first project in Go and I wanted to document the technical choices I made and how the whole process went.

0 views
ptrchm 4 years ago

How I Nearly Lost the Lightroom Catalog With All of My Photos

With 50MB RAWs, hard drives fill up in no time. In the last five years I collected enough important photos to start thinking about a reliable storage solution that works well with Lightroom. I opted for Synology DS218 with two Seagate IronWolf drives.

0 views
ptrchm 4 years ago

Docker on macOS Without Performance Problems

The app I’m currently working on runs on Docker. It’s a medium-sized Rails monolith with a bunch of resource-heavy dependencies (Postgres, PostGIS, ElasticSearch, Redis, Next.js and a few more). Docker helps us make sure the whole stack works for everyone, every time. For those using Linux, it works without noticeable downsides. But on macOS, despite every possible performance tweak, Docker had been a huge pain. MacBook with Docker will always run hot, battery will drain in less than an hour, fan speed is high enough for the laptop to take off and I need an external SSD disk to fit all the images.

0 views
ptrchm 4 years ago

PixelPeeper 2.0: What's New?

Three years ago, I launched the first version of PixelPeeper and it was brutally minimalistic: I made a little website that takes a JPG image and shows you how it was edited in Lightroom (+ camera settings) https://t.co/EFG3UhMdTS pic.twitter.com/P8EaienbZ2 In the following years I added new features, fixed bugs, but the way it worked and looked hasn’t veered away from the initial release. The UI has gotten rusty, the code behind it didn’t allow for much further improvement, so it was time for a major overhaul.

0 views