Skip to content

sakilanwar12/nest-auth

Repository files navigation

Nest Auth Starter — Authentication Boilerplate for NestJS

A production-ready NestJS authentication starter with JWT, Refresh Token, Prisma, and Bcrypt — designed to help you kickstart secure backend projects quickly and efficiently.

Built with NestJS, this starter project follows clean architecture and best practices for scalable authentication APIs.

Features

  • ✅ JWT Authentication (Access + Refresh Tokens)
  • ✅ Secure Password Hashing with Bcrypt
  • ✅ Refresh Token Rotation & Cookie Management
  • ✅ User Registration & Login
  • ✅ Role-Based Authorization
  • ✅ Prisma ORM Integration
  • ✅ Swagger Documentation Integration
  • ✅ TypeScript Support
  • ✅ Error Handling & Validation
  • ✅ Clean, Modular Folder Structure

Installation

git clone https://github.com/sakilanwar12/nest-auth
cd nest-auth
pnpm install

Environment Setup

Adjust the secrets and database URL according to your setup.

cp .env.example .env

Running the App

# dev server (watch mode)
$ pnpm run dev

# production mode
$ pnpm run start:prod

The app will run on: 👉 http://localhost:3000


Swagger Docs: http://localhost:3000/api/docs#/

Why Use This Starter?

  • Saves hours of setup time
  • Follows NestJS best practices
  • Includes token rotation and cookie management
  • Ready for production deployment
  • Easy to extend for OAuth, 2FA, or role-based systems

Future Improvements

  • Google / GitHub OAuth integration
  • Email verification system
  • Two-Factor Authentication (2FA)
  • Forgot / Reset password

License

This project is licensed under the MIT License — free to use, modify, and distribute. Author

Sakil Anwar

Frontend & Backend Developer — specializing in scalable web applications

SEO Keywords


NestJS authentication starter, NestJS JWT refresh token, NestJS Prisma auth, NestJS login register example, secure NestJS boilerplate, NestJS authentication with cookies, NestJS TypeScript starter, backend authentication starter.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors