@nauth-toolkit/nestjs 0.2.1 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +113 -2
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -4,6 +4,12 @@ NestJS module for [nauth-toolkit](https://nauth.dev) — the embedded authentica
4
4
 
5
5
  Provides a `DynamicModule` with `forRoot()` / `forRootAsync()` that wires the nauth-toolkit core into NestJS dependency injection. Adds guards, decorators, and interceptors so authentication integrates with NestJS conventions.
6
6
 
7
+ **[Documentation](https://nauth.dev/docs/quick-start/nestjs)** · **[API Reference](https://nauth.dev/docs/api/nestjs/overview)** · **[GitHub](https://github.com/noorixorg/nauth)**
8
+
9
+ > Part of [nauth-toolkit](https://www.npmjs.com/package/@nauth-toolkit/core). Requires `@nauth-toolkit/core` and a database package.
10
+
11
+ ---
12
+
7
13
  ## What's included
8
14
 
9
15
  - **AuthModule** — `forRoot()` and `forRootAsync()` registration with full config support
@@ -12,6 +18,111 @@ Provides a `DynamicModule` with `forRoot()` / `forRootAsync()` that wires the na
12
18
  - **Interceptors** — context management and cookie-based token delivery
13
19
  - **Auto-registration** — MFA and social providers are discovered and registered at bootstrap
14
20
 
15
- Requires `@nauth-toolkit/core` and a database adapter (e.g. `@nauth-toolkit/database-typeorm-postgres`). Add storage, email, SMS, MFA, and social providers as needed.
21
+ ---
22
+
23
+ ## Install
24
+
25
+ ```bash
26
+ npm install @nauth-toolkit/core @nauth-toolkit/nestjs \
27
+ @nauth-toolkit/database-typeorm-postgres \
28
+ @nauth-toolkit/storage-database \
29
+ @nauth-toolkit/email-console \
30
+ @nauth-toolkit/sms-console
31
+ # Or for MySQL: replace database-typeorm-postgres with database-typeorm-mysql
32
+ ```
33
+
34
+ ---
35
+
36
+ ## Quick start
37
+
38
+ ```typescript
39
+ // auth.module.ts
40
+ import { Module } from '@nestjs/common';
41
+ import { AuthModule as NAuthModule } from '@nauth-toolkit/nestjs';
42
+
43
+ @Module({
44
+ imports: [NAuthModule.forRoot(authConfig)],
45
+ controllers: [AuthController],
46
+ })
47
+ export class AuthModule {}
48
+ ```
49
+
50
+ ```typescript
51
+ // auth.controller.ts
52
+ import { AuthService, SignupDTO, LoginDTO, AuthGuard, Public, CurrentUser, IUser } from '@nauth-toolkit/nestjs';
53
+
54
+ @UseGuards(AuthGuard)
55
+ @Controller('auth')
56
+ export class AuthController {
57
+ constructor(private authService: AuthService) {}
58
+
59
+ @Public()
60
+ @Post('signup')
61
+ @HttpCode(201)
62
+ signup(@Body() dto: SignupDTO) {
63
+ return this.authService.signup(dto);
64
+ }
65
+
66
+ @Public()
67
+ @Post('login')
68
+ login(@Body() dto: LoginDTO) {
69
+ return this.authService.login(dto);
70
+ }
71
+
72
+ @Get('me')
73
+ profile(@CurrentUser() user: IUser) {
74
+ return user;
75
+ }
76
+ }
77
+ ```
78
+
79
+ Full guide: [nauth.dev/docs/quick-start/nestjs](https://nauth.dev/docs/quick-start/nestjs)
80
+
81
+ ---
82
+
83
+ ## Adding providers
84
+
85
+ MFA and social providers auto-register when imported into your module:
86
+
87
+ ```typescript
88
+ import { TOTPMFAModule } from '@nauth-toolkit/mfa-totp/nestjs';
89
+ import { GoogleSocialAuthModule } from '@nauth-toolkit/social-google/nestjs';
90
+
91
+ @Module({
92
+ imports: [
93
+ NAuthModule.forRoot(authConfig),
94
+ TOTPMFAModule,
95
+ GoogleSocialAuthModule,
96
+ ],
97
+ })
98
+ export class AuthModule {}
99
+ ```
100
+
101
+ ---
102
+
103
+ ## Related packages
104
+
105
+ | Package | Purpose |
106
+ | --- | --- |
107
+ | [`@nauth-toolkit/core`](https://www.npmjs.com/package/@nauth-toolkit/core) | Auth engine — required peer dependency |
108
+ | [`@nauth-toolkit/database-typeorm-postgres`](https://www.npmjs.com/package/@nauth-toolkit/database-typeorm-postgres) | PostgreSQL entities |
109
+ | [`@nauth-toolkit/database-typeorm-mysql`](https://www.npmjs.com/package/@nauth-toolkit/database-typeorm-mysql) | MySQL entities |
110
+ | [`@nauth-toolkit/mfa-totp`](https://www.npmjs.com/package/@nauth-toolkit/mfa-totp) | TOTP authenticator apps |
111
+ | [`@nauth-toolkit/social-google`](https://www.npmjs.com/package/@nauth-toolkit/social-google) | Google OAuth |
112
+
113
+ See the [full package list](https://www.npmjs.com/package/@nauth-toolkit/core#package-ecosystem) in the core README.
114
+
115
+ ---
116
+
117
+ ## Documentation
118
+
119
+ | Resource | Link |
120
+ | --- | --- |
121
+ | NestJS quick start | [nauth.dev/docs/quick-start/nestjs](https://nauth.dev/docs/quick-start/nestjs) |
122
+ | Configuration | [nauth.dev/docs/concepts/configuration](https://nauth.dev/docs/concepts/configuration) |
123
+ | API reference | [nauth.dev/docs/api/overview](https://nauth.dev/docs/api/overview) |
124
+ | Example app | [github.com/noorixorg/nauth/examples/nestjs](https://github.com/noorixorg/nauth/tree/main/examples/nestjs) |
125
+
126
+ ---
16
127
 
17
- **Docs:** [nauth.dev](https://nauth.dev) · **Examples:** [github.com/noorixorg/nauth](https://github.com/noorixorg/nauth) · **Live demo:** [demo.nauth.dev](https://demo.nauth.dev)
128
+ Free to use. See [license](https://nauth.dev/docs/license).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nauth-toolkit/nestjs",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "NestJS module for nauth-toolkit — guards, decorators, interceptors",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -44,7 +44,7 @@
44
44
  "typeorm": "^0.3.0"
45
45
  },
46
46
  "dependencies": {
47
- "@nauth-toolkit/core": "^0.2.1"
47
+ "@nauth-toolkit/core": "^0.2.2"
48
48
  },
49
49
  "devDependencies": {
50
50
  "@nestjs/common": "^11.1.8",