@nestadmin/core 0.1.0 → 0.1.1
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.
- package/README.md +80 -0
- package/package.json +10 -1
package/README.md
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# @nestadmin/core
|
|
2
|
+
|
|
3
|
+
**Zero-Config + Progressive Eject** native admin panel core for **NestJS** (v10 & v11).
|
|
4
|
+
|
|
5
|
+
- **Zero-Config Instant Start:** Auto-discovers ORM entities at `/admin` with automatic sensitive-field masking, smart default columns, search, sort, filters, pagination, and full CRUD.
|
|
6
|
+
- **Progressive Eject:** Customize only the resources you need via `@Admin(Model)` + `extends BaseAdmin<T>` with full NestJS Dependency Injection, `@AdminDisplay` virtual columns, `@AdminAction` bulk actions, and lifecycle hooks.
|
|
7
|
+
- **SSR + HTMX + Alpine.js + Tailwind CSS v4:** Zero runtime bundler, pre-compiled isolated assets (< 45 KB gzipped), dual CJS + ESM output.
|
|
8
|
+
- **Express & Fastify Parity:** Works identically on Express and Fastify without requiring `cookie-parser`, `@fastify/cookie`, `@fastify/formbody`, or `serve-static`.
|
|
9
|
+
- **Production Security Built-In:** Mass assignment whitelist sanitizer, explicit HTML escaping + `SafeHtml` (`ui.*`), AES-256-GCM encrypted session cookies, Signed Double-Submit CSRF, login rate limiter, security headers, and Fail-Safe Production Guard.
|
|
10
|
+
|
|
11
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
pnpm add @nestadmin/core @nestadmin/typeorm
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Quickstart
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
// src/app.module.ts
|
|
21
|
+
import { Module } from '@nestjs/common';
|
|
22
|
+
import { TypeOrmModule } from '@nestjs/typeorm';
|
|
23
|
+
import { AdminModule } from '@nestadmin/core';
|
|
24
|
+
import { TypeOrmAdapter } from '@nestadmin/typeorm';
|
|
25
|
+
|
|
26
|
+
@Module({
|
|
27
|
+
imports: [
|
|
28
|
+
TypeOrmModule.forRoot({ /* ... */ }),
|
|
29
|
+
AdminModule.forRoot({
|
|
30
|
+
title: 'My Admin',
|
|
31
|
+
adapter: TypeOrmAdapter.create(),
|
|
32
|
+
autoDiscoverAll: true,
|
|
33
|
+
}),
|
|
34
|
+
],
|
|
35
|
+
})
|
|
36
|
+
export class AppModule {}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Start your NestJS server and open `http://localhost:3000/admin`.
|
|
40
|
+
|
|
41
|
+
## Progressive Eject Example
|
|
42
|
+
|
|
43
|
+
```ts
|
|
44
|
+
import { Injectable } from '@nestjs/common';
|
|
45
|
+
import { Admin, AdminAction, AdminDisplay, BaseAdmin, ui } from '@nestadmin/core';
|
|
46
|
+
import { User } from '../../users/user.entity';
|
|
47
|
+
import { MailService } from '../../mail/mail.service';
|
|
48
|
+
|
|
49
|
+
@Admin(User)
|
|
50
|
+
@Injectable()
|
|
51
|
+
export class UserAdmin extends BaseAdmin<User> {
|
|
52
|
+
constructor(private readonly mailService: MailService) {
|
|
53
|
+
super();
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
override group = 'User Management';
|
|
57
|
+
override listDisplay = ['id', 'email', 'statusBadge', 'createdAt'];
|
|
58
|
+
|
|
59
|
+
@AdminDisplay({ label: 'Status' })
|
|
60
|
+
statusBadge(user: User) {
|
|
61
|
+
return user.isActive
|
|
62
|
+
? ui.badge('Active', 'success')
|
|
63
|
+
: ui.badge('Suspended', 'danger');
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
@AdminAction({ label: 'Resend Verification', confirm: true })
|
|
67
|
+
async resendVerification(selectedUsers: User[]) {
|
|
68
|
+
await this.mailService.sendBulkVerification(selectedUsers.map((u) => u.email));
|
|
69
|
+
return { message: `Sent to ${selectedUsers.length} user(s).` };
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Documentation
|
|
75
|
+
|
|
76
|
+
Full documentation, architecture ADRs, and production checklist: https://github.com/bbal10/nest-admin
|
|
77
|
+
|
|
78
|
+
## License
|
|
79
|
+
|
|
80
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nestadmin/core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Zero-Config + Progressive Eject native admin panel core for NestJS",
|
|
5
5
|
"license": "MIT",
|
|
6
|
+
"homepage": "https://github.com/bbal10/nest-admin#readme",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/bbal10/nest-admin.git",
|
|
10
|
+
"directory": "packages/core"
|
|
11
|
+
},
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/bbal10/nest-admin/issues"
|
|
14
|
+
},
|
|
6
15
|
"keywords": [
|
|
7
16
|
"nestjs",
|
|
8
17
|
"admin",
|