create-user-hub 0.1.5 → 0.1.6

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
@@ -12,7 +12,7 @@ It asks for your hub's URL and admin password (from your hub's admin; the passwo
12
12
 
13
13
  Scripts and coding agents are never asked when `HUB_URL` and `HUB_ADMIN_PASSWORD` are already in the environment (for example through your secret manager). The password is never a command-line flag, so it stays out of shell history.
14
14
 
15
- You get a TanStack Start + Convex app with Tailwind, shadcn (dark theme) and Biome, plus:
15
+ You get a TanStack Start + Convex app with Tailwind, shadcn (dark theme) and Vite+ (Oxfmt, Oxlint), plus:
16
16
 
17
17
  - **Sign-in** from [`@user-hub/auth`](https://www.npmjs.com/package/@user-hub/auth): a signed-in home page, a facilitator-only page, sign-out, and notes saved per person.
18
18
  - **For coding agents:** `CLAUDE.md` (also as `AGENTS.md`) and the `user-hub-auth` skill in `.claude/skills`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-user-hub",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "description": "Start a TanStack Start + Convex app with User Hub sign-in: bun create user-hub@latest my-app",
5
5
  "type": "module",
6
6
  "bin": {
@@ -0,0 +1,3 @@
1
+ {
2
+ "recommendations": ["VoidZero.vite-plus-extension-pack"]
3
+ }
@@ -0,0 +1,23 @@
1
+ {
2
+ "files.watcherExclude": {
3
+ "**/routeTree.gen.ts": true
4
+ },
5
+ "search.exclude": {
6
+ "**/routeTree.gen.ts": true
7
+ },
8
+ "files.readonlyInclude": {
9
+ "**/routeTree.gen.ts": true
10
+ },
11
+ "editor.defaultFormatter": "oxc.oxc-vscode",
12
+ "[javascript]": { "editor.defaultFormatter": "oxc.oxc-vscode" },
13
+ "[javascriptreact]": { "editor.defaultFormatter": "oxc.oxc-vscode" },
14
+ "[typescript]": { "editor.defaultFormatter": "oxc.oxc-vscode" },
15
+ "[typescriptreact]": { "editor.defaultFormatter": "oxc.oxc-vscode" },
16
+ "oxc.disableNestedConfig": true,
17
+ "oxc.fmt.disableNestedConfig": true,
18
+ "editor.formatOnSave": true,
19
+ "editor.formatOnSaveMode": "file",
20
+ "editor.codeActionsOnSave": {
21
+ "source.fixAll.oxc": "explicit"
22
+ }
23
+ }
@@ -18,7 +18,11 @@ A TanStack Start + Convex app whose sign-in comes from User Hub: people scan the
18
18
  - **Convex:** public functions are thin wrappers (validators, an auth check, one call into `convex/model/`); every function has `args` and `returns` validators; reads use indexes and are bounded.
19
19
  - **UI:** shadcn components only (`bunx --bun shadcn@latest add …`), dark theme, works on mobile. Lists are `Item`s in an `ItemGroup` with actions in a `ButtonGroup`, never tables; forms use `Field`.
20
20
  - **Imports:** the `@/` alias for `src/`.
21
+ - **Generated files:** never edit `src/routeTree.gen.ts`, `convex/_generated/*` or `src/components/ui/*` by hand.
22
+ - **Lint:** never disable a lint rule: find the fix in the library's docs, or say so.
21
23
 
22
24
  ## Commands
23
25
 
24
- `bun run setup` (once), `bun run setup --prod <url>` (once deployed: registers the production URL so badge scans can reach the app; see the skill's "Production URL"), `bun run dev`, `bun run check`, `bun run typecheck`, `bun run build`, `just build` / `just push` (deploy Convex to production and build the Docker image against it; `IMAGE` sets the registry path; the container needs no env).
26
+ `bun run setup` (once), `bun run setup --prod <url>` (once deployed: registers the production URL so badge scans can reach the app; see the skill's "Production URL"), `bun run setup --unlisted` / `--listed` (keep the app out of the hub's badge app list, or put it back; new apps are listed), `bun run dev`, `bun run check` (`vp check`: format, lint and type-check), `bun run fix` (`vp check --fix`), `bun run typecheck`, `bun run build`, `just build` / `just push` (deploy Convex to production and build the Docker image against it; `IMAGE` sets the registry path; the container needs no env). Lint and format rules live in `vite.config.ts` (Vite+); `vp` is project-local, so run it through the scripts or `bunx vp`.
27
+
28
+ **Hub moved:** change `HUB_URL` in `.env.local`, run `bun run setup` (it updates this app's registration and sets `HUB_ISSUER`/`HUB_JWKS` on Convex, production included once a production URL is known, and `VITE_HUB_URL`), then `just push`, because `VITE_HUB_URL` is built into the frontend.
@@ -1,7 +1,7 @@
1
1
  # syntax=docker/dockerfile:1
2
2
 
3
- # TanStack Start built by Vite, served by Bun (server.ts). Build it with
4
- # `just build` or `just push`, which also deploy Convex to production.
3
+ # TanStack Start built by Vite+ (`vp build`), served by Bun (server.ts). Build
4
+ # it with `just build` or `just push`, which also deploy Convex to production.
5
5
  FROM oven/bun:1.4-slim AS base
6
6
  WORKDIR /app
7
7
 
@@ -10,15 +10,16 @@ FROM base AS deps
10
10
  COPY --link bun.lock package.json ./
11
11
  RUN bun install --frozen-lockfile
12
12
 
13
- # Build: vite build emits dist/client and dist/server/server.js. Both VITE_
14
- # values are public and inlined into the bundle, so they are build arguments.
13
+ # Build: vp build (Vite+) emits dist/client and dist/server/server.js. Both
14
+ # VITE_ values are public and inlined into the bundle, so they are build
15
+ # arguments.
15
16
  FROM deps AS build
16
17
  COPY . .
17
18
  ARG VITE_CONVEX_URL
18
19
  ARG VITE_HUB_URL
19
20
  RUN test -n "$VITE_CONVEX_URL" -a -n "$VITE_HUB_URL" || (echo "Pass --build-arg VITE_CONVEX_URL=… and --build-arg VITE_HUB_URL=…, or run just build" && exit 1)
20
21
  ENV NODE_ENV=production CI=1 VITE_CONVEX_URL=${VITE_CONVEX_URL} VITE_HUB_URL=${VITE_HUB_URL}
21
- RUN rm -rf dist .tanstack node_modules/.vite && bunx --bun vite build && bun run typecheck
22
+ RUN rm -rf dist .tanstack node_modules/.vite && bunx --bun vp build && bun run typecheck
22
23
 
23
24
  # Production dependencies only.
24
25
  FROM base AS prod-deps
@@ -11,7 +11,7 @@ A TanStack Start + Convex app with User Hub sign-in: people scan their badge and
11
11
  HUB_ADMIN_PASSWORD=…
12
12
  ```
13
13
 
14
- 2. `bun run setup`: creates your Convex project, registers the app with the hub and sets everything up. If another app already has this name in the hub, it asks you for a new one (or run `bun run setup --name <name>`). Safe to run again.
14
+ 2. `bun run setup`: creates your Convex project, registers the app with the hub and sets everything up. If another app already has this name in the hub, it asks you for a new one (or run `bun run setup --name <name>`). New apps show in the hub's badge app list once they have a production URL; `bun run setup --unlisted` keeps this one out and `--listed` puts it back. Safe to run again.
15
15
  3. `bun run dev`, then open http://localhost:3000. You are sent to the hub to pick who to be, then back signed in.
16
16
  4. Once the app is deployed: `bun run setup --prod https://your-app.example.com`, so badge scans can reach it. Setup asks for this the first time; press Enter to skip until you deploy.
17
17
 
@@ -22,7 +22,11 @@ The app ships as a Docker image served by Bun (`Dockerfile`, `server.ts`); it ne
22
22
  - `just build`: deploys the Convex functions to production, then builds the image against that deployment and loads it into Docker. Try it with `docker run -p 3000:3000 __APP_KEY__`.
23
23
  - `just push`: the same, built for servers (amd64) and pushed. Set your registry path first: `IMAGE=registry.example.com/team/__APP_KEY__ just push`, or edit `image` at the top of the `justfile`.
24
24
 
25
- Then serve the container (port 3000) at your production URL, make sure the hub knows that URL (`bun run setup --prod <url>`), and schedule the app in the hub or force it live.
25
+ Then serve the container (port 3000) at your production URL and make sure the hub knows that URL (`bun run setup --prod <url>`). Badge scans reach the app once it is scheduled or forced live in the hub, or straight away while badges go to the hub's app list, if the app is listed (new apps are).
26
+
27
+ ### Hub moved
28
+
29
+ Change `HUB_URL` in `.env.local` and run `bun run setup`: it updates this app's registration with the new hub and sets `HUB_ISSUER`, `HUB_JWKS` (on the production Convex deployment too, once it has a production URL) and `VITE_HUB_URL`. Then `just push`, because `VITE_HUB_URL` is built into the frontend.
26
30
 
27
31
  ## What's inside
28
32
 
@@ -33,6 +37,6 @@ Then serve the container (port 3000) at your production URL, make sure the hub k
33
37
 
34
38
  ## Commands
35
39
 
36
- `bun run dev`, `bun run check` (Biome), `bun run typecheck`, `bun run build`, `bun run start` (production server), `just build`, `just push`.
40
+ `bun run dev`, `bun run check` (Vite+: format, lint and type-check), `bun run fix` (the same, fixing what it can), `bun run typecheck`, `bun run build`, `bun run start` (production server), `just build`, `just push`.
37
41
 
38
42
  Coding agents: see `CLAUDE.md` and the `user-hub-auth` skill in `.claude/skills`.
@@ -1,5 +1,6 @@
1
1
  import { hubAuth } from "@user-hub/auth/convex";
2
2
  import type { AuthConfig } from "convex/server";
3
+
3
4
  import { APP_KEY } from "./hub";
4
5
 
5
6
  // Trusts tokens from User Hub. HUB_ISSUER and HUB_JWKS are set on this Convex
@@ -1,5 +1,6 @@
1
1
  import { getHubUser } from "@user-hub/auth/convex";
2
2
  import { v } from "convex/values";
3
+
3
4
  import { query } from "./_generated/server";
4
5
 
5
6
  // Who the server says is signed in: proof that Convex trusts the hub token.
@@ -1,4 +1,5 @@
1
1
  import { ConvexError } from "convex/values";
2
+
2
3
  import type { MutationCtx, QueryCtx } from "../_generated/server";
3
4
 
4
5
  const PAGE = 50;
@@ -1,5 +1,6 @@
1
1
  import { requireFacilitator, requireHubUser } from "@user-hub/auth/convex";
2
2
  import { v } from "convex/values";
3
+
3
4
  import { mutation, query } from "./_generated/server";
4
5
  import * as Notes from "./model/notes";
5
6
 
@@ -4,38 +4,44 @@
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "setup": "bun scripts/setup.ts",
7
- "dev": "convex dev --start \"vite dev --port 3000\"",
8
- "build": "vite build",
7
+ "dev": "convex dev --start \"vp dev --port 3000\"",
8
+ "build": "vp build",
9
9
  "start": "bun run server.ts",
10
- "check": "biome check",
10
+ "check": "vp check",
11
+ "fix": "vp check --fix",
12
+ "lint": "vp lint",
13
+ "fmt": "vp fmt",
11
14
  "typecheck": "tsc --noEmit -p . && tsc --noEmit -p convex"
12
15
  },
13
16
  "dependencies": {
14
- "@base-ui/react": "^1.8.0",
17
+ "@base-ui/react": "^1.9.0",
15
18
  "@fontsource-variable/oxanium": "^5.3.0",
16
19
  "@tailwindcss/vite": "^4.3.3",
17
- "@tanstack/react-router": "^1.170.41",
18
- "@tanstack/react-start": "^1.168.60",
19
- "@user-hub/auth": "^0.2.0",
20
+ "@tanstack/react-router": "^1.170.46",
21
+ "@tanstack/react-start": "^1.169.4",
22
+ "@user-hub/auth": "^0.2.1",
20
23
  "class-variance-authority": "^0.7.1",
21
- "cn": "^0.4.0",
22
- "convex": "^1.46.0",
23
- "lucide-react": "^1.49.0",
24
- "react": "^19.3.0",
25
- "react-dom": "^19.3.0",
26
- "shadcn": "^4.21.4",
24
+ "cn": "^0.5.0",
25
+ "convex": "^1.48.0",
26
+ "lucide-react": "^1.61.0",
27
+ "react": "^19.3.1",
28
+ "react-dom": "^19.3.1",
29
+ "shadcn": "^4.22.1",
27
30
  "tailwindcss": "^4.3.3",
28
31
  "tw-animate-css": "^1.4.0"
29
32
  },
30
33
  "devDependencies": {
31
- "@biomejs/biome": "2.5.15",
32
- "@rolldown/plugin-babel": "^0.2.4",
33
- "@types/bun": "^1.4.2",
34
+ "@types/bun": "^1.4.4",
34
35
  "@types/react": "^19.3.0",
35
36
  "@types/react-dom": "^19.3.0",
36
- "@vitejs/plugin-react": "^6.1.1",
37
- "babel-plugin-react-compiler": "^1.0.0",
37
+ "@vitejs/plugin-react": "^6.1.2",
38
+ "oxc-transform-react": "^0.155.0",
38
39
  "typescript": "^7.0.2",
39
- "vite": "^8.3.1"
40
+ "vite": "npm:@voidzero-dev/vite-plus-core@1.4.0",
41
+ "vite-plus": "1.4.0"
42
+ },
43
+ "overrides": {
44
+ "vite": "npm:@voidzero-dev/vite-plus-core@1.4.0",
45
+ "vitest": "5.0.5"
40
46
  }
41
47
  }
@@ -1,7 +1,10 @@
1
1
  // Setup: creates the Convex project, registers this app with User Hub and
2
2
  // sets the values that make Convex trust the hub's tokens.
3
- // Run: bun run setup [--name <name>] [--prod <url>]. Safe to run again; run
4
- // it with --prod once the app is deployed so badge scans can reach it.
3
+ // Run: bun run setup [--name <name>] [--prod <url>] [--listed|--unlisted].
4
+ // Safe to run again; run it with --prod once the app is deployed so badge
5
+ // scans can reach it. --unlisted keeps the app out of the hub's badge app list
6
+ // (new apps are listed), --listed puts it back; without either, the hub keeps
7
+ // the current setting.
5
8
  // Needs HUB_URL and HUB_ADMIN_PASSWORD in .env.local (Bun loads it).
6
9
 
7
10
  import { existsSync, renameSync } from "node:fs";
@@ -112,6 +115,11 @@ if (!prodUrl && !process.env.HUB_APP_PROD_URL && process.stdin.isTTY) {
112
115
  " Production URL, where badge scans send people (Enter to skip until you deploy):",
113
116
  )?.trim() || undefined;
114
117
  }
118
+ // Passed on to hub-user as is; without either the hub keeps its setting.
119
+ const listing = ["--listed", "--unlisted"].filter((arg) =>
120
+ process.argv.includes(arg),
121
+ );
122
+ if (listing.length > 1) fail("Pass --listed or --unlisted, not both.");
115
123
  let registered: Awaited<ReturnType<typeof run>>;
116
124
  for (;;) {
117
125
  registered = await run(
@@ -124,6 +132,7 @@ for (;;) {
124
132
  "--dev",
125
133
  DEV_URL,
126
134
  ...(prodUrl ? ["--prod", prodUrl] : []),
135
+ ...listing,
127
136
  "--json",
128
137
  ...(alreadyRegistered ? [] : ["--new"]),
129
138
  ],
@@ -145,15 +154,24 @@ if (!registered.ok) {
145
154
  : "The hub refused the registration; see the error above. Check HUB_URL and HUB_ADMIN_PASSWORD.",
146
155
  );
147
156
  }
148
- const { key, hubUrl, env } = JSON.parse(registered.output) as {
157
+ const { key, hubUrl, env, listed } = JSON.parse(registered.output) as {
149
158
  key: string;
150
159
  hubUrl: string;
151
160
  env: { HUB_ISSUER: string; HUB_JWKS: string };
161
+ // The stored setting; missing from hubs without the badge app list.
162
+ listed?: boolean;
152
163
  };
153
164
  await writeEnv("HUB_APP_NAME", appName);
154
165
  if (prodUrl) await writeEnv("HUB_APP_PROD_URL", prodUrl);
155
166
  const production = prodUrl ?? process.env.HUB_APP_PROD_URL;
156
167
  console.log(` Registered as "${appName}", app key: ${key}`);
168
+ if (listed !== undefined) {
169
+ console.log(
170
+ listed
171
+ ? ` Listed in the hub's badge app list${production ? "" : " once it has a production URL"} (bun run setup --unlisted hides it)`
172
+ : " Not in the hub's badge app list (bun run setup --listed adds it)",
173
+ );
174
+ }
157
175
 
158
176
  // The key follows the registered name; keep the code in step with it.
159
177
  const hubFile = await Bun.file(HUB_FILE).text();
@@ -195,7 +213,8 @@ if (!(await run(["bunx", "convex", "dev", "--once"])).ok) {
195
213
  const productionNote = production
196
214
  ? productionEnvSet
197
215
  ? `Production: ${production}. Badge scans reach it once the app is scheduled
198
- or forced live in the hub. Deploy Convex with: bunx convex deploy`
216
+ or forced live in the hub${listed ? ", or straight away while badges go to the app list" : ""}.
217
+ Deploy Convex with: bunx convex deploy`
199
218
  : `Production: ${production} is registered with the hub, but HUB_ISSUER
200
219
  and HUB_JWKS could not be set on the production Convex deployment (see the
201
220
  error above). Run bun run setup again before \`bunx convex deploy\`.`
@@ -1,4 +1,5 @@
1
1
  import { createRouter } from "@tanstack/react-router";
2
+
2
3
  import { routeTree } from "./routeTree.gen";
3
4
 
4
5
  export function getRouter() {
@@ -4,6 +4,7 @@ import {
4
4
  HubSignedIn,
5
5
  } from "@user-hub/auth/convex-react";
6
6
  import { ConvexReactClient } from "convex/react";
7
+
7
8
  import {
8
9
  Empty,
9
10
  EmptyDescription,
@@ -11,9 +12,11 @@ import {
11
12
  EmptyTitle,
12
13
  } from "@/components/ui/empty";
13
14
  import { Skeleton } from "@/components/ui/skeleton";
14
- import appCss from "@/styles.css?url";
15
+
15
16
  import { APP_KEY } from "../../convex/hub";
16
17
 
18
+ import appCss from "@/styles.css?url";
19
+
17
20
  const CONVEX_URL = import.meta.env.VITE_CONVEX_URL;
18
21
  if (!CONVEX_URL) {
19
22
  throw new Error("Missing VITE_CONVEX_URL: run `bun run setup` first");
@@ -2,6 +2,7 @@ import { createFileRoute, Link } from "@tanstack/react-router";
2
2
  import { useHubUser } from "@user-hub/auth/convex-react";
3
3
  import { useQuery } from "convex/react";
4
4
  import { ArrowLeftIcon } from "lucide-react";
5
+
5
6
  import { Button } from "@/components/ui/button";
6
7
  import {
7
8
  Card,
@@ -23,6 +24,7 @@ import {
23
24
  ItemGroup,
24
25
  ItemTitle,
25
26
  } from "@/components/ui/item";
27
+
26
28
  import { api } from "../../convex/_generated/api";
27
29
 
28
30
  export const Route = createFileRoute("/facilitator")({
@@ -3,6 +3,7 @@ import { useHubSignOut, useHubUser } from "@user-hub/auth/convex-react";
3
3
  import { useMutation, useQuery } from "convex/react";
4
4
  import { LogOutIcon, ShieldIcon } from "lucide-react";
5
5
  import { useState } from "react";
6
+
6
7
  import { Badge } from "@/components/ui/badge";
7
8
  import { Button } from "@/components/ui/button";
8
9
  import {
@@ -28,6 +29,7 @@ import {
28
29
  ItemGroup,
29
30
  ItemTitle,
30
31
  } from "@/components/ui/item";
32
+
31
33
  import { api } from "../../convex/_generated/api";
32
34
 
33
35
  export const Route = createFileRoute("/")({ component: Home });
@@ -1,15 +1,60 @@
1
- import babel from "@rolldown/plugin-babel";
2
1
  import tailwindcss from "@tailwindcss/vite";
3
2
  import { tanstackStart } from "@tanstack/react-start/plugin/vite";
4
- import viteReact, { reactCompilerPreset } from "@vitejs/plugin-react";
5
- import { defineConfig } from "vite";
3
+ import viteReact from "@vitejs/plugin-react";
4
+ import { defineConfig, lazyPlugins } from "vite-plus";
5
+
6
+ // Generated, vendored or not ours to touch. Markdown is left exactly as
7
+ // written.
8
+ const ignorePatterns = [
9
+ "**/*.md",
10
+ ".agents/**",
11
+ ".claude/**",
12
+ "dist/**",
13
+ ".tanstack/**",
14
+ "src/routeTree.gen.ts",
15
+ "src/components/ui/**",
16
+ "convex/_generated/**",
17
+ ];
6
18
 
7
19
  export default defineConfig({
8
20
  resolve: { tsconfigPaths: true },
9
- plugins: [
21
+ plugins: lazyPlugins(() => [
10
22
  tailwindcss(),
11
23
  tanstackStart(),
12
- viteReact(),
13
- babel({ presets: [reactCompilerPreset()] }),
14
- ],
24
+ // React Compiler, natively (oxc-transform-react) rather than through Babel.
25
+ viteReact({ compiler: true }),
26
+ ]),
27
+ // `vp check`: format (Oxfmt), lint (Oxlint) and type-check (tsgolint).
28
+ lint: {
29
+ plugins: ["eslint", "typescript", "unicorn", "oxc"],
30
+ categories: {
31
+ correctness: "error",
32
+ },
33
+ env: {
34
+ builtin: true,
35
+ },
36
+ ignorePatterns,
37
+ options: {
38
+ typeAware: true,
39
+ typeCheck: true,
40
+ },
41
+ overrides: [
42
+ {
43
+ files: ["src/**"],
44
+ plugins: ["react", "jsx-a11y"],
45
+ env: {
46
+ browser: true,
47
+ },
48
+ },
49
+ ],
50
+ },
51
+ fmt: {
52
+ printWidth: 80,
53
+ ignorePatterns,
54
+ sortImports: true,
55
+ sortTailwindcss: {
56
+ stylesheet: "./src/styles.css",
57
+ functions: ["cn", "cva"],
58
+ },
59
+ },
15
60
  });
@@ -1,46 +0,0 @@
1
- {
2
- "$schema": "https://biomejs.dev/schemas/2.5.15/schema.json",
3
- "vcs": {
4
- "enabled": true,
5
- "clientKind": "git",
6
- "useIgnoreFile": true
7
- },
8
- "files": {
9
- "ignoreUnknown": false,
10
- "includes": [
11
- "**",
12
- "!**/src/routeTree.gen.ts",
13
- "!**/convex/_generated",
14
- "!**/.claude",
15
- "!**/.agents"
16
- ]
17
- },
18
- "formatter": {
19
- "enabled": true,
20
- "indentStyle": "space",
21
- "indentWidth": 2
22
- },
23
- "assist": { "actions": { "source": { "organizeImports": "on" } } },
24
- "linter": {
25
- "enabled": true,
26
- "rules": {
27
- "preset": "recommended"
28
- }
29
- },
30
- "javascript": {
31
- "formatter": {
32
- "quoteStyle": "double"
33
- }
34
- },
35
- "css": {
36
- "parser": {
37
- "tailwindDirectives": true
38
- }
39
- },
40
- "overrides": [
41
- {
42
- "includes": ["src/components/ui/**"],
43
- "linter": { "enabled": false }
44
- }
45
- ]
46
- }