Skip to main content

Build NestJS Auth with brkpt-auth in 15 Minutes

Learn how to build a Password and Google OAuth MVP on NestJS v11 and Prisma 7.10.0 using brkpt-auth in just 15 minutes.

AI-written
Inewgen
08 Sep 2026Source: Dev.to2 min read (0 views)
Share
Build NestJS Auth with brkpt-auth in 15 Minutes

Stock photo for illustration only, not from the actual event

Font size
  • Build authentication on NestJS v11 using brkpt-auth
  • Supports both password credentials and Google OAuth
  • Connects to PostgreSQL database via Prisma 7.10.0
  • Eliminates manual boilerplate glue code

This article guides developers through building an MVP authentication system for NestJS projects using brkpt-auth. The tool is designed to solve the common issue where custom authentication code accumulates unnecessary complexity as real requirements grow. It installs full source code directly into your project and structures it around interfaces and adapters, keeping database and token logic completely separate from the core auth logic.

The walkthrough is written for NestJS v11 (using a default CommonJS project created via nest new) and Prisma 7.10.0. It utilizes class-validator for request validation because it integrates seamlessly with @Body() without requiring custom request pipes, unlike alternative validation libraries such as Zod.

15Minutes to build
v11NestJS version

To get started, initialize a new project using nest new my-app, install the brkpt CLI, along with essential packages like @nestjs/config, @nestjs/event-emitter, and cookie-parser. Running brkpt auth init installs the core features and prints a checklist of any remaining dependencies.

software developer writing code computer screen workspace

Stock photo for illustration only, not from the actual event

Never miss the latest news?

Subscribe to get news summaries by email - not often enough to be annoying.

โฆษณา

For data persistence, the project relies on a PostgreSQL database. You must configure the DATABASE_URL connection string inside your .env file, install Prisma version 7.10.0 along with @prisma/adapter-pg and pg, and execute npx prisma@7.10.0 init to set up the user schema.

Adopting this interface-driven architectural pattern significantly improves application maintainability. By isolating database operations and third-party OAuth providers into adapters, changes to your infrastructure or external services will not leak into your core business logic.

Once the core system is ready, adding password-based authentication is handled via the brkpt auth add credentials command, followed by installing class-validator, class-transformer, and bcrypt for password hashing. The credentials feature ships with empty DTOs, allowing developers to define custom sign-up form fields freely.

Source: Dev.to

Comments

Leave a Comment
0/2000

Found something wrong in this article? Report an issue with this article