Photo by Zhen Hu on Unsplash

Hi everybody !

Today, I’m gonna summarize key aspects of implementing guards with Nest.js and Passport. They will be discussed in Express context because… huh well, I haven’t done any Fastify in a couple of years 😅

Please note that if you want to jump straight up to the code and related integration tests, you can have a look at the related sample repo directly :

Prelude

This article is an extension of one I previously wrote here, it assumes you already have a good understanding of Nest.js, Passport, Express and Typescript decorators. …


Photo by chuttersnap on Unsplash

Today here are some thoughts about having a postinstall hook with a dynamic build when adding a library in different contexts.

Use case

Imaging you’ve found a nice way to reuse your data validators across both server and client applications.

Ideally, you can reuse your data validators :

  • in the UI forms while user interacts
  • in the backend to validate data before storage

That way is easier to maintain if it comes from a single source of truth.

To achieve this part, it’s then required to be able to compile files conditionally to avoid missing or unnecessary files (which bring dependencies alongside).


Photo by Samuel Sianipar on Unsplash

Hello my fellow confined nerds lol
More seriously I wish you all to be safe and sound 😷

I made a few experiments for a couple of days and I wanted to lay down my thoughts on data manipulation with TypeScript decorators in Nest.js.

Concepts

Whether writing websites, softwares, apps or anything involving sending data back and forth there’s always this chore to serialize/deserialize from one format to another, whether it be :

  • JS object to/from JSON
    yeah, quite straightforward
  • plain JS object to/from typed JS class object
    yeah, cumbersome heh
  • Java POJO to/from JSON
    I see Hibernate/Jackson users smile at the…


Hi everybody, hope you’re safe at home 🏠

Today a quick article about automated data validation with Joi and Nest.js !

This article assumes that you have basic knowledge about :

  • Nest.js and its dependency injection mechanism
  • Joi and automated data validation
  • Express and middlewares
  • TypeScript and Decorators feature

What is this all about ?

So typical use case here is to build an automated way to validate the data sent to your API routes.

That’s what Joi already provides as a feature, by allowing you to describe the structure of you data. Other libraries exist too of course like ajv, class-validator, and probably many others.


Photo by Serafima Lazarenko on Unsplash

Hi everybody !

Today I’m gonna go into using nest.js with passport to show some tips.

Many questions arose lately when trying to implement reusable pieces for authentication : here are some of the things I’ve learned in the process.

Why Nest.js ?

Nest (NestJS) is a framework for building efficient, scalable Node.js server-side applications. It uses progressive JavaScript, is built with and fully supports TypeScript (yet still enables developers to code in pure JavaScript) and combines elements of OOP (Object Oriented Programming), FP (Functional Programming), and FRP (Functional Reactive Programming).

Basically, Nest.js comes packaged with good practices and dependency injections made possible…


illustration made using serverless, terraform, and gear icons : all credits to their author

Hello everybody !

Today’s article is about mating Terraform and Serverless together to get the best of both worlds.

“Why ?” 🤔 would you ask me !
Because IMHO, Terraform is very good at handling the infrastructure part while Serverless makes it a breeze to manage your Cloud FaaS deployments.
When I say “very good” it mostly means “less verbose”, as both of them are able to perform the same exact tasks on their own.

Context

Imagine you would like to describe your core infrastructure with Terraform on AWS, so for example :

  • AWS VPC
  • AWS Security Groups
  • AWS Subnets
  • AWS…


Article of today is about dynamically matching files for your tests run with Jest.

Use case

Let’s say you have 2 different kinds of tests in your application :

  • unit-tests with files conventionally named like *.spec.js
  • integration tests with files conventionally named like *.test.js which probably require to setup some kind of environment (database, API server, and so on) and tend to run for quite a while

Now let’s imagine you would like to setup your code versioning workflow on GitHub (or another provider) this way :

  • master : main repository branch where you would like to run only Continuous Delivery pipeline
    💡…


Photo by John Schnobrich on Unsplash

Recently I had to play around with small scripts in Python, while I’m more commonly using Node.js, then rose a question in my mind : “is it possible to have Python script executes Node.js script, and the other way around too ?”.

I googled it and found a few ways !

Different approaches

Python to Node.js

  • compile JS to Python : apparently there’s some way which I haven’t tried as listed here or using Haxe but it might be limited support.
  • compile JS to C/C++, then call it from Python : there’s also for example ts2c library which I haven’t tried it but it seems…


Photo by Hello I'm Nik 🇬🇧 on Unsplash

Hi everybody ! 😃
A while ago I updated my mesg-pusher repository I started months ago to the latest version of MESG Engine. This also was the opportunity to experiment with the new Github Actions ! Having run into a few issues to get things working, I thought I would share with you all the steps to test a MESG Service.

What is MESG ?

MESG aims at creating decentralized event-driven task-orchestration systems. Anybody can implement various kind of MESG Services based on either existing ones or entirely new ones.

MESG Application(s) can then consume and orchestrate MESG Services to interact in an event-driven…

Romain Kelifa

Senior developer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store