nextworks 0.1.0-alpha.2 → 0.1.0-alpha.4
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 +29 -3
- package/dist/cli_manifests/auth_manifest.json +3 -1
- package/dist/cli_manifests/blocks_manifest.json +6 -6
- package/dist/cli_manifests/data_manifest.json +3 -2
- package/dist/cli_manifests/forms_manifest.json +5 -3
- package/dist/commands/blocks.d.ts +1 -0
- package/dist/commands/blocks.d.ts.map +1 -1
- package/dist/commands/blocks.js +77 -10
- package/dist/commands/blocks.js.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/kits/auth-core/.nextworks/docs/AUTH_CORE_README.md +117 -0
- package/dist/kits/auth-core/.nextworks/docs/AUTH_QUICKSTART.md +244 -0
- package/dist/kits/blocks/.nextworks/docs/BLOCKS_QUICKSTART.md +193 -0
- package/dist/kits/blocks/.nextworks/docs/BLOCKS_README.md +65 -0
- package/dist/kits/blocks/.nextworks/docs/THEME_GUIDE.md +223 -0
- package/dist/kits/data/.nextworks/docs/DATA_QUICKSTART.md +112 -0
- package/dist/kits/data/.nextworks/docs/DATA_README.md +117 -0
- package/dist/kits/forms/.nextworks/docs/FORMS_QUICKSTART.md +84 -0
- package/dist/kits/forms/.nextworks/docs/FORMS_README.md +60 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -8,6 +8,14 @@ Nextworks is a CLI that installs **modular Next.js building blocks** into your a
|
|
|
8
8
|
- **Data** – Example CRUD for Users + Posts with admin UI, wired to Auth + Prisma.
|
|
9
9
|
|
|
10
10
|
> **Status:** early‑access alpha. Expect rough edges and breaking changes between alpha releases.
|
|
11
|
+
>
|
|
12
|
+
> In this alpha, the most reliable setup is to install **Blocks** first using:
|
|
13
|
+
>
|
|
14
|
+
> ```bash
|
|
15
|
+
> npx nextworks add blocks --sections --templates
|
|
16
|
+
> ```
|
|
17
|
+
>
|
|
18
|
+
> and then add **Auth Core**, **Forms**, and **Data** on top. Partial setups (e.g. Auth/Data without Blocks) may require manual tweaks and are not yet fully supported.
|
|
11
19
|
|
|
12
20
|
---
|
|
13
21
|
|
|
@@ -22,7 +30,7 @@ npx nextworks --help
|
|
|
22
30
|
Example commands:
|
|
23
31
|
|
|
24
32
|
```bash
|
|
25
|
-
npx nextworks add blocks
|
|
33
|
+
npx nextworks add blocks
|
|
26
34
|
npx nextworks add auth-core
|
|
27
35
|
npx nextworks add forms
|
|
28
36
|
npx nextworks add data
|
|
@@ -44,12 +52,13 @@ From your app root:
|
|
|
44
52
|
### 1) Install Blocks (UI kit)
|
|
45
53
|
|
|
46
54
|
```bash
|
|
47
|
-
npx nextworks add blocks
|
|
55
|
+
npx nextworks add blocks --sections --templates
|
|
48
56
|
```
|
|
49
57
|
|
|
50
58
|
This copies:
|
|
51
59
|
|
|
52
|
-
- `components/ui/*`
|
|
60
|
+
- `components/ui/*` (core UI primitives)
|
|
61
|
+
- `components/sections/*` (reusable sections)
|
|
53
62
|
- Page templates under `app/templates/*`
|
|
54
63
|
- Theme helpers and `app/globals.css` (if not already present)
|
|
55
64
|
|
|
@@ -137,6 +146,23 @@ Then visit:
|
|
|
137
146
|
|
|
138
147
|
---
|
|
139
148
|
|
|
149
|
+
## Advanced Blocks installs
|
|
150
|
+
|
|
151
|
+
For a full UI kit including core primitives, sections, and templates, use:
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
npx nextworks add blocks --sections --templates
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
If you want finer control:
|
|
158
|
+
|
|
159
|
+
- `npx nextworks add blocks --ui-only` – install core UI primitives only (no sections/templates).
|
|
160
|
+
- `npx nextworks add blocks --sections` – install core + sections only.
|
|
161
|
+
- `npx nextworks add blocks --templates` – install core + templates only.
|
|
162
|
+
- `npx nextworks add blocks --sections --templates` – install core + sections + templates.
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
140
166
|
## Copy‑paste quickstart for your app README
|
|
141
167
|
|
|
142
168
|
You can add a short “Nextworks setup” section to your app README:
|
|
@@ -46,7 +46,9 @@
|
|
|
46
46
|
"lib/forms/map-errors.ts",
|
|
47
47
|
"scripts/seed-demo.mjs",
|
|
48
48
|
"scripts/promote-admin.mjs",
|
|
49
|
-
"scripts/populate-tokenhash.mjs"
|
|
49
|
+
"scripts/populate-tokenhash.mjs",
|
|
50
|
+
".nextworks/docs/AUTH_CORE_README.md",
|
|
51
|
+
".nextworks/docs/AUTH_QUICKSTART.md"
|
|
50
52
|
],
|
|
51
53
|
"apiRoutes": [
|
|
52
54
|
"app/api/auth/[...nextauth]/route.ts",
|
|
@@ -31,7 +31,10 @@
|
|
|
31
31
|
"lib/themes.ts",
|
|
32
32
|
"lib/utils.ts",
|
|
33
33
|
"app/globals.css",
|
|
34
|
-
"next.config.ts"
|
|
34
|
+
"next.config.ts",
|
|
35
|
+
".nextworks/docs/THEME_GUIDE.md",
|
|
36
|
+
".nextworks/docs/BLOCKS_README.md",
|
|
37
|
+
".nextworks/docs/BLOCKS_QUICKSTART.md"
|
|
35
38
|
]
|
|
36
39
|
},
|
|
37
40
|
"sections": {
|
|
@@ -154,8 +157,7 @@
|
|
|
154
157
|
"public/placeholders/saas_dashboard/analytics.png",
|
|
155
158
|
"public/placeholders/saas_dashboard/chat.png",
|
|
156
159
|
"public/placeholders/saas_dashboard/projectBoard.png",
|
|
157
|
-
"
|
|
158
|
-
"notes/THEMING_CONVERSION_SUMMARY.md"
|
|
160
|
+
".nextworks/docs/THEME_GUIDE.md"
|
|
159
161
|
]
|
|
160
162
|
}
|
|
161
163
|
},
|
|
@@ -172,9 +174,7 @@
|
|
|
172
174
|
"public/placeholders/product_launch/hero.png",
|
|
173
175
|
"public/placeholders/saas_dashboard/analytics.png",
|
|
174
176
|
"public/placeholders/saas_dashboard/chat.png",
|
|
175
|
-
"public/placeholders/saas_dashboard/projectBoard.png"
|
|
176
|
-
"notes/THEME_GUIDE.md",
|
|
177
|
-
"notes/THEMING_CONVERSION_SUMMARY.md"
|
|
177
|
+
"public/placeholders/saas_dashboard/projectBoard.png"
|
|
178
178
|
],
|
|
179
179
|
"apiRoutes": [],
|
|
180
180
|
"cliKitPath": "cli/kits/blocks",
|
|
@@ -19,8 +19,9 @@
|
|
|
19
19
|
"app/examples/demo/seed-demo-button.tsx",
|
|
20
20
|
"lib/prisma.ts",
|
|
21
21
|
"lib/server/result.ts",
|
|
22
|
-
|
|
23
|
-
"
|
|
22
|
+
"scripts/seed-demo.mjs",
|
|
23
|
+
".nextworks/docs/DATA_README.md",
|
|
24
|
+
".nextworks/docs/DATA_QUICKSTART.md"
|
|
24
25
|
],
|
|
25
26
|
"apiRoutes": [
|
|
26
27
|
"/api/posts",
|
|
@@ -29,7 +29,9 @@
|
|
|
29
29
|
"app/examples/forms/wizard/page.tsx",
|
|
30
30
|
"app/examples/forms/server-action/form-client.tsx",
|
|
31
31
|
"app/examples/forms/server-action/page.tsx",
|
|
32
|
-
"app/api/wizard/route.ts"
|
|
32
|
+
"app/api/wizard/route.ts",
|
|
33
|
+
".nextworks/docs/FORMS_README.md",
|
|
34
|
+
".nextworks/docs/FORMS_QUICKSTART.md"
|
|
33
35
|
],
|
|
34
36
|
"apiRoutes": [],
|
|
35
37
|
"optionalExamples": {
|
|
@@ -47,8 +49,8 @@
|
|
|
47
49
|
"app/api/wizard/route.ts",
|
|
48
50
|
"components/examples/wizard-client.tsx"
|
|
49
51
|
],
|
|
50
|
-
"requires": ["data", "auth"],
|
|
51
|
-
"notes": "Wizard demo requires the data and auth kits (Prisma + NextAuth). Run: npx nextworks add data && npx nextworks add auth"
|
|
52
|
+
"requires": ["data", "auth-core"],
|
|
53
|
+
"notes": "Wizard demo requires the data and auth-core kits (Prisma + NextAuth). Run: npx nextworks add data && npx nextworks add auth-core"
|
|
52
54
|
}
|
|
53
55
|
},
|
|
54
56
|
"prisma": [],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blocks.d.ts","sourceRoot":"","sources":["../../src/commands/blocks.ts"],"names":[],"mappings":"AAyBA,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"blocks.d.ts","sourceRoot":"","sources":["../../src/commands/blocks.ts"],"names":[],"mappings":"AAyBA,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,wBAAsB,SAAS,CAAC,OAAO,GAAE,gBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC,CA2Q7E"}
|
package/dist/commands/blocks.js
CHANGED
|
@@ -16,18 +16,85 @@ async function addBlocks(options = {}) {
|
|
|
16
16
|
const manifest = (await (0, file_operations_1.readJsonFile)(manifestPath));
|
|
17
17
|
// Decide which groups to install.
|
|
18
18
|
// Core is always included to satisfy the contract that sections/templates rely on core.
|
|
19
|
+
// Behavior:
|
|
20
|
+
// - No flags: install core + sections + templates by default.
|
|
21
|
+
// - --sections: install core + sections only.
|
|
22
|
+
// - --templates: install core + templates only.
|
|
23
|
+
// - --sections --templates: core + sections + templates (same as default).
|
|
24
|
+
// - --ui-only: install core only (bare UI primitives, no sections/templates).
|
|
19
25
|
const explicitGroups = [];
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
if (options.
|
|
25
|
-
|
|
26
|
+
const anyGroupFlag = typeof options.sections === "boolean" ||
|
|
27
|
+
typeof options.templates === "boolean" ||
|
|
28
|
+
typeof options.gallery === "boolean" ||
|
|
29
|
+
typeof options.uiOnly === "boolean";
|
|
30
|
+
if (options.uiOnly) {
|
|
31
|
+
// uiOnly overrides other flags if set
|
|
32
|
+
const groupsToInstall = manifest.groups
|
|
33
|
+
? ["core"].filter((g) => g in manifest.groups)
|
|
34
|
+
: [];
|
|
35
|
+
const files = groupsToInstall.length > 0 && manifest.groups
|
|
36
|
+
? groupsToInstall.flatMap((groupName) => {
|
|
37
|
+
const group = manifest.groups?.[groupName];
|
|
38
|
+
return group?.files ?? [];
|
|
39
|
+
})
|
|
40
|
+
: manifest.files || [];
|
|
41
|
+
const filesToCopy = [];
|
|
42
|
+
const missingFiles = [];
|
|
43
|
+
for (const file of files) {
|
|
44
|
+
const kitSource = path_1.default.join(kitDir, file);
|
|
45
|
+
if (await (0, file_operations_1.fileExists)(kitSource)) {
|
|
46
|
+
filesToCopy.push(file);
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
const projectSource = path_1.default.join(process.cwd(), file);
|
|
50
|
+
if (await (0, file_operations_1.fileExists)(projectSource)) {
|
|
51
|
+
console.log(`ℹ️ Skipping ${file} (already exists in project)`);
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
missingFiles.push(file);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
if (filesToCopy.length > 0) {
|
|
59
|
+
await (0, file_operations_1.copyFiles)(kitDir, process.cwd(), filesToCopy);
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
console.log("⚠️ No files to copy from the blocks kit (all files missing or already present)");
|
|
63
|
+
}
|
|
64
|
+
// Update package.json and track install as usual
|
|
65
|
+
const depsPath = path_1.default.join(kitDir, "package-deps.json");
|
|
66
|
+
let deps = {};
|
|
67
|
+
try {
|
|
68
|
+
deps = await (0, file_operations_1.readJsonFile)(depsPath);
|
|
69
|
+
await (0, file_operations_1.updatePackageJson)(deps);
|
|
70
|
+
}
|
|
71
|
+
catch (err) {
|
|
72
|
+
console.log("⚠️ No package-deps.json found for blocks or failed to read it");
|
|
73
|
+
}
|
|
74
|
+
await (0, installation_tracker_1.addInstalledKit)("blocks", Object.keys(deps.dependencies || {}), Object.keys(deps.devDependencies || {}), filesToCopy);
|
|
75
|
+
console.log("✓ blocks core UI primitives installed successfully (ui-only mode)!");
|
|
76
|
+
if (missingFiles.length > 0) {
|
|
77
|
+
console.log("\n⚠️ The following files referenced by the blocks manifest were not found in the kit and were not copied:");
|
|
78
|
+
missingFiles.forEach((f) => console.log(` • ${f}`));
|
|
79
|
+
console.log("You may need to copy these files manually (for example placeholder assets under public/placeholders) or reconcile the kit files.");
|
|
80
|
+
}
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
if (anyGroupFlag) {
|
|
84
|
+
if (options.sections)
|
|
85
|
+
explicitGroups.push("sections");
|
|
86
|
+
if (options.templates)
|
|
87
|
+
explicitGroups.push("templates");
|
|
88
|
+
if (options.gallery)
|
|
89
|
+
explicitGroups.push("gallery");
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
// No flags passed: include sections and templates by default so templates
|
|
93
|
+
// always have their section dependencies available.
|
|
94
|
+
explicitGroups.push("sections", "templates");
|
|
95
|
+
}
|
|
26
96
|
const groupsToInstall = manifest.groups
|
|
27
|
-
? [
|
|
28
|
-
"core",
|
|
29
|
-
...(explicitGroups.length ? explicitGroups : ["templates"]),
|
|
30
|
-
].filter((g) => g in manifest.groups)
|
|
97
|
+
? ["core", ...explicitGroups].filter((g) => g in manifest.groups)
|
|
31
98
|
: [];
|
|
32
99
|
const files = groupsToInstall.length > 0 && manifest.groups
|
|
33
100
|
? groupsToInstall.flatMap((groupName) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blocks.js","sourceRoot":"","sources":["../../src/commands/blocks.ts"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"blocks.js","sourceRoot":"","sources":["../../src/commands/blocks.ts"],"names":[],"mappings":";;;;;AAgCA,8BA2QC;AA3SD,oHAAoH;AACpH,8DAOkC;AAClC,wEAAgE;AAChE,gDAAwB;AAsBjB,KAAK,UAAU,SAAS,CAAC,UAA4B,EAAE;IAC5D,OAAO,C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CAA0C,CAAC,CAAC;QAC1D,CAAC;QAED,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC5B,OAAO,CAAC,GAAG,CACT,2GAA2G,CAC5G,CAAC;YACF,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC;YACrD,OAAO,CAAC,GAAG,CACT,kIAAkI,CACnI,CAAC;QACJ,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,GAAG,CAAC,gCAAgC,CAAC,CAAC;QAC9C,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -27,6 +27,7 @@ program
|
|
|
27
27
|
.option("--sections", "Include standalone sections (Hero, CTA, Pricing, etc.)")
|
|
28
28
|
.option("--templates", "Include full page templates (Product Launch, SaaS Dashboard, Digital Agency, Gallery)")
|
|
29
29
|
.option("--gallery", "Include gallery/demo template and assets")
|
|
30
|
+
.option("--ui-only", "Install core UI primitives only (no sections/templates)")
|
|
30
31
|
.action(async (kit, options) => {
|
|
31
32
|
try {
|
|
32
33
|
switch (kit) {
|
|
@@ -44,6 +45,7 @@ program
|
|
|
44
45
|
sections: options.sections,
|
|
45
46
|
templates: options.templates,
|
|
46
47
|
gallery: options.gallery,
|
|
48
|
+
uiOnly: options.uiOnly,
|
|
47
49
|
});
|
|
48
50
|
break;
|
|
49
51
|
default:
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AAEA,4CAA4C;AAC5C,+BAA+B;;;;;AAE/B,yCAAoC;AACpC,oDAAmD;AACnD,8CAA8C;AAC9C,6DAAwC;AACxC,mGAAmG;AACnG,iGAAiG;AAEjG,2DAAsC;AACtC,kEAA6D;AAC7D,4DAAwD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
|
|
2
|
+
|
|
3
|
+
This folder contains the files that the `nextworks` CLI copies into a target Next.js project when you run:
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npx nextworks add auth-core
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
> **Alpha note**
|
|
10
|
+
>
|
|
11
|
+
> In this early alpha, the Auth Core kit is tested and supported on top of a **Blocks** install that includes sections and templates. For the smoothest experience, run:
|
|
12
|
+
>
|
|
13
|
+
> ```bash
|
|
14
|
+
> npx nextworks add blocks --sections --templates
|
|
15
|
+
> npx nextworks add auth-core
|
|
16
|
+
> ```
|
|
17
|
+
>
|
|
18
|
+
> before wiring up Prisma and env variables. Using Auth Core without Blocks may work but can require manual tweaks.
|
|
19
|
+
|
|
20
|
+
What the kit includes
|
|
21
|
+
|
|
22
|
+
- NextAuth configuration and handler: lib/auth.ts
|
|
23
|
+
- Prisma client helper: lib/prisma.ts
|
|
24
|
+
- Validation schemas: lib/validation/forms.ts
|
|
25
|
+
- ApiResult helpers: lib/server/result.ts
|
|
26
|
+
- Email helpers for dev and SMTP: lib/email/\*
|
|
27
|
+
- Signup API: app/api/signup/route.ts
|
|
28
|
+
- NextAuth API: app/api/auth/[...nextauth]/route.ts
|
|
29
|
+
- Login/Signup UI components: components/auth/\*
|
|
30
|
+
- SessionProvider and RequireAuth utilities
|
|
31
|
+
- Prisma snippet: prisma/auth-models.prisma
|
|
32
|
+
|
|
33
|
+
Database requirements
|
|
34
|
+
|
|
35
|
+
- The auth kit is designed and tested with **PostgreSQL** (for example using a managed service like [Neon](https://neon.tech/), Supabase, Railway, or a self‑hosted Postgres instance).
|
|
36
|
+
- Any Prisma‑supported provider _may_ work, but **Postgres is the recommended and tested path**.
|
|
37
|
+
|
|
38
|
+
Quick start with Postgres (recommended):
|
|
39
|
+
|
|
40
|
+
1. Create a Postgres database (for example on Neon).
|
|
41
|
+
2. Copy the connection string into your `.env` as:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
DATABASE_URL="postgres://..."
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
3. Merge the Prisma models from `prisma/auth-models.prisma` into your project's `prisma/schema.prisma`.
|
|
48
|
+
4. Run:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
npx prisma generate
|
|
52
|
+
npx prisma migrate dev -n init_auth
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
If you choose a different database provider, update the `provider` field in your Prisma schema and carefully review indexes/constraints before running migrations.
|
|
56
|
+
|
|
57
|
+
Environment variables
|
|
58
|
+
|
|
59
|
+
The kit relies on the following environment variables. Document these in post-install output or in your project's README:
|
|
60
|
+
|
|
61
|
+
Required (for core auth):
|
|
62
|
+
|
|
63
|
+
- DATABASE_URL
|
|
64
|
+
- NEXTAUTH_URL (e.g. http://localhost:3000)
|
|
65
|
+
- NEXTAUTH_SECRET
|
|
66
|
+
|
|
67
|
+
Optional / password reset & email:
|
|
68
|
+
|
|
69
|
+
- NEXTWORKS_ENABLE_PASSWORD_RESET=1 (enable password reset scaffold)
|
|
70
|
+
- NEXTWORKS_USE_DEV_EMAIL=1 (enable Ethereal dev email transport)
|
|
71
|
+
- SMTP_HOST, SMTP_PORT, SMTP_USER, SMTP_PASS, NOREPLY_EMAIL (when using real SMTP provider)
|
|
72
|
+
- GITHUB_ID, GITHUB_SECRET (optional) — the GitHub provider is enabled only when both are present
|
|
73
|
+
- NODE_ENV
|
|
74
|
+
|
|
75
|
+
Post-install steps (recommended)
|
|
76
|
+
|
|
77
|
+
1. Install dependencies copied by the kit (the CLI will merge `package-deps.json` into your `package.json`). Ensure `nodemailer` is installed if you will enable dev email:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
npm install
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
2. Copy or merge `prisma/auth-models.prisma` into your Prisma schema (`prisma/schema.prisma`) and run:
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
npx prisma generate
|
|
87
|
+
npx prisma migrate dev -n init
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
3. (Optional) Seed demo data for testing:
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
SEED_ADMIN_EMAIL=admin@example.com SEED_ADMIN_PASSWORD=password123 node ./scripts/seed-demo.mjs
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
4. Start your dev server:
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
npm run dev
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
5. Verify the basic flows:
|
|
103
|
+
|
|
104
|
+
- Signup: /auth/signup
|
|
105
|
+
- Login: /auth/login
|
|
106
|
+
- Protected dashboard: /dashboard (requires sign in)
|
|
107
|
+
- If enabled, forgot password POST to /api/auth/forgot-password and reset flows at /api/auth/reset-password
|
|
108
|
+
|
|
109
|
+
Notes & security
|
|
110
|
+
|
|
111
|
+
- Password reset is intentionally opt-in. Do not enable NEXTWORKS_ENABLE_PASSWORD_RESET in production unless you have configured a real mail provider and replaced the in-memory rate limiter.
|
|
112
|
+
- NEXTWORKS_USE_DEV_EMAIL=1 uses Ethereal (nodemailer) and prints a preview URL to server logs for development testing.
|
|
113
|
+
- Email verification on signup is **not yet implemented**. Stub endpoints and UI are in place at `/api/auth/send-verify-email` and `/auth/verify-email`. The Prisma `VerificationToken` model is already included so a future implementation can be added as a non-breaking enhancement.
|
|
114
|
+
|
|
115
|
+
CLI behavior (for maintainers)
|
|
116
|
+
|
|
117
|
+
- In the Nextworks repo, the CLI copies the files listed in `cli/cli_manifests/auth_manifest.json`. Keep that manifest and this kit folder in sync when editing the repo.
|