Skip to content

aarogyaojha/AuthProject

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🔐 AuthProject - Professional Full-Stack Authentication System

A production-ready, highly scalable authentication and authorization system. This project implements a modern monorepo architecture with a NestJS backend and a Next.js frontend.

�️ Monorepo Architecture

This project is divided into two primary services, each with its own specialized documentation. While the frontend provides a sleek interface, this is a backend-heavy project focused on complex distributed security patterns and modular API design.

The "Brain" of the project. Focuses on:

  • Modular Domain Design: High separation of concerns.
  • Unique Swagger & Constants Architecture: Unlike standard implementations, every API response message, status code, and Swagger documentation point is driven by a centralized Constants System. This ensures Zero Documentation Drift—your API docs are always perfectly synchronized with the actual business logic.
  • Security Pipeline: Multi-step cryptographic signup and session management.
  • Database Hygiene: Automated cleanup of OTPs and rotated tokens.
  • Audit Logging: Comprehensive forensic logging of sensitive actions.

Read the Backend README for architecture details and API documentation.

The "Face" of the project. Focuses on:

  • App Router: Leveraging modern React patterns.
  • Context Management: Global Auth state and Axios interceptors.
  • Smooth UX: Multi-step form flows for complex onboarding.

Read the Frontend README for UI structure and setup instructions.


� The "Centralized Truth" Innovation

What sets this repository apart is its Unified Response & Documentation Engine.

Instead of hardcoding strings in controllers and DTOs, this project utilizes a centralized ResponseMessages and HttpStatusCodes system that links directly to the Swagger (OpenAPI) documentation.

Why this is a game-changer:

  1. Zero Drift: Change a message in one constant file, and it updates across the logic, the automated tests, and the public API documentation simultaneously.
  2. Type-Safe Documentation: By leveraging NestJS decorators with these constants, the Swagger UI becomes a living contract that is mathematically guaranteed to match the backend's behavior.
  3. Frontend Harmony: Frontend developers can rely on standardized status codes and message keys, reducing integration friction.

�🚀 Getting Started (Quick Start)

Prerequisites

  • Node.js (v18+)
  • PostgreSQL
  • npm or yarn

1. Root Setup

Clone the repo and install dependencies:

git clone https://github.com/aarogyaojha/AuthProject.git
cd AuthProject

2. Backend Setup

cd backend
npm install
cp .env.example .env  # Configure your Postgres DB here
npx prisma migrate dev
npm run start:dev

3. Frontend Setup

cd ../frontend
npm install
cp .env.example .env.local
npm run dev

🛠️ Tech Stack

Layer Technology
Backend NestJS, Passport.js, Prisma, PostgreSQL
Frontend Next.js 15, React, Axios
Security JWT, Secure Cookies, Cryptographic OTP
DevOps Docker, Monorepo Structure

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

About

Production-ready full-stack monorepo auth system with NestJS, JWT, cryptographic OTP, and Centralized Truth Swagger architecture

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages