brkpt-auth installs the source code into your project via a CLI. But it is not just a boilerplate downloader. It's built on hexagonal architecture, keeping auth logic separate from infrastructure, so you're not locked into a specific database schema or user model. To be more specific, the service depends on an abstract interface (I call this a 'port'), which you need to implement (I call this an 'adapter'). That's where you integrate your infrastructure. And the features do not depend directly on other features (besides core feature), this gives you the ability to add the feature only you need without touching the rest. Best of all, now you can easily reuse the auth logic in another project since the only thing you need to change is the 'adapter'.
It has a minimal config, quick to set up, and you don't need to understand the architecture up front. There's no huge abstract files or deep nested structure like some "hexagonal architecture" templates. It uses stateless JWT by default, but it is designed to be extensible for session management, so you can easily enable session management by 'add session' without changing the basic JWT workflow. There are currently 4 sign-in methods available: credentials (meaning basic user-password) / OAuth / OTP / magic-link. When you init the brkpt-auth, it only install the core feature, no sign-in method is enforced, so you can add later and combine them as you wish. For example, you may only need OAuth and don't want the basic password sign-in method. OAuth providers for now only support github and google, the provider is integrated using a special mechanism I called 'driver', which means you are also free to choose which drivers (corresponding to the provided; by source code) to install or enable. And you can decide how the oauth user raw object maps to your own user model, since it has a method in port and you can implement the details in adapter. OTP and magic-link can also be used as a verification strategy for the reset-password feature. You can get more information by reading the docs.
The repo includes a demo you can run locally. https://github.com/brkpt-labs/brkpt-auth
Show HN: Brkpt-auth – NestJS authentication as source you own
brkpt.com