@awsmbiz/create-inbis-app 0.0.0-stage → 0.1.0
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 +28 -2
- package/dist/cli.mjs +850 -0
- package/dist/cli.mjs.map +1 -0
- package/package.json +43 -3
- package/template/.dev.vars.example +4 -0
- package/template/README.md +115 -0
- package/template/e2e/accessibility.spec.ts +33 -0
- package/template/e2e/axe.ts +47 -0
- package/template/e2e/shell.spec.ts +33 -0
- package/template/e2e/tsconfig.json +8 -0
- package/template/eslint.config.js +7 -0
- package/template/migrations/0001_app_initial.sql +8 -0
- package/template/modules/README.md +6 -0
- package/template/modules/access-control/files/src/access-control-routes.ts +36 -0
- package/template/modules/access-control/files/src/access-control.ts +46 -0
- package/template/modules/access-control/files/test/access-control.test.ts +78 -0
- package/template/modules/access-control/module.json +54 -0
- package/template/modules/access-control/wiring/admin/admin.imports.tsx +1 -0
- package/template/modules/access-control/wiring/admin/admin.nav.tsx +2 -0
- package/template/modules/access-control/wiring/admin/admin.pages.tsx +4 -0
- package/template/modules/access-control/wiring/admin/admin.userSections.tsx +1 -0
- package/template/modules/access-control/wiring/admin/readme.modules.md +3 -0
- package/template/modules/access-control/wiring/admin/web.messages.ts +4 -0
- package/template/modules/access-control/wiring/audit/audit.catalogues.imports.ts +1 -0
- package/template/modules/access-control/wiring/audit/audit.catalogues.ts +1 -0
- package/template/modules/access-control/wiring/audit/readme.modules.md +4 -0
- package/template/modules/access-control/wiring/audit/web.messages.ts +6 -0
- package/template/modules/access-control/wiring/d1.jsonc +8 -0
- package/template/modules/access-control/wiring/env.bindings.ts +2 -0
- package/template/modules/access-control/wiring/readme.modules.md +20 -0
- package/template/modules/access-control/wiring/test.env.ts +1 -0
- package/template/modules/access-control/wiring/test.migrate.ts +1 -0
- package/template/modules/access-control/wiring/vitest.bindings.ts +1 -0
- package/template/modules/access-control/wiring/worker.imports.ts +1 -0
- package/template/modules/access-control/wiring/worker.routes.ts +2 -0
- package/template/modules/access-control/with-admin/e2e/access-roles.spec.ts +51 -0
- package/template/modules/access-control/with-admin/web/src/admin-roles.tsx +38 -0
- package/template/modules/access-control/with-audit/test/access-control-audit.test.ts +25 -0
- package/template/modules/admin/files/e2e/admin-accessibility.spec.ts +86 -0
- package/template/modules/admin/files/e2e/admin-area.spec.ts +109 -0
- package/template/modules/admin/files/e2e/admin-helpers.ts +39 -0
- package/template/modules/admin/files/src/admin.ts +46 -0
- package/template/modules/admin/files/test/admin.test.ts +47 -0
- package/template/modules/admin/files/web/src/admin-area.tsx +140 -0
- package/template/modules/admin/files/web/src/admin-client.ts +49 -0
- package/template/modules/admin/files/web/src/admin-example.tsx +62 -0
- package/template/modules/admin/files/web/src/admin-gate.tsx +112 -0
- package/template/modules/admin/module.json +50 -0
- package/template/modules/admin/wiring/account.sections.tsx +16 -0
- package/template/modules/admin/wiring/audit/admin.authAudit.ts +2 -0
- package/template/modules/admin/wiring/audit/admin.imports.tsx +1 -0
- package/template/modules/admin/wiring/audit/admin.nav.tsx +1 -0
- package/template/modules/admin/wiring/audit/admin.pages.tsx +1 -0
- package/template/modules/admin/wiring/audit/admin.server.imports.ts +3 -0
- package/template/modules/admin/wiring/audit/admin.stats.ts +3 -0
- package/template/modules/admin/wiring/audit/admin.userSections.tsx +1 -0
- package/template/modules/admin/wiring/audit/readme.modules.md +4 -0
- package/template/modules/admin/wiring/audit/web.messages.ts +1 -0
- package/template/modules/admin/wiring/readme.modules.md +26 -0
- package/template/modules/admin/wiring/web.messages.ts +22 -0
- package/template/modules/admin/wiring/web.routes.imports.tsx +1 -0
- package/template/modules/admin/wiring/web.routes.tsx +2 -0
- package/template/modules/admin/wiring/web.styles.css +1 -0
- package/template/modules/admin/wiring/worker.imports.ts +1 -0
- package/template/modules/admin/wiring/worker.routes.ts +2 -0
- package/template/modules/admin/with-audit/e2e/admin-activity.spec.ts +37 -0
- package/template/modules/admin/with-audit/test/admin-audit.test.ts +37 -0
- package/template/modules/admin/with-audit/web/src/admin-activity.tsx +21 -0
- package/template/modules/audit/files/src/audit-actions.ts +20 -0
- package/template/modules/audit/files/src/audit-log.ts +33 -0
- package/template/modules/audit/files/test/audit.test.ts +47 -0
- package/template/modules/audit/module.json +36 -0
- package/template/modules/audit/wiring/audit.imports.ts +1 -0
- package/template/modules/audit/wiring/audit.sink.ts +2 -0
- package/template/modules/audit/wiring/auth/audit.catalogues.imports.ts +1 -0
- package/template/modules/audit/wiring/auth/audit.catalogues.ts +1 -0
- package/template/modules/audit/wiring/auth/readme.modules.md +7 -0
- package/template/modules/audit/wiring/auth/web.messages.ts +26 -0
- package/template/modules/audit/wiring/auth/web.routes.imports.tsx +1 -0
- package/template/modules/audit/wiring/auth/web.routes.tsx +1 -0
- package/template/modules/audit/wiring/auth/worker.imports.ts +1 -0
- package/template/modules/audit/wiring/auth/worker.routes.ts +2 -0
- package/template/modules/audit/wiring/d1.jsonc +8 -0
- package/template/modules/audit/wiring/env.bindings.ts +4 -0
- package/template/modules/audit/wiring/index.imports.ts +1 -0
- package/template/modules/audit/wiring/index.setup.ts +2 -0
- package/template/modules/audit/wiring/readme.modules.md +16 -0
- package/template/modules/audit/wiring/test.env.ts +1 -0
- package/template/modules/audit/wiring/test.migrate.ts +1 -0
- package/template/modules/audit/wiring/vars.deployed.jsonc +2 -0
- package/template/modules/audit/wiring/vars.dev.jsonc +2 -0
- package/template/modules/audit/wiring/vitest.bindings.ts +1 -0
- package/template/modules/audit/with-auth/e2e/my-activity.spec.ts +89 -0
- package/template/modules/audit/with-auth/src/audit-routes.ts +21 -0
- package/template/modules/audit/with-auth/test/audit-routes.test.ts +17 -0
- package/template/modules/audit/with-auth/web/src/my-activity.tsx +168 -0
- package/template/modules/auth/files/e2e/auth-accessibility.spec.ts +68 -0
- package/template/modules/auth/files/e2e/auth-bootstrap-admin.spec.ts +58 -0
- package/template/modules/auth/files/e2e/auth-helpers.ts +74 -0
- package/template/modules/auth/files/e2e/auth-invitations.spec.ts +51 -0
- package/template/modules/auth/files/e2e/auth-phone.spec.ts +41 -0
- package/template/modules/auth/files/e2e/auth-seeded.ts +97 -0
- package/template/modules/auth/files/e2e/auth-sign-in.spec.ts +57 -0
- package/template/modules/auth/files/e2e/auth-two-factor.spec.ts +44 -0
- package/template/modules/auth/files/scripts/seed-user.mjs +64 -0
- package/template/modules/auth/files/src/auth-choices.ts +33 -0
- package/template/modules/auth/files/src/auth-config.ts +55 -0
- package/template/modules/auth/files/src/auth.ts +68 -0
- package/template/modules/auth/files/src/local-test-mode.ts +49 -0
- package/template/modules/auth/files/src/notifications.ts +94 -0
- package/template/modules/auth/files/test/auth-fixtures.ts +135 -0
- package/template/modules/auth/files/test/auth.test.ts +210 -0
- package/template/modules/auth/files/test/totp.ts +49 -0
- package/template/modules/auth/files/test/turnstile-fake.ts +42 -0
- package/template/modules/auth/files/web/src/account-menu.tsx +25 -0
- package/template/modules/auth/files/web/src/account.tsx +87 -0
- package/template/modules/auth/files/web/src/auth-client.ts +60 -0
- package/template/modules/auth/files/web/src/auth-pages.tsx +152 -0
- package/template/modules/auth/module.json +56 -0
- package/template/modules/auth/wiring/bindings.deployed.jsonc +2 -0
- package/template/modules/auth/wiring/d1.jsonc +7 -0
- package/template/modules/auth/wiring/devvars.txt +12 -0
- package/template/modules/auth/wiring/env.bindings.ts +26 -0
- package/template/modules/auth/wiring/index.deps.ts +1 -0
- package/template/modules/auth/wiring/index.imports.ts +4 -0
- package/template/modules/auth/wiring/index.setup.ts +7 -0
- package/template/modules/auth/wiring/playwright.imports.ts +1 -0
- package/template/modules/auth/wiring/playwright.servers.ts +12 -0
- package/template/modules/auth/wiring/playwright.setup.ts +2 -0
- package/template/modules/auth/wiring/playwright.vars.ts +2 -0
- package/template/modules/auth/wiring/readme.modules.md +30 -0
- package/template/modules/auth/wiring/readme.provisioning.md +11 -0
- package/template/modules/auth/wiring/secrets.jsonc +2 -0
- package/template/modules/auth/wiring/test.env.ts +1 -0
- package/template/modules/auth/wiring/test.migrate.ts +1 -0
- package/template/modules/auth/wiring/vars.dev.jsonc +19 -0
- package/template/modules/auth/wiring/vars.production.jsonc +13 -0
- package/template/modules/auth/wiring/vars.staging.jsonc +13 -0
- package/template/modules/auth/wiring/vitest.bindings.ts +6 -0
- package/template/modules/auth/wiring/web.header.tsx +1 -0
- package/template/modules/auth/wiring/web.layout.imports.tsx +1 -0
- package/template/modules/auth/wiring/web.messages.ts +17 -0
- package/template/modules/auth/wiring/web.routes.imports.tsx +12 -0
- package/template/modules/auth/wiring/web.routes.tsx +11 -0
- package/template/modules/auth/wiring/web.styles.css +1 -0
- package/template/modules/auth/wiring/worker.deps.ts +2 -0
- package/template/modules/auth/wiring/worker.imports.ts +1 -0
- package/template/modules/auth/wiring/worker.routes.ts +2 -0
- package/template/modules/example/files/e2e/example-notes.spec.ts +39 -0
- package/template/modules/example/files/migrations/0002_example_notes.sql +12 -0
- package/template/modules/example/files/src/example-audit-actions.ts +12 -0
- package/template/modules/example/files/src/example-notes.ts +136 -0
- package/template/modules/example/files/test/example-notes-fixtures.ts +30 -0
- package/template/modules/example/files/test/example-notes.test.ts +52 -0
- package/template/modules/example/files/web/src/example-notes.tsx +176 -0
- package/template/modules/example/module.json +61 -0
- package/template/modules/example/wiring/access-control/access.permissions.ts +3 -0
- package/template/modules/example/wiring/access-control/access.roles.ts +2 -0
- package/template/modules/example/wiring/access-control/example.e2e.imports.ts +2 -0
- package/template/modules/example/wiring/access-control/example.e2e.setup.ts +18 -0
- package/template/modules/example/wiring/access-control/example.imports.ts +3 -0
- package/template/modules/example/wiring/access-control/example.policy.ts +10 -0
- package/template/modules/example/wiring/access-control/example.test.caller.ts +17 -0
- package/template/modules/example/wiring/access-control/example.test.imports.ts +1 -0
- package/template/modules/example/wiring/access-control/readme.modules.md +5 -0
- package/template/modules/example/wiring/admin/admin.imports.tsx +1 -0
- package/template/modules/example/wiring/admin/admin.nav.tsx +2 -0
- package/template/modules/example/wiring/admin/admin.pages.tsx +2 -0
- package/template/modules/example/wiring/admin/readme.modules.md +4 -0
- package/template/modules/example/wiring/admin/web.messages.ts +11 -0
- package/template/modules/example/wiring/admin/worker.imports.ts +1 -0
- package/template/modules/example/wiring/admin/worker.routes.ts +2 -0
- package/template/modules/example/wiring/audit/audit.catalogues.imports.ts +1 -0
- package/template/modules/example/wiring/audit/audit.catalogues.ts +2 -0
- package/template/modules/example/wiring/audit/readme.modules.md +4 -0
- package/template/modules/example/wiring/readme.modules.md +16 -0
- package/template/modules/example/wiring/web.messages.ts +19 -0
- package/template/modules/example/wiring/web.routes.imports.tsx +1 -0
- package/template/modules/example/wiring/web.routes.tsx +2 -0
- package/template/modules/example/wiring/worker.imports.ts +1 -0
- package/template/modules/example/wiring/worker.routes.ts +2 -0
- package/template/modules/example/with-access-control/test/example-notes-access.test.ts +51 -0
- package/template/modules/example/with-admin/e2e/example-notes-admin.spec.ts +55 -0
- package/template/modules/example/with-admin/src/example-notes-admin.ts +62 -0
- package/template/modules/example/with-admin/test/example-notes-admin.test.ts +42 -0
- package/template/modules/example/with-admin/web/src/admin-notes.tsx +99 -0
- package/template/modules/example/with-audit/test/example-notes-audit.test.ts +22 -0
- package/template/package.json +57 -0
- package/template/playwright.config.ts +38 -0
- package/template/renovate.json +12 -0
- package/template/src/app.ts +46 -0
- package/template/src/audit-catalogues.ts +9 -0
- package/template/src/audit-sink.ts +21 -0
- package/template/src/env.d.ts +21 -0
- package/template/src/index.ts +18 -0
- package/template/src/v1.ts +24 -0
- package/template/standalone/.github/workflows/ci.yml +21 -0
- package/template/standalone/.github/workflows/deploy.yml +32 -0
- package/template/standalone/.nvmrc +1 -0
- package/template/standalone/_gitignore +9 -0
- package/template/standalone/pnpm-workspace.yaml +11 -0
- package/template/template.json +56 -0
- package/template/test/env.d.ts +11 -0
- package/template/test/migrate.ts +11 -0
- package/template/test/migrations.test.ts +22 -0
- package/template/test/worker.test.ts +65 -0
- package/template/tsconfig.json +7 -0
- package/template/vitest.config.ts +24 -0
- package/template/web/index.html +12 -0
- package/template/web/src/app.tsx +44 -0
- package/template/web/src/home.tsx +51 -0
- package/template/web/src/layout.tsx +48 -0
- package/template/web/src/main.tsx +16 -0
- package/template/web/src/messages.ts +38 -0
- package/template/web/src/navigation.tsx +34 -0
- package/template/web/src/route-focus.ts +49 -0
- package/template/web/src/routes.tsx +38 -0
- package/template/web/src/styles.css +11 -0
- package/template/web/src/system-theme.ts +16 -0
- package/template/web/tsconfig.json +7 -0
- package/template/web/vite.config.ts +15 -0
- package/template/wrangler.jsonc +96 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
@import "@awsmbiz/inbis-ui/globals.css";
|
|
2
|
+
/* inbis:wire web.styles */
|
|
3
|
+
|
|
4
|
+
/* The app's own components. */
|
|
5
|
+
@source "./";
|
|
6
|
+
|
|
7
|
+
/* Page headings take focus after a route change (src/route-focus.ts) only to start
|
|
8
|
+
reading there; they are not controls, so no focus ring. */
|
|
9
|
+
h1[tabindex="-1"]:focus {
|
|
10
|
+
outline: none;
|
|
11
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// The app follows the system's light/dark setting: `@awsmbiz/inbis-ui`'s tokens key on the
|
|
2
|
+
// `dark` class of <html>. Applied before the first render (no flash of the wrong theme) and
|
|
3
|
+
// kept in step when the setting changes.
|
|
4
|
+
|
|
5
|
+
const DARK = "(prefers-color-scheme: dark)";
|
|
6
|
+
|
|
7
|
+
export function followSystemTheme(): void {
|
|
8
|
+
if (typeof window.matchMedia !== "function") return;
|
|
9
|
+
const query = window.matchMedia(DARK);
|
|
10
|
+
const apply = () => {
|
|
11
|
+
document.documentElement.classList.toggle("dark", query.matches);
|
|
12
|
+
document.documentElement.style.colorScheme = query.matches ? "dark" : "light";
|
|
13
|
+
};
|
|
14
|
+
apply();
|
|
15
|
+
query.addEventListener("change", apply);
|
|
16
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import tailwindcss from "@tailwindcss/vite";
|
|
2
|
+
import react from "@vitejs/plugin-react";
|
|
3
|
+
import { defineConfig } from "vite";
|
|
4
|
+
|
|
5
|
+
// `vite build` writes web/dist, which the Worker serves as static assets (wrangler.jsonc
|
|
6
|
+
// `assets`). `pnpm dev:web` serves the SPA on :5173 with the API proxied to `wrangler dev` on :8787.
|
|
7
|
+
export default defineConfig({
|
|
8
|
+
root: import.meta.dirname,
|
|
9
|
+
plugins: [react(), tailwindcss()],
|
|
10
|
+
build: { outDir: "dist", emptyOutDir: true },
|
|
11
|
+
server: {
|
|
12
|
+
port: 5173,
|
|
13
|
+
proxy: Object.fromEntries(["/api", "/v1", "/health", "/openapi.json"].map((path) => [path, "http://localhost:8787"])),
|
|
14
|
+
},
|
|
15
|
+
});
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "node_modules/wrangler/config-schema.json",
|
|
3
|
+
"name": "react-hono-app",
|
|
4
|
+
"main": "src/index.ts",
|
|
5
|
+
"compatibility_date": "2026-10-23",
|
|
6
|
+
"compatibility_flags": ["nodejs_compat"],
|
|
7
|
+
"observability": { "enabled": true },
|
|
8
|
+
// The SPA (web/, built by `pnpm build:web`) is served by this Worker as static assets.
|
|
9
|
+
// Unknown paths fall back to index.html; API paths always reach the Worker first.
|
|
10
|
+
"assets": {
|
|
11
|
+
"directory": "./web/dist",
|
|
12
|
+
"not_found_handling": "single-page-application",
|
|
13
|
+
"run_worker_first": ["/api/*", "/v1/*", "/health", "/health/*", "/openapi.json"]
|
|
14
|
+
},
|
|
15
|
+
// The top level is local development (`wrangler dev`). The deployed environments are
|
|
16
|
+
// env.staging and env.production below. Vars, secrets and bindings are NOT inherited by
|
|
17
|
+
// named environments, so each one repeats them.
|
|
18
|
+
"vars": {
|
|
19
|
+
// inbis:wire wrangler.vars env=dev
|
|
20
|
+
// Comma-separated browser origins allowed to call the API with credentials
|
|
21
|
+
// (the Vite dev server; the Worker's own origin is always allowed for same-origin requests).
|
|
22
|
+
"TRUSTED_ORIGINS": "http://localhost:5173"
|
|
23
|
+
},
|
|
24
|
+
// Set with `wrangler secret put <NAME> --env <env>` (deployed) or `.dev.vars` (local; see
|
|
25
|
+
// .dev.vars.example). `wrangler deploy` fails while a required secret is missing.
|
|
26
|
+
"secrets": {
|
|
27
|
+
"required": [
|
|
28
|
+
// inbis:wire wrangler.secrets env=dev
|
|
29
|
+
]
|
|
30
|
+
},
|
|
31
|
+
// inbis:wire wrangler.bindings env=dev
|
|
32
|
+
// One D1 database, one binding per migration source (platform packages own their migrations).
|
|
33
|
+
// Platform bindings come first: `pnpm db:migrate` applies them in declaration order, the app's
|
|
34
|
+
// own DB binding last. Every binding of the database carries the same database_id.
|
|
35
|
+
"d1_databases": [
|
|
36
|
+
// inbis:wire wrangler.d1 env=dev database_name=react-hono-app-dev database_id=local-react-hono-app-dev
|
|
37
|
+
{
|
|
38
|
+
"binding": "DB",
|
|
39
|
+
"database_name": "react-hono-app-dev",
|
|
40
|
+
// Local-only ID. Deployed environments use the ID printed by `wrangler d1 create`.
|
|
41
|
+
"database_id": "local-react-hono-app-dev",
|
|
42
|
+
"migrations_dir": "migrations",
|
|
43
|
+
"migrations_table": "d1_migrations"
|
|
44
|
+
}
|
|
45
|
+
],
|
|
46
|
+
"env": {
|
|
47
|
+
"staging": {
|
|
48
|
+
"routes": [{ "pattern": "staging.react-hono-app.example.com", "custom_domain": true }],
|
|
49
|
+
"vars": {
|
|
50
|
+
// inbis:wire wrangler.vars env=staging
|
|
51
|
+
"TRUSTED_ORIGINS": "https://staging.react-hono-app.example.com"
|
|
52
|
+
},
|
|
53
|
+
"secrets": {
|
|
54
|
+
"required": [
|
|
55
|
+
// inbis:wire wrangler.secrets env=staging
|
|
56
|
+
]
|
|
57
|
+
},
|
|
58
|
+
// inbis:wire wrangler.bindings env=staging
|
|
59
|
+
"d1_databases": [
|
|
60
|
+
// inbis:wire wrangler.d1 env=staging database_name=react-hono-app-staging-db database_id=set-from-wrangler-d1-create
|
|
61
|
+
{
|
|
62
|
+
"binding": "DB",
|
|
63
|
+
"database_name": "react-hono-app-staging-db",
|
|
64
|
+
// From `wrangler d1 create react-hono-app-staging-db --location apac` (see README).
|
|
65
|
+
"database_id": "set-from-wrangler-d1-create",
|
|
66
|
+
"migrations_dir": "migrations",
|
|
67
|
+
"migrations_table": "d1_migrations"
|
|
68
|
+
}
|
|
69
|
+
]
|
|
70
|
+
},
|
|
71
|
+
"production": {
|
|
72
|
+
"routes": [{ "pattern": "react-hono-app.example.com", "custom_domain": true }],
|
|
73
|
+
"vars": {
|
|
74
|
+
// inbis:wire wrangler.vars env=production
|
|
75
|
+
"TRUSTED_ORIGINS": "https://react-hono-app.example.com"
|
|
76
|
+
},
|
|
77
|
+
"secrets": {
|
|
78
|
+
"required": [
|
|
79
|
+
// inbis:wire wrangler.secrets env=production
|
|
80
|
+
]
|
|
81
|
+
},
|
|
82
|
+
// inbis:wire wrangler.bindings env=production
|
|
83
|
+
"d1_databases": [
|
|
84
|
+
// inbis:wire wrangler.d1 env=production database_name=react-hono-app-production-db database_id=set-from-wrangler-d1-create
|
|
85
|
+
{
|
|
86
|
+
"binding": "DB",
|
|
87
|
+
"database_name": "react-hono-app-production-db",
|
|
88
|
+
// From `wrangler d1 create react-hono-app-production-db --location apac` (see README).
|
|
89
|
+
"database_id": "set-from-wrangler-d1-create",
|
|
90
|
+
"migrations_dir": "migrations",
|
|
91
|
+
"migrations_table": "d1_migrations"
|
|
92
|
+
}
|
|
93
|
+
]
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|