Authentication is complex, it would be great to outsource it. But I also want to avoid getting locked in. Can I have my cake and eat it too?

TLDR; Yes! In the nestjs-starter repo, I’m using Cognito through OAuth2 with its hosted UI while keeping all user data in my app. So most of the complexity of authentication is outsourced to a ready-made solution (with possibly the lowest price) and I can replace this strategy any time, for example by implementing social login directly.

This way I’ll get many authentication strategies (Password, Google, Facebook, etc) at the cost of integrating…


OAuth2 examples for NestJS are amazingly scarce. There’s an open issue since 2018 asking for them, but the replies (1, 2) and resources elsewhere (1, 2) only provide a partial/incomplete overview.

Here I’ll show a full-stack authentication flow, including authenticated requests after the social token has been acquired, optionally for GraphQL as well. You can check a working example in the nestjs-starter repo.

Solution overview:

  • 1, Implement Google auth using @nestjs/passport and passport-google-auth (other providers are very similar).
  • 2, Once redirected back to the app, issue a JWT token, so the app can manage the user’s session.
  • 3, Protect REST…


Enjoy writing GraphQL queries as strings and getting untyped results? Me neither. The issue is sometimes called the “double declaration problem” and you can read more about it in more detail here and here, but you get the idea. Can’t you just take GraphQL schema, write typed queries, and get typed results? How about out of the box, without having to explicitly name the types?

TLDR; You can all those things with a single method! In the nestjs-starter repo, I’m using GraphQL with end-to-end typing to connect NestJS and Next.js.


NestJS is solving the issue of backend architecture. Add to that the popular choice of React on the frontend and you’ll find that full-stack JS is in a really good place right now. Can we combine these into an easy-to-use MVC architecture to enable quick prototyping?

TLDR; Yes! In the nestjs-starter repo, I’m combining NestJS and Next.js, connected with GraphQL, in Typescript (end-to-end typing, of course!), in a single MVC repo (not a monorepo of multiple projects), with some added functionality such as authentication via Passport and Cognito.

This article covers NestJS + Next.js integration.

Why a single MVC repo…


Jest has always been placing snapshots in the __snapshots__ folder right next to your tests. A convention similar to the __tests__ folder. This might not have been to your liking, especially if you co-locate tests with your code. In case of tests the testRegex option allowed for other approaches but there was no escape from __snapshots__ until now.

A new configuration in Jest v24 allows you to configure where snapshots are located relative to their corresponding test files and vice versa. This feature can already be used when installing jest@beta. Slightly modifying the example configuration the following setup will place snapshots right next to test files:

You can find other things I care about on Medium and GitHub.


Picture from VINTAYTIME

As a freelancer I recently created a more professional-looking email address (which we all should have). Only problem is that managing multiple email accounts is annoying. As it turns out so is configuring your G Suite Gmail to be accessible from your main one. I did some digging so you don’t have to. Scroll for TLDR.

This reason this isn’t straightforward is because with G Suite all kinds of organizational settings are in play and many of the switches needed are in the wrong state by default. As the admin of the organization you have set these up properly.

First…


Poe::Sniper is an open source desktop app that notifies you in-game when items you’re looking for are listed for trading in Path of Exile. It is an alternative to keeping several browser tabs open but it consumes far less resources and you don’t have to switch between the game and your browser all the time. You can use the same custom search criteria and can even message the seller instantly.

Head over here to download the latest version and if you just arrived to the party you can find usage instructions here.

This is an overview of recent improvements made…


Have you ever ran into this?

Or perhaps an EnvironmentMismatchError?

If you kept reading chances are you’re using dotenv and ran into the magical feature of Rake DB tasks being executed in both dev and test envs when invoked in dev env (see).

The issue, as explained on Zhu Wu’s blog, is that the smart environment change doesn’t take possible environment variable change into account and rather uses the DB config which was preloaded in dev env. E.g. if you have database: <%= ENV['DATABASE_NAME'] %> in your DB config, the new value of that variable in test env…


Parallel is fast, auto-correct is useful. Have you ever tried them together with the reasonable expectation that it works?

Oh. To be fair it probably makes sense that auto-correct doesn’t work on multiple threads.

Since I already had a small framework to automate work processes I could implement this functionality nicely in literally 10 lines: all I had to do is grab the offending files from the output of rubocop --parallel and feed them to rubocop --auto-correct. It’s in the gem called autotwow(as in [auto]mated [w]ay [o]f [w]orking) and can be used as:

gem install autowow

autowow rubocop_parallel_autocorrect /…


Poe::Sniper is an open source desktop app that notifies you in-game when items you’re looking for are listed for trading in Path of Exile. It is an alternative to keeping several browser tabs open but it consumes far less resources and you don’t have to switch between the game and your browser all the time. You can use the same custom search criteria and can even message the seller instantly.

Head over here to download the latest version and if you just arrived to the party you can find usage instructions here.

This is a somewhat technical overview of recent…

Csaba Apagyi

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