create-authhero 0.47.1 โ†’ 0.47.3

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 CHANGED
@@ -256,7 +256,7 @@ Use conventional commits for automatic versioning:
256
256
 
257
257
  ## Documentation
258
258
 
259
- For more information, visit [https://authhero.net/docs](https://authhero.net/docs)
259
+ For more information, visit [https://docs.authhero.net](https://docs.authhero.net)
260
260
 
261
261
  ## License
262
262
 
@@ -158,6 +158,6 @@ npm run decrypt -- "enc:v1:..." # decrypt a stored value using ENCRYPTION_KEY
158
158
  ## Learn More
159
159
 
160
160
  - [SST Documentation](https://sst.dev/docs)
161
- - [AuthHero Documentation](https://authhero.net/docs)
161
+ - [AuthHero Documentation](https://docs.authhero.net)
162
162
  - [AWS Lambda](https://docs.aws.amazon.com/lambda/)
163
163
  - [DynamoDB](https://docs.aws.amazon.com/dynamodb/)
@@ -1,7 +1,7 @@
1
1
  import { handle } from "hono/aws-lambda";
2
2
  import { DynamoDBClient } from "@aws-sdk/client-dynamodb";
3
3
  import { DynamoDBDocumentClient } from "@aws-sdk/lib-dynamodb";
4
- import createAdapters from "@authhero/aws";
4
+ import createAdapters from "@authhero/aws-adapter";
5
5
  import {
6
6
  DataAdapters,
7
7
  createEncryptedDataAdapter,
@@ -61,7 +61,7 @@ export default $config({
61
61
  ENCRYPTION_KEY: process.env.ENCRYPTION_KEY ?? "",
62
62
  },
63
63
  nodejs: {
64
- install: ["@authhero/aws"],
64
+ install: ["@authhero/aws-adapter"],
65
65
  },
66
66
  });
67
67
 
@@ -189,7 +189,7 @@ routes = [
189
189
  ]
190
190
  ```
191
191
 
192
- For more information, visit [https://authhero.net/docs](https://authhero.net/docs).
192
+ For more information, visit [https://docs.authhero.net](https://docs.authhero.net).
193
193
 
194
194
  ## CI/CD with GitHub Actions
195
195
 
@@ -55,5 +55,5 @@ npm run seed # seed the control plane tenant + admin
55
55
  npm run dev
56
56
  ```
57
57
 
58
- See [Control Plane Defaults](https://authhero.net/docs/customization/multi-tenancy/control-plane-defaults)
58
+ See [Control Plane Defaults](https://docs.authhero.net/customization/multi-tenancy/control-plane-defaults)
59
59
  for the full architecture and request flows.
@@ -58,5 +58,5 @@ wrangler secret put CONTROL_PLANE_ENCRYPTION_KEY --name tenant-<id>-auth
58
58
 
59
59
  After the Worker and its D1 exist, run the control plane's
60
60
  `sync-defaults` for this tenant so its inherited rows are populated. See the
61
- [Control Plane Defaults](https://authhero.net/docs/customization/multi-tenancy/control-plane-defaults)
61
+ [Control Plane Defaults](https://docs.authhero.net/customization/multi-tenancy/control-plane-defaults)
62
62
  docs for the full flow.
@@ -267,7 +267,7 @@ var c = new e(), l = {
267
267
  decrypt: "node --env-file=.env scripts/decrypt-field.mjs"
268
268
  },
269
269
  dependencies: {
270
- "@authhero/aws": a,
270
+ "@authhero/aws-adapter": a,
271
271
  ...i && { "@authhero/admin": a },
272
272
  "@authhero/widget": a,
273
273
  "@aws-sdk/client-dynamodb": "^3.0.0",
@@ -303,12 +303,14 @@ function d(e, t = !1, n = "authhero-local", r) {
303
303
  "https://local.authhero.net/auth-callback",
304
304
  "http://localhost:5173/auth-callback",
305
305
  "http://localhost:3000/auth-callback",
306
- ...r ? ["http://localhost:3000/admin/auth-callback"] : []
306
+ "https://localhost:3000/auth-callback",
307
+ ...r ? ["http://localhost:3000/admin/auth-callback", "https://localhost:3000/admin/auth-callback"] : []
307
308
  ], s = t ? [`https://localhost.emobix.co.uk:8443/test/a/${n}/callback`, `https://localhost:8443/test/a/${n}/callback`] : [], c = [...o, ...s], l = [
308
309
  "https://manage.authhero.net",
309
310
  "https://local.authhero.net",
310
311
  "http://localhost:5173",
311
- "http://localhost:3000"
312
+ "http://localhost:3000",
313
+ "https://localhost:3000"
312
314
  ], u = t ? ["https://localhost:8443/", "https://localhost.emobix.co.uk:8443/"] : [], d = [...l, ...u], f = t ? `
313
315
  // Create OpenID Conformance Suite test clients and user
314
316
  console.log("Creating conformance test clients and user...");
@@ -556,7 +558,7 @@ function f(e, t) {
556
558
  // Add admin UI handler if the package is installed
557
559
  if (fs.existsSync(adminIndexPath)) {
558
560
  const issuer =
559
- process.env.ISSUER || \`http://localhost:\${process.env.PORT || 3000}/\`;
561
+ process.env.ISSUER || \`https://localhost:\${process.env.PORT || 3000}/\`;
560
562
  const rawHtml = fs.readFileSync(adminIndexPath, "utf-8")
561
563
  .replace(/src="\\.\\//g, 'src="/admin/')
562
564
  .replace(/href="\\.\\//g, 'href="/admin/');
@@ -835,7 +837,7 @@ function h(e) {
835
837
  function g(e) {
836
838
  return `import { DynamoDBClient } from "@aws-sdk/client-dynamodb";
837
839
  import { DynamoDBDocumentClient } from "@aws-sdk/lib-dynamodb";
838
- import createAdapters from "@authhero/aws";
840
+ import createAdapters from "@authhero/aws-adapter";
839
841
  import { seed, createEncryptedDataAdapter, loadEncryptionKey } from "authhero";
840
842
 
841
843
  async function main() {
@@ -941,8 +943,8 @@ function E() {
941
943
  function D() {
942
944
  console.log("\n" + "โ”€".repeat(50)), console.log("๐Ÿ›ฐ๏ธ AuthHero proxy running at http://localhost:8787"), console.log("โœ๏ธ Edit src/proxy.config.ts to add hosts and routes"), console.log("๐Ÿ“– See README.md for deployment instructions"), console.log("โ”€".repeat(50) + "\n");
943
945
  }
944
- function O() {
945
- console.log("\n" + "โ”€".repeat(50)), console.log("โœ… Self-signed certificates generated with openssl"), console.log("โš ๏ธ You may need to trust the certificate in your browser"), console.log("๐Ÿ” AuthHero server running at http://localhost:3000"), console.log("๐Ÿ“š API documentation available at http://localhost:3000/docs"), console.log("๐Ÿš€ Open http://localhost:3000/setup to complete initial setup"), console.log("โ”€".repeat(50) + "\n");
946
+ function O(e) {
947
+ console.log("\n" + "โ”€".repeat(50)), console.log("๐Ÿ” AuthHero server running at https://localhost:3000"), console.log("โš ๏ธ Uses a self-signed certificate โ€” you may need to trust it"), console.log("๐Ÿ“š API documentation available at https://localhost:3000/docs"), console.log("๐Ÿš€ Open https://localhost:3000/setup to complete initial setup"), console.log(e ? "๐Ÿ› ๏ธ Admin UI available at https://localhost:3000/admin" : "๐ŸŒ Portal available at https://local.authhero.net"), console.log("โ”€".repeat(50) + "\n");
946
948
  }
947
949
  c.version("1.0.0").description("Create a new AuthHero project").argument("[project-name]", "name of the project").option("-t, --template <type>", "template type: local, cloudflare, aws-sst, or proxy").option("--package-manager <pm>", "package manager to use: npm, yarn, pnpm, or bun").option("--multi-tenant", "enable multi-tenant mode").option("--admin-ui", "include admin UI at /admin").option("--skip-install", "skip installing dependencies").option("--skip-migrate", "skip running database migrations").option("--skip-start", "skip starting the development server").option("--github-ci", "include GitHub CI workflows with semantic versioning").option("--conformance", "add OpenID conformance suite test clients").option("--conformance-alias <alias>", "alias for conformance suite (default: authhero-local)").option("--workspace", "use workspace:* dependencies for local monorepo development").option("-y, --yes", "skip all prompts and use defaults/provided options").action(async (e, i) => {
948
950
  let o = i.yes === !0;
@@ -1128,11 +1130,11 @@ ENCRYPTION_KEY=${s()}
1128
1130
  name: "shouldStart",
1129
1131
  message: "Would you like to start the development server?",
1130
1132
  default: !0
1131
- }])).shouldStart, n && (m === "cloudflare" ? C() : m === "cloudflare-wfp-dispatcher" ? w() : m === "cloudflare-wfp-tenant" ? T() : m === "cloudflare-control-plane" ? E() : m === "aws-sst" ? v() : m === "proxy" ? D() : O(), console.log("๐Ÿš€ Starting development server...\n"), await x(`${e} run dev`, p)), o && !n && (console.log("\nโœ… Setup complete!"), console.log("\nTo start the development server:"), console.log(` cd ${c}`), console.log(" npm run dev"), m === "cloudflare" ? C() : m === "cloudflare-wfp-dispatcher" ? w() : m === "cloudflare-wfp-tenant" ? T() : m === "cloudflare-control-plane" ? E() : m === "aws-sst" ? v() : m === "proxy" ? D() : O());
1133
+ }])).shouldStart, n && (m === "cloudflare" ? C() : m === "cloudflare-wfp-dispatcher" ? w() : m === "cloudflare-wfp-tenant" ? T() : m === "cloudflare-control-plane" ? E() : m === "aws-sst" ? v() : m === "proxy" ? D() : O(g), console.log("๐Ÿš€ Starting development server...\n"), await x(`${e} run dev`, p)), o && !n && (console.log("\nโœ… Setup complete!"), console.log("\nTo start the development server:"), console.log(` cd ${c}`), console.log(" npm run dev"), m === "cloudflare" ? C() : m === "cloudflare-wfp-dispatcher" ? w() : m === "cloudflare-wfp-tenant" ? T() : m === "cloudflare-control-plane" ? E() : m === "aws-sst" ? v() : m === "proxy" ? D() : O(g));
1132
1134
  } catch (e) {
1133
1135
  console.error("\nโŒ An error occurred:", e), process.exit(1);
1134
1136
  }
1135
1137
  }
1136
- H || (console.log("Next steps:"), console.log(` cd ${c}`), m === "local" ? (console.log(" npm install"), console.log(" npm run migrate"), console.log(" npm run dev"), console.log("\nOpen http://localhost:3000/setup to complete initial setup")) : m === "cloudflare" ? (console.log(" npm install"), console.log(" npm run migrate # or npm run db:migrate:remote for production"), console.log(" npm run dev # or npm run dev:remote for production"), console.log("\nOpen https://localhost:3000/setup to complete initial setup")) : m === "cloudflare-wfp-dispatcher" ? (console.log(" npm install"), console.log(" npm run setup # creates wrangler.local.toml โ€” paste your database_id"), console.log(" npx wrangler dispatch-namespace create authhero-tenants"), console.log(" npm run dev # or npm run dev:remote for production"), console.log("\nDeploy tenant workers separately (`cloudflare` template):"), console.log(" wrangler deploy --dispatch-namespace=authhero-tenants --name=tenant-<id>-auth")) : m === "cloudflare-control-plane" ? (console.log(" npm install"), console.log(" npm run setup # creates wrangler.local.toml + .dev.vars"), console.log(" # set CONTROL_PLANE_ENCRYPTION_KEY in .dev.vars (share it with every tenant worker)"), console.log(" npm run migrate"), console.log(" npm run seed"), console.log(" npm run dev # or npm run dev:remote for production"), console.log("\nWire buildTenantAdapters() in src/index.ts, then project defaults:"), console.log(" POST /internal/tenants/:id/sync-defaults")) : m === "cloudflare-wfp-tenant" ? (console.log(" npm install"), console.log(" npm run setup # creates wrangler.local.toml + .dev.vars"), console.log(" # set CONTROL_PLANE_ENCRYPTION_KEY in .dev.vars (must match the control plane)"), console.log(" npm run migrate"), console.log(" npm run dev # or npm run dev:remote for production"), console.log("\nDeploy into the dispatch namespace:"), console.log(" wrangler deploy --dispatch-namespace=authhero-tenants --name=tenant-<id>-auth")) : m === "aws-sst" ? (console.log(" npm install"), console.log(" npm run dev # Deploys to AWS in development mode"), console.log("\nOpen your server URL /setup to complete initial setup")) : m === "proxy" && (console.log(" npm install"), console.log(" npm run dev"), console.log("\nEdit src/proxy.config.ts to add hosts and routes")), console.log(`\nServer will be available at: http://localhost:${m === "proxy" ? 8787 : m === "cloudflare-wfp-dispatcher" ? 3001 : m === "cloudflare-wfp-tenant" ? 3002 : 3e3}`), k && (console.log("\n๐Ÿงช OpenID Conformance Suite Testing:"), console.log(" 1. Clone and start the conformance suite (if not already running):"), console.log(" git clone https://gitlab.com/openid/conformance-suite.git"), console.log(" cd conformance-suite && mvn clean package"), console.log(" docker-compose up -d"), console.log(" 2. Open https://localhost.emobix.co.uk:8443"), console.log(" 3. Create a test plan and use conformance-config.json for settings"), console.log(` 4. Use alias: ${A}`)), console.log("\nFor more information, visit: https://authhero.net/docs\n"));
1138
+ H || (console.log("Next steps:"), console.log(` cd ${c}`), m === "local" ? (console.log(" npm install"), console.log(" npm run migrate"), console.log(" npm run dev"), console.log("\nOpen https://localhost:3000/setup to complete initial setup")) : m === "cloudflare" ? (console.log(" npm install"), console.log(" npm run migrate # or npm run db:migrate:remote for production"), console.log(" npm run dev # or npm run dev:remote for production"), console.log("\nOpen https://localhost:3000/setup to complete initial setup")) : m === "cloudflare-wfp-dispatcher" ? (console.log(" npm install"), console.log(" npm run setup # creates wrangler.local.toml โ€” paste your database_id"), console.log(" npx wrangler dispatch-namespace create authhero-tenants"), console.log(" npm run dev # or npm run dev:remote for production"), console.log("\nDeploy tenant workers separately (`cloudflare` template):"), console.log(" wrangler deploy --dispatch-namespace=authhero-tenants --name=tenant-<id>-auth")) : m === "cloudflare-control-plane" ? (console.log(" npm install"), console.log(" npm run setup # creates wrangler.local.toml + .dev.vars"), console.log(" # set CONTROL_PLANE_ENCRYPTION_KEY in .dev.vars (share it with every tenant worker)"), console.log(" npm run migrate"), console.log(" npm run seed"), console.log(" npm run dev # or npm run dev:remote for production"), console.log("\nWire buildTenantAdapters() in src/index.ts, then project defaults:"), console.log(" POST /internal/tenants/:id/sync-defaults")) : m === "cloudflare-wfp-tenant" ? (console.log(" npm install"), console.log(" npm run setup # creates wrangler.local.toml + .dev.vars"), console.log(" # set CONTROL_PLANE_ENCRYPTION_KEY in .dev.vars (must match the control plane)"), console.log(" npm run migrate"), console.log(" npm run dev # or npm run dev:remote for production"), console.log("\nDeploy into the dispatch namespace:"), console.log(" wrangler deploy --dispatch-namespace=authhero-tenants --name=tenant-<id>-auth")) : m === "aws-sst" ? (console.log(" npm install"), console.log(" npm run dev # Deploys to AWS in development mode"), console.log("\nOpen your server URL /setup to complete initial setup")) : m === "proxy" && (console.log(" npm install"), console.log(" npm run dev"), console.log("\nEdit src/proxy.config.ts to add hosts and routes")), console.log(`\nServer will be available at: ${m === "proxy" ? "http" : "https"}://localhost:${m === "proxy" ? 8787 : m === "cloudflare-wfp-dispatcher" ? 3001 : m === "cloudflare-wfp-tenant" ? 3002 : 3e3}`), k && (console.log("\n๐Ÿงช OpenID Conformance Suite Testing:"), console.log(" 1. Clone and start the conformance suite (if not already running):"), console.log(" git clone https://gitlab.com/openid/conformance-suite.git"), console.log(" cd conformance-suite && mvn clean package"), console.log(" docker-compose up -d"), console.log(" 2. Open https://localhost.emobix.co.uk:8443"), console.log(" 3. Create a test plan and use conformance-config.json for settings"), console.log(` 4. Use alias: ${A}`)), console.log("\nFor more information, visit: https://docs.authhero.net\n"));
1137
1139
  }), c.parse(process.argv);
1138
1140
  //#endregion
@@ -69,4 +69,4 @@ npm run gen:key # print a fresh base64 key
69
69
  npm run decrypt -- "enc:v1:..." # decrypt a stored value using ENCRYPTION_KEY from .env
70
70
  ```
71
71
 
72
- For more information, visit [https://authhero.net/docs](https://authhero.net/docs).
72
+ For more information, visit [https://docs.authhero.net](https://docs.authhero.net).
@@ -9,6 +9,7 @@ import fs from "fs";
9
9
  import path from "path";
10
10
  import { execFileSync } from "child_process";
11
11
  import https from "https";
12
+ import { fileURLToPath } from "url";
12
13
 
13
14
  // Generate self-signed certificates for local HTTPS if they don't exist
14
15
  const certDir = path.join(process.cwd(), ".certs");
@@ -130,9 +131,22 @@ const issuer = process.env.ISSUER || `https://localhost:${port}/`;
130
131
  // Get or generate certificates
131
132
  const { key, cert } = ensureCertificates();
132
133
 
134
+ // Point at the locally installed admin UI when the @authhero/admin package is
135
+ // present (same check as app.ts); fall back to the hosted portal otherwise.
136
+ const hasLocalAdminUi = fs.existsSync(
137
+ path.resolve(
138
+ path.dirname(fileURLToPath(import.meta.url)),
139
+ "../node_modules/@authhero/admin/dist/index.html",
140
+ ),
141
+ );
142
+
133
143
  console.log(`๐Ÿ” AuthHero server running at https://localhost:${port}`);
134
144
  console.log(`๐Ÿ“š API documentation available at https://localhost:${port}/docs`);
135
- console.log(`๐ŸŒ Portal available at https://local.authhero.net`);
145
+ if (hasLocalAdminUi) {
146
+ console.log(`๐Ÿ› ๏ธ Admin UI available at https://localhost:${port}/admin`);
147
+ } else {
148
+ console.log(`๐ŸŒ Portal available at https://local.authhero.net`);
149
+ }
136
150
 
137
151
  serve({
138
152
  fetch: (request) => {
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "type": "git",
6
6
  "url": "https://github.com/markusahlstrand/authhero"
7
7
  },
8
- "version": "0.47.1",
8
+ "version": "0.47.3",
9
9
  "type": "module",
10
10
  "main": "dist/create-authhero.js",
11
11
  "bin": {
@@ -22,7 +22,8 @@
22
22
  "@types/node": "^20.19.41",
23
23
  "tsx": "^4.22.3",
24
24
  "typescript": "^5.5.2",
25
- "vite": "^8.0.14"
25
+ "vite": "^8.0.14",
26
+ "vitest": "^4.1.7"
26
27
  },
27
28
  "dependencies": {
28
29
  "commander": "^12.1.0",
@@ -31,6 +32,8 @@
31
32
  "scripts": {
32
33
  "build": "tsc && vite build",
33
34
  "dev": "pnpm build && rm -rf auth-server && node dist/create-authhero.js auth-server --workspace --skip-install --skip-start && pnpm -w install --force --filter auth-server... && pnpm --filter auth-server migrate && pnpm --filter auth-server dev",
34
- "start": "pnpm build && node dist/create-authhero.js"
35
+ "start": "pnpm build && node dist/create-authhero.js",
36
+ "test": "vitest run",
37
+ "test:watch": "vitest"
35
38
  }
36
39
  }