Inject global data in Next.js during build time

Introduction

At work we started to use Next.js for a new project. So far the experience has been nothing but positive, however recently we hit one of the limitations of the framework. We wanted to inject data, fetched from an API, in all the pages during build time. Specifically we wanted to fetch Feature Flags from our dedicated service into Next.js, in order to conditionally render new features.

You would think that this requirement would be easily covered by Next.js, but unfortunately …

Read More
Generate a temporary presigned upload URL using Laravel Storage class

Introduction

By default, all objects in an S3 bucket are private, meaning only the bucket account owner initially has access to the objects. However, the object owner can optionally share objects with others by creating a presigned URL, using their own security credentials, to grant time-limited permission to download the objects. This is particularly useful because it means that you don’t have to provide bucket access to other users and restrict their access with IAM policies.

Laravel …

Read More
Deploy a scheduled workload on Fargate using AWS CDK

Introduction

What is CDK

If you already know what CDK is, feel free to skip this section.

The AWS Cloud Development Kit (CDK in short) is a relatively new framework for defining cloud Infrastructure as Code (IaC).

CDK offers a high-level object-oriented abstraction to define AWS resources imperatively using the power of modern programming languages. CDK addresses the same type of problems that tools like Terraform or CloudFormation aim to solve. What’s different with CDK is that you …

Read More
Elixir deployments optimized for free hosting

Introduction

Recently I stumbled upon this excellent article by Damon Janis about how to deploy a Phoenix web app to a single Linux server, optimizing for cost effectiveness, control, and simplicity.

If you haven’t already, then you should read it immediately. It contains a ton of useful information, not only Elixir-related.

In this post I want to integrate the previous article with the approach that I used during the deployment of one of my latest Elixir side-projects. Keep in mind …

Read More
How to use Fastify on Google Cloud Functions

Introduction

This post started as a simple guide on how to configure the Fastify web framework to run inside a Google Cloud Function, but its focus quickly switched to a deeper analysis on the authentication to Google Cloud Functions (GCF from now on).

GCF is the FaaS (Function as a Service) platform provided by Google. It’s a serverless execution environment for building and connecting cloud services. With Cloud Functions you write simple, single-purpose functions that are attached to …

Read More
Use context in ExUnit tests

Introduction

I’m on my journey to learn the Elixir programming language and I’m really enjoying the process so far.

Elixir is a dynamic, functional language designed for building scalable and maintainable applications.

Switching from a Object-Oriented approach to a functional approach makes me appreciate the benefits of immutable data and function composability.

I decided to document my progress in my blog, specifically I would like to write about any non-trivial issue that I …

Read More