Blog
- Improving HTML code blocks readability with a syntax highlighter
A code block written by hand is pretty simple: use the 'pre' and 'code' HTML elements and the browser gives you a monospace font and keeps your line breaks, but it stops there. So every keyword, string, comment and variable comes out in the exact same color, which is fine for a few lines of YAML, but for a few hundred lines of TypeScript painted in a single flat tone, maybe not. Improving readability for those cases doesn't require shipping a highlighting library to the reader's browser (unless you want to) and is quite simple to do.
- Ensuring type safe database queries and migrations with Node
Talking to a database with Node usually goes one of two ways: you write raw SQL and trust that the strings in your code still match the columns in the database, while dealing with SQL injections and migrations by yourself, or you pull in a full ORM and inherit an entire opinionated world just to run simple queries. Both work fine until someone renames a column and you find out about it in production, or you want to do something slightly different and your ORM just won't let you. Fortunately, there's a middle ground where you can get the best of both worlds.
- Creating customizable and reusable project templates with Node
At some point in your life you end up with a repo that is the starting point. It has the CI pipeline you like, your preferred linting and formatting configs and the Terraform layout that works like a charm. Then a new project shows up, you clone the base template and spend the next twenty minutes doing find-and-replace on the project name, ids, the domain name and whatever else is hardcoded in there. It works, until you miss a thing and find out your project is failing - but is it because of the template or because you missed something!? However, a small script and two npm packages solve this problem pretty well.
- Storing and managing secrets cheaply and safely
Every application has its secrets (database passwords, API keys, tokens, etc.) and they need to live somewhere that isn't a plaintext file committed to Git (please, don't). For those familiar with AWS, the first thought that comes to mind is to go with Secrets Manager to manage them, and it works great, except for the price per secret per month. Later down the road, it quietly turns into a line item nobody remembers approving once you multiply it across services, environments and regions. The good news is: for most secrets, there's a cheaper place to put them that's just as safe.
- Optimizing AWS S3 costs
It's easy to create an S3 bucket, let objects pile up and watch everything sit comfortably in the Standard class whether it's accessed a thousand times a day or has been its fourth abandonment anniversary. However, AWS gives you the tools to figure out where your money is actually going (they'll surely charge for it lol) and when used properly, they'll show you where to start cutting costs.
Powered by Simple Blog API