@reliverse/dler 1.7.152 → 2.0.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/cli.js +1316 -0
- package/package.json +21 -144
- package/LICENSE +0 -21
- package/LICENSES +0 -22
- package/README.md +0 -36
- package/bin/impl/add/add-global/install-impl.d.ts +0 -38
- package/bin/impl/add/add-global/install-impl.js +0 -254
- package/bin/impl/add/add-global/install-mod.d.ts +0 -0
- package/bin/impl/add/add-global/install-mod.js +0 -0
- package/bin/impl/add/add-local/api/orpc.d.ts +0 -1
- package/bin/impl/add/add-local/api/orpc.js +0 -4
- package/bin/impl/add/add-local/api/trpc.d.ts +0 -1
- package/bin/impl/add/add-local/api/trpc.js +0 -4
- package/bin/impl/add/add-local/auth/better-auth.d.ts +0 -1
- package/bin/impl/add/add-local/auth/better-auth.js +0 -4
- package/bin/impl/add/add-local/auth/clerk-auth.d.ts +0 -1
- package/bin/impl/add/add-local/auth/clerk-auth.js +0 -4
- package/bin/impl/add/add-local/auth/next-auth.d.ts +0 -1
- package/bin/impl/add/add-local/auth/next-auth.js +0 -4
- package/bin/impl/add/add-local/core/deps.d.ts +0 -8
- package/bin/impl/add/add-local/core/deps.js +0 -19
- package/bin/impl/add/add-local/core/prompts.d.ts +0 -4
- package/bin/impl/add/add-local/core/prompts.js +0 -12
- package/bin/impl/add/add-local/core/templates.d.ts +0 -29
- package/bin/impl/add/add-local/core/templates.js +0 -85
- package/bin/impl/add/add-local/core/types.d.ts +0 -6
- package/bin/impl/add/add-local/core/types.js +0 -0
- package/bin/impl/add/add-local/db/drizzle.d.ts +0 -1
- package/bin/impl/add/add-local/db/drizzle.js +0 -4
- package/bin/impl/add/add-local/db/prisma.d.ts +0 -1
- package/bin/impl/add/add-local/db/prisma.js +0 -4
- package/bin/impl/add/add-local/files/uploadthing.d.ts +0 -1
- package/bin/impl/add/add-local/files/uploadthing.js +0 -4
- package/bin/impl/add/add-local/form/react-hook-form.d.ts +0 -1
- package/bin/impl/add/add-local/form/react-hook-form.js +0 -4
- package/bin/impl/add/add-local/form/tanstack-form.d.ts +0 -1
- package/bin/impl/add/add-local/form/tanstack-form.js +0 -4
- package/bin/impl/add/add-local/fws/browser/plasmo.d.ts +0 -1
- package/bin/impl/add/add-local/fws/browser/plasmo.js +0 -4
- package/bin/impl/add/add-local/fws/browser/wxt.d.ts +0 -1
- package/bin/impl/add/add-local/fws/browser/wxt.js +0 -4
- package/bin/impl/add/add-local/fws/configs/eslint-config.d.ts +0 -1
- package/bin/impl/add/add-local/fws/configs/eslint-config.js +0 -4
- package/bin/impl/add/add-local/fws/native/lynx.d.ts +0 -1
- package/bin/impl/add/add-local/fws/native/lynx.js +0 -4
- package/bin/impl/add/add-local/fws/native/react.d.ts +0 -1
- package/bin/impl/add/add-local/fws/native/react.js +0 -4
- package/bin/impl/add/add-local/fws/plugins/eslint-plugin.d.ts +0 -1
- package/bin/impl/add/add-local/fws/plugins/eslint-plugin.js +0 -4
- package/bin/impl/add/add-local/fws/vscode/vscode-ext.d.ts +0 -1
- package/bin/impl/add/add-local/fws/vscode/vscode-ext.js +0 -4
- package/bin/impl/add/add-local/fws/web/astro.d.ts +0 -1
- package/bin/impl/add/add-local/fws/web/astro.js +0 -4
- package/bin/impl/add/add-local/fws/web/jstack.d.ts +0 -1
- package/bin/impl/add/add-local/fws/web/jstack.js +0 -4
- package/bin/impl/add/add-local/fws/web/next.d.ts +0 -1
- package/bin/impl/add/add-local/fws/web/next.js +0 -4
- package/bin/impl/add/add-local/fws/web/start.d.ts +0 -1
- package/bin/impl/add/add-local/fws/web/start.js +0 -4
- package/bin/impl/add/add-local/fws/web/vite.d.ts +0 -1
- package/bin/impl/add/add-local/fws/web/vite.js +0 -4
- package/bin/impl/add/add-local/i18n/gt-libs.d.ts +0 -1
- package/bin/impl/add/add-local/i18n/gt-libs.js +0 -4
- package/bin/impl/add/add-local/i18n/languine.d.ts +0 -1
- package/bin/impl/add/add-local/i18n/languine.js +0 -19
- package/bin/impl/add/add-local/i18n/next-intl.d.ts +0 -1
- package/bin/impl/add/add-local/i18n/next-intl.js +0 -4
- package/bin/impl/add/add-local/llm/vercel.d.ts +0 -1
- package/bin/impl/add/add-local/llm/vercel.js +0 -4
- package/bin/impl/add/add-local/mail/resend.d.ts +0 -1
- package/bin/impl/add/add-local/mail/resend.js +0 -4
- package/bin/impl/add/add-local/pay/polar.d.ts +0 -1
- package/bin/impl/add/add-local/pay/polar.js +0 -4
- package/bin/impl/add/add-local/pay/stripe.d.ts +0 -1
- package/bin/impl/add/add-local/pay/stripe.js +0 -4
- package/bin/impl/add/add-local/tool/biome.d.ts +0 -1
- package/bin/impl/add/add-local/tool/biome.js +0 -4
- package/bin/impl/add/add-local/tool/eslint.d.ts +0 -1
- package/bin/impl/add/add-local/tool/eslint.js +0 -4
- package/bin/impl/add/add-local/tool/oxlint.d.ts +0 -4
- package/bin/impl/add/add-local/tool/oxlint.js +0 -4
- package/bin/impl/add/add-local/ui/21st.d.ts +0 -4
- package/bin/impl/add/add-local/ui/21st.js +0 -4
- package/bin/impl/add/add-local/ui/shadcn.d.ts +0 -1
- package/bin/impl/add/add-local/ui/shadcn.js +0 -4
- package/bin/impl/add/add-local/ui/tailwind.d.ts +0 -1
- package/bin/impl/add/add-local/ui/tailwind.js +0 -4
- package/bin/impl/add/add-rule/add-rule-const.d.ts +0 -11
- package/bin/impl/add/add-rule/add-rule-const.js +0 -32
- package/bin/impl/add/add-rule/add-rule-impl.d.ts +0 -21
- package/bin/impl/add/add-rule/add-rule-impl.js +0 -300
- package/bin/impl/add/add-rule/add-rule-types.d.ts +0 -18
- package/bin/impl/add/add-rule/add-rule-types.js +0 -0
- package/bin/impl/add/add-rule/add-rule-utils.d.ts +0 -61
- package/bin/impl/add/add-rule/add-rule-utils.js +0 -324
- package/bin/impl/ai/ai-impl/ai-auth.d.ts +0 -10
- package/bin/impl/ai/ai-impl/ai-auth.js +0 -59
- package/bin/impl/ai/ai-impl/ai-chat.d.ts +0 -5
- package/bin/impl/ai/ai-impl/ai-chat.js +0 -93
- package/bin/impl/ai/ai-impl/ai-const.d.ts +0 -7
- package/bin/impl/ai/ai-impl/ai-const.js +0 -14
- package/bin/impl/ai/ai-impl/ai-tools.d.ts +0 -5
- package/bin/impl/ai/ai-impl/ai-tools.js +0 -32
- package/bin/impl/ai/ai-impl/ai-types.d.ts +0 -12
- package/bin/impl/ai/ai-impl/ai-types.js +0 -0
- package/bin/impl/ai/ai-impl/code/code-mod.d.ts +0 -6
- package/bin/impl/ai/ai-impl/code/code-mod.js +0 -164
- package/bin/impl/ai/ai-impl/mcp/mcp-mod.d.ts +0 -5
- package/bin/impl/ai/ai-impl/mcp/mcp-mod.js +0 -125
- package/bin/impl/ai/ai-impl/relinter/relinter.d.ts +0 -27
- package/bin/impl/ai/ai-impl/relinter/relinter.js +0 -309
- package/bin/impl/ai/ai-menu.d.ts +0 -3
- package/bin/impl/ai/ai-menu.js +0 -40
- package/bin/impl/auth/consts.d.ts +0 -2
- package/bin/impl/auth/consts.js +0 -2
- package/bin/impl/auth/generators/auth-config.d.ts +0 -32
- package/bin/impl/auth/generators/auth-config.js +0 -533
- package/bin/impl/auth/generators/drizzle.d.ts +0 -3
- package/bin/impl/auth/generators/drizzle.js +0 -137
- package/bin/impl/auth/generators/index.d.ts +0 -16
- package/bin/impl/auth/generators/index.js +0 -18
- package/bin/impl/auth/generators/kysely.d.ts +0 -2
- package/bin/impl/auth/generators/kysely.js +0 -9
- package/bin/impl/auth/generators/prisma.d.ts +0 -2
- package/bin/impl/auth/generators/prisma.js +0 -154
- package/bin/impl/auth/generators/types.d.ts +0 -11
- package/bin/impl/auth/generators/types.js +0 -0
- package/bin/impl/auth/impl/init.d.ts +0 -183
- package/bin/impl/auth/impl/init.js +0 -367
- package/bin/impl/auth/impl/migrate.d.ts +0 -6
- package/bin/impl/auth/impl/migrate.js +0 -90
- package/bin/impl/auth/impl/types.d.ts +0 -12
- package/bin/impl/auth/impl/types.js +0 -0
- package/bin/impl/auth/utils/add-svelte-kit-env-modules.d.ts +0 -3
- package/bin/impl/auth/utils/add-svelte-kit-env-modules.js +0 -91
- package/bin/impl/auth/utils/check-package-managers.d.ts +0 -4
- package/bin/impl/auth/utils/check-package-managers.js +0 -20
- package/bin/impl/auth/utils/format-ms.d.ts +0 -4
- package/bin/impl/auth/utils/format-ms.js +0 -11
- package/bin/impl/auth/utils/generate-secret.d.ts +0 -1
- package/bin/impl/auth/utils/generate-secret.js +0 -2
- package/bin/impl/auth/utils/get-config.d.ts +0 -8
- package/bin/impl/auth/utils/get-config.js +0 -169
- package/bin/impl/auth/utils/get-package-info.d.ts +0 -1
- package/bin/impl/auth/utils/get-package-info.js +0 -6
- package/bin/impl/auth/utils/get-tsconfig-info.d.ts +0 -2
- package/bin/impl/auth/utils/get-tsconfig-info.js +0 -15
- package/bin/impl/auth/utils/install-dependencies.d.ts +0 -5
- package/bin/impl/auth/utils/install-dependencies.js +0 -34
- package/bin/impl/build/binary-flow.d.ts +0 -6
- package/bin/impl/build/binary-flow.js +0 -173
- package/bin/impl/build/build-library.d.ts +0 -42
- package/bin/impl/build/build-library.js +0 -626
- package/bin/impl/build/build-regular.d.ts +0 -20
- package/bin/impl/build/build-regular.js +0 -398
- package/bin/impl/build/impl.d.ts +0 -19
- package/bin/impl/build/impl.js +0 -104
- package/bin/impl/build/library-flow.d.ts +0 -26
- package/bin/impl/build/library-flow.js +0 -252
- package/bin/impl/build/postbuild.d.ts +0 -3
- package/bin/impl/build/postbuild.js +0 -173
- package/bin/impl/build/ppb-utils.d.ts +0 -16
- package/bin/impl/build/ppb-utils.js +0 -99
- package/bin/impl/build/prebuild.d.ts +0 -2
- package/bin/impl/build/prebuild.js +0 -108
- package/bin/impl/build/providers/auto.d.ts +0 -3
- package/bin/impl/build/providers/auto.js +0 -105
- package/bin/impl/build/providers/build.d.ts +0 -8
- package/bin/impl/build/providers/build.js +0 -351
- package/bin/impl/build/providers/bun/bun-build.d.ts +0 -0
- package/bin/impl/build/providers/bun/bun-build.js +0 -0
- package/bin/impl/build/providers/bun/single-file.d.ts +0 -25
- package/bin/impl/build/providers/bun/single-file.js +0 -146
- package/bin/impl/build/providers/copy/copy-mod.d.ts +0 -2
- package/bin/impl/build/providers/copy/copy-mod.js +0 -49
- package/bin/impl/build/providers/mkdist/mkdist-impl/loader.d.ts +0 -4
- package/bin/impl/build/providers/mkdist/mkdist-impl/loader.js +0 -26
- package/bin/impl/build/providers/mkdist/mkdist-impl/loaders/js.d.ts +0 -2
- package/bin/impl/build/providers/mkdist/mkdist-impl/loaders/js.js +0 -50
- package/bin/impl/build/providers/mkdist/mkdist-impl/loaders/loaders-mod.d.ts +0 -12
- package/bin/impl/build/providers/mkdist/mkdist-impl/loaders/loaders-mod.js +0 -30
- package/bin/impl/build/providers/mkdist/mkdist-impl/loaders/postcss.d.ts +0 -3
- package/bin/impl/build/providers/mkdist/mkdist-impl/loaders/postcss.js +0 -28
- package/bin/impl/build/providers/mkdist/mkdist-impl/loaders/sass.d.ts +0 -2
- package/bin/impl/build/providers/mkdist/mkdist-impl/loaders/sass.js +0 -31
- package/bin/impl/build/providers/mkdist/mkdist-impl/loaders/vue.d.ts +0 -17
- package/bin/impl/build/providers/mkdist/mkdist-impl/loaders/vue.js +0 -145
- package/bin/impl/build/providers/mkdist/mkdist-impl/make.d.ts +0 -11
- package/bin/impl/build/providers/mkdist/mkdist-impl/make.js +0 -192
- package/bin/impl/build/providers/mkdist/mkdist-impl/utils/dts.d.ts +0 -11
- package/bin/impl/build/providers/mkdist/mkdist-impl/utils/dts.js +0 -94
- package/bin/impl/build/providers/mkdist/mkdist-impl/utils/fs.d.ts +0 -1
- package/bin/impl/build/providers/mkdist/mkdist-impl/utils/fs.js +0 -15
- package/bin/impl/build/providers/mkdist/mkdist-impl/utils/vue-dts.d.ts +0 -3
- package/bin/impl/build/providers/mkdist/mkdist-impl/utils/vue-dts.js +0 -175
- package/bin/impl/build/providers/mkdist/mkdist-mod.d.ts +0 -2
- package/bin/impl/build/providers/mkdist/mkdist-mod.js +0 -92
- package/bin/impl/build/providers/rollup/build.d.ts +0 -2
- package/bin/impl/build/providers/rollup/build.js +0 -100
- package/bin/impl/build/providers/rollup/config.d.ts +0 -2
- package/bin/impl/build/providers/rollup/config.js +0 -112
- package/bin/impl/build/providers/rollup/plugins/cjs.d.ts +0 -4
- package/bin/impl/build/providers/rollup/plugins/cjs.js +0 -47
- package/bin/impl/build/providers/rollup/plugins/esbuild.d.ts +0 -3
- package/bin/impl/build/providers/rollup/plugins/esbuild.js +0 -91
- package/bin/impl/build/providers/rollup/plugins/json.d.ts +0 -3
- package/bin/impl/build/providers/rollup/plugins/json.js +0 -17
- package/bin/impl/build/providers/rollup/plugins/raw.d.ts +0 -8
- package/bin/impl/build/providers/rollup/plugins/raw.js +0 -20
- package/bin/impl/build/providers/rollup/plugins/shebang.d.ts +0 -5
- package/bin/impl/build/providers/rollup/plugins/shebang.js +0 -42
- package/bin/impl/build/providers/rollup/stub.d.ts +0 -2
- package/bin/impl/build/providers/rollup/stub.js +0 -125
- package/bin/impl/build/providers/rollup/utils.d.ts +0 -5
- package/bin/impl/build/providers/rollup/utils.js +0 -38
- package/bin/impl/build/providers/rollup/watch.d.ts +0 -2
- package/bin/impl/build/providers/rollup/watch.js +0 -30
- package/bin/impl/build/providers/untyped/untyped-mod.d.ts +0 -2
- package/bin/impl/build/providers/untyped/untyped-mod.js +0 -111
- package/bin/impl/build/providers/utils.d.ts +0 -19
- package/bin/impl/build/providers/utils.js +0 -148
- package/bin/impl/build/providers/validate.d.ts +0 -4
- package/bin/impl/build/providers/validate.js +0 -52
- package/bin/impl/build/regular-flow.d.ts +0 -10
- package/bin/impl/build/regular-flow.js +0 -246
- package/bin/impl/clone/firecrawl/firecrawl-mod.d.ts +0 -1
- package/bin/impl/clone/firecrawl/firecrawl-mod.js +0 -11
- package/bin/impl/cmod/cmod-impl.d.ts +0 -9
- package/bin/impl/cmod/cmod-impl.js +0 -21
- package/bin/impl/config/biome.d.ts +0 -2
- package/bin/impl/config/biome.js +0 -34
- package/bin/impl/config/comments.d.ts +0 -1
- package/bin/impl/config/comments.js +0 -57
- package/bin/impl/config/constants.d.ts +0 -45
- package/bin/impl/config/constants.js +0 -60
- package/bin/impl/config/content.d.ts +0 -14
- package/bin/impl/config/content.js +0 -15
- package/bin/impl/config/core.d.ts +0 -14
- package/bin/impl/config/core.js +0 -79
- package/bin/impl/config/create.d.ts +0 -35
- package/bin/impl/config/create.js +0 -274
- package/bin/impl/config/def-utils.d.ts +0 -6
- package/bin/impl/config/def-utils.js +0 -227
- package/bin/impl/config/detect.d.ts +0 -24
- package/bin/impl/config/detect.js +0 -371
- package/bin/impl/config/gen-cfg.d.ts +0 -3
- package/bin/impl/config/gen-cfg.js +0 -180
- package/bin/impl/config/load.d.ts +0 -15
- package/bin/impl/config/load.js +0 -87
- package/bin/impl/config/migrate.d.ts +0 -5
- package/bin/impl/config/migrate.js +0 -60
- package/bin/impl/config/path.d.ts +0 -11
- package/bin/impl/config/path.js +0 -28
- package/bin/impl/config/prepare.d.ts +0 -3
- package/bin/impl/config/prepare.js +0 -832
- package/bin/impl/config/prompts.d.ts +0 -5
- package/bin/impl/config/prompts.js +0 -12
- package/bin/impl/config/read.d.ts +0 -11
- package/bin/impl/config/read.js +0 -62
- package/bin/impl/config/repair.d.ts +0 -15
- package/bin/impl/config/repair.js +0 -101
- package/bin/impl/config/unstable.d.ts +0 -11
- package/bin/impl/config/unstable.js +0 -29
- package/bin/impl/config/update.d.ts +0 -10
- package/bin/impl/config/update.js +0 -145
- package/bin/impl/config/utils.d.ts +0 -17
- package/bin/impl/config/utils.js +0 -85
- package/bin/impl/conv/mod.d.ts +0 -26
- package/bin/impl/conv/mod.js +0 -193
- package/bin/impl/db/client.d.ts +0 -4
- package/bin/impl/db/client.js +0 -32
- package/bin/impl/db/config.d.ts +0 -2
- package/bin/impl/db/config.js +0 -59
- package/bin/impl/db/messages.d.ts +0 -13
- package/bin/impl/db/messages.js +0 -81
- package/bin/impl/db/schema.d.ts +0 -90
- package/bin/impl/db/schema.js +0 -9
- package/bin/impl/env/env-impl.d.ts +0 -1
- package/bin/impl/env/env-impl.js +0 -28
- package/bin/impl/get/get-core.d.ts +0 -3
- package/bin/impl/get/get-core.js +0 -453
- package/bin/impl/init/init-utils/init-impl.d.ts +0 -6
- package/bin/impl/init/init-utils/init-impl.js +0 -31
- package/bin/impl/init/init-utils/init-utils.d.ts +0 -35
- package/bin/impl/init/init-utils/init-utils.js +0 -255
- package/bin/impl/init/init-utils/mm-deprecated/editor-menu.d.ts +0 -4
- package/bin/impl/init/init-utils/mm-deprecated/editor-menu.js +0 -400
- package/bin/impl/init/mm-deprecated/drizzle/manageDrizzleConstants.d.ts +0 -2
- package/bin/impl/init/mm-deprecated/drizzle/manageDrizzleConstants.js +0 -36
- package/bin/impl/init/mm-deprecated/drizzle/manageDrizzleSchema.d.ts +0 -1
- package/bin/impl/init/mm-deprecated/drizzle/manageDrizzleSchema.js +0 -81
- package/bin/impl/init/mm-deprecated/drizzle/manageDrizzleSchemaUtils.d.ts +0 -16
- package/bin/impl/init/mm-deprecated/drizzle/manageDrizzleSchemaUtils.js +0 -474
- package/bin/impl/init/mm-deprecated/editor-impl.d.ts +0 -1
- package/bin/impl/init/mm-deprecated/editor-impl.js +0 -153
- package/bin/impl/init/mm-deprecated/editor-mod.d.ts +0 -18
- package/bin/impl/init/mm-deprecated/editor-mod.js +0 -184
- package/bin/impl/init/mm-deprecated/feature-add.d.ts +0 -2
- package/bin/impl/init/mm-deprecated/feature-add.js +0 -591
- package/bin/impl/init/mm-deprecated/feature-rm.d.ts +0 -2
- package/bin/impl/init/mm-deprecated/feature-rm.js +0 -98
- package/bin/impl/init/mm-deprecated/shadcn/shadcn-mod.d.ts +0 -1
- package/bin/impl/init/mm-deprecated/shadcn/shadcn-mod.js +0 -87
- package/bin/impl/init/use-template/cp-impl.d.ts +0 -39
- package/bin/impl/init/use-template/cp-impl.js +0 -286
- package/bin/impl/init/use-template/cp-mod.d.ts +0 -31
- package/bin/impl/init/use-template/cp-mod.js +0 -233
- package/bin/impl/init/use-template/cp-modules/cli-main-modules/cli-menu-items/showCloneProjectMenu.d.ts +0 -11
- package/bin/impl/init/use-template/cp-modules/cli-main-modules/cli-menu-items/showCloneProjectMenu.js +0 -206
- package/bin/impl/init/use-template/cp-modules/cli-main-modules/modules/showAnykeyPrompt.d.ts +0 -1
- package/bin/impl/init/use-template/cp-modules/cli-main-modules/modules/showAnykeyPrompt.js +0 -9
- package/bin/impl/init/use-template/cp-modules/compose-env-file/cef-impl.d.ts +0 -16
- package/bin/impl/init/use-template/cp-modules/compose-env-file/cef-impl.js +0 -400
- package/bin/impl/init/use-template/cp-modules/compose-env-file/cef-keys.d.ts +0 -17
- package/bin/impl/init/use-template/cp-modules/compose-env-file/cef-keys.js +0 -142
- package/bin/impl/init/use-template/cp-modules/compose-env-file/cef-mod.d.ts +0 -2
- package/bin/impl/init/use-template/cp-modules/compose-env-file/cef-mod.js +0 -167
- package/bin/impl/init/use-template/cp-modules/git-deploy-prompts/deploy.d.ts +0 -12
- package/bin/impl/init/use-template/cp-modules/git-deploy-prompts/deploy.js +0 -91
- package/bin/impl/init/use-template/cp-modules/git-deploy-prompts/gdp-mod.d.ts +0 -55
- package/bin/impl/init/use-template/cp-modules/git-deploy-prompts/gdp-mod.js +0 -449
- package/bin/impl/init/use-template/cp-modules/git-deploy-prompts/git.d.ts +0 -51
- package/bin/impl/init/use-template/cp-modules/git-deploy-prompts/git.js +0 -311
- package/bin/impl/init/use-template/cp-modules/git-deploy-prompts/github.d.ts +0 -8
- package/bin/impl/init/use-template/cp-modules/git-deploy-prompts/github.js +0 -113
- package/bin/impl/init/use-template/cp-modules/git-deploy-prompts/helpers/domainHelpers.d.ts +0 -1
- package/bin/impl/init/use-template/cp-modules/git-deploy-prompts/helpers/domainHelpers.js +0 -25
- package/bin/impl/init/use-template/cp-modules/git-deploy-prompts/helpers/handlePkgJsonScripts.d.ts +0 -1
- package/bin/impl/init/use-template/cp-modules/git-deploy-prompts/helpers/handlePkgJsonScripts.js +0 -52
- package/bin/impl/init/use-template/cp-modules/git-deploy-prompts/helpers/promptForDomain.d.ts +0 -4
- package/bin/impl/init/use-template/cp-modules/git-deploy-prompts/helpers/promptForDomain.js +0 -39
- package/bin/impl/init/use-template/cp-modules/git-deploy-prompts/utils-git-github.d.ts +0 -8
- package/bin/impl/init/use-template/cp-modules/git-deploy-prompts/utils-git-github.js +0 -75
- package/bin/impl/init/use-template/cp-modules/git-deploy-prompts/utils-private-repo.d.ts +0 -12
- package/bin/impl/init/use-template/cp-modules/git-deploy-prompts/utils-private-repo.js +0 -168
- package/bin/impl/init/use-template/cp-modules/git-deploy-prompts/utils-repo-exists.d.ts +0 -10
- package/bin/impl/init/use-template/cp-modules/git-deploy-prompts/utils-repo-exists.js +0 -62
- package/bin/impl/init/use-template/cp-modules/git-deploy-prompts/vercel/vercel-api.d.ts +0 -10
- package/bin/impl/init/use-template/cp-modules/git-deploy-prompts/vercel/vercel-api.js +0 -36
- package/bin/impl/init/use-template/cp-modules/git-deploy-prompts/vercel/vercel-check.d.ts +0 -14
- package/bin/impl/init/use-template/cp-modules/git-deploy-prompts/vercel/vercel-check.js +0 -29
- package/bin/impl/init/use-template/cp-modules/git-deploy-prompts/vercel/vercel-config.d.ts +0 -27
- package/bin/impl/init/use-template/cp-modules/git-deploy-prompts/vercel/vercel-config.js +0 -104
- package/bin/impl/init/use-template/cp-modules/git-deploy-prompts/vercel/vercel-create.d.ts +0 -17
- package/bin/impl/init/use-template/cp-modules/git-deploy-prompts/vercel/vercel-create.js +0 -129
- package/bin/impl/init/use-template/cp-modules/git-deploy-prompts/vercel/vercel-deploy.d.ts +0 -20
- package/bin/impl/init/use-template/cp-modules/git-deploy-prompts/vercel/vercel-deploy.js +0 -151
- package/bin/impl/init/use-template/cp-modules/git-deploy-prompts/vercel/vercel-domain.d.ts +0 -5
- package/bin/impl/init/use-template/cp-modules/git-deploy-prompts/vercel/vercel-domain.js +0 -44
- package/bin/impl/init/use-template/cp-modules/git-deploy-prompts/vercel/vercel-env.d.ts +0 -3
- package/bin/impl/init/use-template/cp-modules/git-deploy-prompts/vercel/vercel-env.js +0 -58
- package/bin/impl/init/use-template/cp-modules/git-deploy-prompts/vercel/vercel-team.d.ts +0 -15
- package/bin/impl/init/use-template/cp-modules/git-deploy-prompts/vercel/vercel-team.js +0 -74
- package/bin/impl/init/use-template/cp-modules/git-deploy-prompts/vercel/vercel-types.d.ts +0 -28
- package/bin/impl/init/use-template/cp-modules/git-deploy-prompts/vercel/vercel-types.js +0 -0
- package/bin/impl/init/use-template/cp-modules/git-deploy-prompts/vercel/vercel-utils.d.ts +0 -26
- package/bin/impl/init/use-template/cp-modules/git-deploy-prompts/vercel/vercel-utils.js +0 -134
- package/bin/impl/inject/inject-impl-mod.d.ts +0 -112
- package/bin/impl/inject/inject-impl-mod.js +0 -716
- package/bin/impl/invoke/mod.d.ts +0 -59
- package/bin/impl/invoke/mod.js +0 -353
- package/bin/impl/login/login-impl.d.ts +0 -6
- package/bin/impl/login/login-impl.js +0 -179
- package/bin/impl/logout/logout-impl.d.ts +0 -1
- package/bin/impl/logout/logout-impl.js +0 -20
- package/bin/impl/magic/magic-apply.d.ts +0 -88
- package/bin/impl/magic/magic-apply.js +0 -669
- package/bin/impl/magic/magic-spells.d.ts +0 -46
- package/bin/impl/magic/magic-spells.js +0 -144
- package/bin/impl/merge/mod.d.ts +0 -8
- package/bin/impl/merge/mod.js +0 -160
- package/bin/impl/migrate/codemods/anything-bun.d.ts +0 -5
- package/bin/impl/migrate/codemods/anything-bun.js +0 -577
- package/bin/impl/migrate/codemods/commander-rempts.d.ts +0 -4
- package/bin/impl/migrate/codemods/commander-rempts.js +0 -250
- package/bin/impl/migrate/codemods/console-relinka.d.ts +0 -3
- package/bin/impl/migrate/codemods/console-relinka.js +0 -142
- package/bin/impl/migrate/codemods/fs-relifso.d.ts +0 -8
- package/bin/impl/migrate/codemods/fs-relifso.js +0 -156
- package/bin/impl/migrate/codemods/monorepo-catalog.d.ts +0 -96
- package/bin/impl/migrate/codemods/monorepo-catalog.js +0 -517
- package/bin/impl/migrate/codemods/nodenext-bundler.d.ts +0 -10
- package/bin/impl/migrate/codemods/nodenext-bundler.js +0 -222
- package/bin/impl/migrate/codemods/path-pathkit.d.ts +0 -8
- package/bin/impl/migrate/codemods/path-pathkit.js +0 -143
- package/bin/impl/migrate/codemods/readdir-glob.d.ts +0 -8
- package/bin/impl/migrate/codemods/readdir-glob.js +0 -133
- package/bin/impl/monorepo/cache-mod.d.ts +0 -29
- package/bin/impl/monorepo/cache-mod.js +0 -61
- package/bin/impl/monorepo/commands-mod.d.ts +0 -24
- package/bin/impl/monorepo/commands-mod.js +0 -159
- package/bin/impl/monorepo/graph-mod.d.ts +0 -29
- package/bin/impl/monorepo/graph-mod.js +0 -106
- package/bin/impl/monorepo/mod.d.ts +0 -5
- package/bin/impl/monorepo/mod.js +0 -5
- package/bin/impl/monorepo/monorepo-mod.d.ts +0 -26
- package/bin/impl/monorepo/monorepo-mod.js +0 -152
- package/bin/impl/mrse/mrse-impl.d.ts +0 -53
- package/bin/impl/mrse/mrse-impl.js +0 -132
- package/bin/impl/pack/mod.d.ts +0 -43
- package/bin/impl/pack/mod.js +0 -200
- package/bin/impl/providers/better-t-stack/better-t-stack-mod.d.ts +0 -14
- package/bin/impl/providers/better-t-stack/better-t-stack-mod.js +0 -35
- package/bin/impl/providers/better-t-stack/better-t-stack-types.d.ts +0 -21
- package/bin/impl/providers/better-t-stack/better-t-stack-types.js +0 -0
- package/bin/impl/providers/better-t-stack/constants.d.ts +0 -61
- package/bin/impl/providers/better-t-stack/constants.js +0 -81
- package/bin/impl/providers/better-t-stack/helpers/database-providers/mongodb-atlas-setup.d.ts +0 -2
- package/bin/impl/providers/better-t-stack/helpers/database-providers/mongodb-atlas-setup.js +0 -133
- package/bin/impl/providers/better-t-stack/helpers/database-providers/neon-setup.d.ts +0 -2
- package/bin/impl/providers/better-t-stack/helpers/database-providers/neon-setup.js +0 -168
- package/bin/impl/providers/better-t-stack/helpers/database-providers/prisma-postgres-setup.d.ts +0 -2
- package/bin/impl/providers/better-t-stack/helpers/database-providers/prisma-postgres-setup.js +0 -161
- package/bin/impl/providers/better-t-stack/helpers/database-providers/supabase-setup.d.ts +0 -2
- package/bin/impl/providers/better-t-stack/helpers/database-providers/supabase-setup.js +0 -162
- package/bin/impl/providers/better-t-stack/helpers/database-providers/turso-setup.d.ts +0 -2
- package/bin/impl/providers/better-t-stack/helpers/database-providers/turso-setup.js +0 -250
- package/bin/impl/providers/better-t-stack/helpers/project-generation/create-project.d.ts +0 -2
- package/bin/impl/providers/better-t-stack/helpers/project-generation/create-project.js +0 -82
- package/bin/impl/providers/better-t-stack/helpers/project-generation/create-readme.d.ts +0 -2
- package/bin/impl/providers/better-t-stack/helpers/project-generation/create-readme.js +0 -245
- package/bin/impl/providers/better-t-stack/helpers/project-generation/env-setup.d.ts +0 -8
- package/bin/impl/providers/better-t-stack/helpers/project-generation/env-setup.js +0 -193
- package/bin/impl/providers/better-t-stack/helpers/project-generation/install-dependencies.d.ts +0 -6
- package/bin/impl/providers/better-t-stack/helpers/project-generation/install-dependencies.js +0 -25
- package/bin/impl/providers/better-t-stack/helpers/project-generation/post-installation.d.ts +0 -4
- package/bin/impl/providers/better-t-stack/helpers/project-generation/post-installation.js +0 -228
- package/bin/impl/providers/better-t-stack/helpers/project-generation/project-config.d.ts +0 -3
- package/bin/impl/providers/better-t-stack/helpers/project-generation/project-config.js +0 -224
- package/bin/impl/providers/better-t-stack/helpers/project-generation/template-manager.d.ts +0 -9
- package/bin/impl/providers/better-t-stack/helpers/project-generation/template-manager.js +0 -484
- package/bin/impl/providers/better-t-stack/helpers/setup/addons-setup.d.ts +0 -2
- package/bin/impl/providers/better-t-stack/helpers/setup/addons-setup.js +0 -99
- package/bin/impl/providers/better-t-stack/helpers/setup/api-setup.d.ts +0 -2
- package/bin/impl/providers/better-t-stack/helpers/setup/api-setup.js +0 -236
- package/bin/impl/providers/better-t-stack/helpers/setup/auth-setup.d.ts +0 -3
- package/bin/impl/providers/better-t-stack/helpers/setup/auth-setup.js +0 -67
- package/bin/impl/providers/better-t-stack/helpers/setup/backend-setup.d.ts +0 -2
- package/bin/impl/providers/better-t-stack/helpers/setup/backend-setup.js +0 -52
- package/bin/impl/providers/better-t-stack/helpers/setup/db-setup.d.ts +0 -2
- package/bin/impl/providers/better-t-stack/helpers/setup/db-setup.js +0 -84
- package/bin/impl/providers/better-t-stack/helpers/setup/examples-setup.d.ts +0 -2
- package/bin/impl/providers/better-t-stack/helpers/setup/examples-setup.js +0 -38
- package/bin/impl/providers/better-t-stack/helpers/setup/runtime-setup.d.ts +0 -2
- package/bin/impl/providers/better-t-stack/helpers/setup/runtime-setup.js +0 -79
- package/bin/impl/providers/better-t-stack/helpers/setup/starlight-setup.d.ts +0 -2
- package/bin/impl/providers/better-t-stack/helpers/setup/starlight-setup.js +0 -41
- package/bin/impl/providers/better-t-stack/helpers/setup/tauri-setup.d.ts +0 -2
- package/bin/impl/providers/better-t-stack/helpers/setup/tauri-setup.js +0 -67
- package/bin/impl/providers/better-t-stack/packed/addons.d.ts +0 -2
- package/bin/impl/providers/better-t-stack/packed/addons.js +0 -263
- package/bin/impl/providers/better-t-stack/packed/api.d.ts +0 -2
- package/bin/impl/providers/better-t-stack/packed/api.js +0 -678
- package/bin/impl/providers/better-t-stack/packed/auth.d.ts +0 -2
- package/bin/impl/providers/better-t-stack/packed/auth.js +0 -4277
- package/bin/impl/providers/better-t-stack/packed/backend.d.ts +0 -2
- package/bin/impl/providers/better-t-stack/packed/backend.js +0 -996
- package/bin/impl/providers/better-t-stack/packed/base.d.ts +0 -2
- package/bin/impl/providers/better-t-stack/packed/base.js +0 -32
- package/bin/impl/providers/better-t-stack/packed/binaries/01dad80fc2.png +0 -0
- package/bin/impl/providers/better-t-stack/packed/binaries/0ba5eb8b0a.png +0 -0
- package/bin/impl/providers/better-t-stack/packed/binaries/19b53640a9.png +0 -0
- package/bin/impl/providers/better-t-stack/packed/binaries/206a875d5d.png +0 -0
- package/bin/impl/providers/better-t-stack/packed/binaries/2dc8b34485.png +0 -0
- package/bin/impl/providers/better-t-stack/packed/binaries/3f71f5a845.png +0 -0
- package/bin/impl/providers/better-t-stack/packed/binaries/6eda863d14.ico +0 -0
- package/bin/impl/providers/better-t-stack/packed/binaries/70aadde45a.png +0 -0
- package/bin/impl/providers/better-t-stack/packed/binaries/9ecfcc8f0e.ico +0 -0
- package/bin/impl/providers/better-t-stack/packed/binaries/9fc7a0c84f.ico +0 -0
- package/bin/impl/providers/better-t-stack/packed/binaries/b72f6b7339.png +0 -0
- package/bin/impl/providers/better-t-stack/packed/binaries/cb25ca74dd.png +0 -0
- package/bin/impl/providers/better-t-stack/packed/binaries/dee83fc2fb.png +0 -0
- package/bin/impl/providers/better-t-stack/packed/binaries/eda53e30fe.svg +0 -6
- package/bin/impl/providers/better-t-stack/packed/db.d.ts +0 -2
- package/bin/impl/providers/better-t-stack/packed/db.js +0 -329
- package/bin/impl/providers/better-t-stack/packed/examples.d.ts +0 -2
- package/bin/impl/providers/better-t-stack/packed/examples.js +0 -3470
- package/bin/impl/providers/better-t-stack/packed/extras.d.ts +0 -2
- package/bin/impl/providers/better-t-stack/packed/extras.js +0 -33
- package/bin/impl/providers/better-t-stack/packed/frontend.d.ts +0 -2
- package/bin/impl/providers/better-t-stack/packed/frontend.js +0 -6116
- package/bin/impl/providers/better-t-stack/packed/runtime.d.ts +0 -2
- package/bin/impl/providers/better-t-stack/packed/runtime.js +0 -35
- package/bin/impl/providers/better-t-stack/prompts/addons.d.ts +0 -2
- package/bin/impl/providers/better-t-stack/prompts/addons.js +0 -62
- package/bin/impl/providers/better-t-stack/prompts/api.d.ts +0 -2
- package/bin/impl/providers/better-t-stack/prompts/api.js +0 -52
- package/bin/impl/providers/better-t-stack/prompts/auth.d.ts +0 -2
- package/bin/impl/providers/better-t-stack/prompts/auth.js +0 -19
- package/bin/impl/providers/better-t-stack/prompts/backend.d.ts +0 -2
- package/bin/impl/providers/better-t-stack/prompts/backend.js +0 -60
- package/bin/impl/providers/better-t-stack/prompts/config-prompts.d.ts +0 -2
- package/bin/impl/providers/better-t-stack/prompts/config-prompts.js +0 -88
- package/bin/impl/providers/better-t-stack/prompts/database-setup.d.ts +0 -2
- package/bin/impl/providers/better-t-stack/prompts/database-setup.js +0 -67
- package/bin/impl/providers/better-t-stack/prompts/database.d.ts +0 -2
- package/bin/impl/providers/better-t-stack/prompts/database.js +0 -48
- package/bin/impl/providers/better-t-stack/prompts/examples.d.ts +0 -2
- package/bin/impl/providers/better-t-stack/prompts/examples.js +0 -44
- package/bin/impl/providers/better-t-stack/prompts/frontend.d.ts +0 -2
- package/bin/impl/providers/better-t-stack/prompts/frontend.js +0 -107
- package/bin/impl/providers/better-t-stack/prompts/git.d.ts +0 -1
- package/bin/impl/providers/better-t-stack/prompts/git.js +0 -15
- package/bin/impl/providers/better-t-stack/prompts/install.d.ts +0 -1
- package/bin/impl/providers/better-t-stack/prompts/install.js +0 -15
- package/bin/impl/providers/better-t-stack/prompts/orm.d.ts +0 -2
- package/bin/impl/providers/better-t-stack/prompts/orm.js +0 -43
- package/bin/impl/providers/better-t-stack/prompts/package-manager.d.ts +0 -2
- package/bin/impl/providers/better-t-stack/prompts/package-manager.js +0 -29
- package/bin/impl/providers/better-t-stack/prompts/project-name.d.ts +0 -1
- package/bin/impl/providers/better-t-stack/prompts/project-name.js +0 -62
- package/bin/impl/providers/better-t-stack/prompts/runtime.d.ts +0 -2
- package/bin/impl/providers/better-t-stack/prompts/runtime.js +0 -41
- package/bin/impl/providers/better-t-stack/types.d.ts +0 -124
- package/bin/impl/providers/better-t-stack/types.js +0 -29
- package/bin/impl/providers/better-t-stack/utils/add-package-deps.d.ts +0 -6
- package/bin/impl/providers/better-t-stack/utils/add-package-deps.js +0 -31
- package/bin/impl/providers/better-t-stack/utils/analytics.d.ts +0 -2
- package/bin/impl/providers/better-t-stack/utils/analytics.js +0 -32
- package/bin/impl/providers/better-t-stack/utils/command-exists.d.ts +0 -1
- package/bin/impl/providers/better-t-stack/utils/command-exists.js +0 -14
- package/bin/impl/providers/better-t-stack/utils/display-config.d.ts +0 -2
- package/bin/impl/providers/better-t-stack/utils/display-config.js +0 -59
- package/bin/impl/providers/better-t-stack/utils/generate-reproducible-command.d.ts +0 -2
- package/bin/impl/providers/better-t-stack/utils/generate-reproducible-command.js +0 -39
- package/bin/impl/providers/better-t-stack/utils/get-latest-cli-version.d.ts +0 -1
- package/bin/impl/providers/better-t-stack/utils/get-latest-cli-version.js +0 -8
- package/bin/impl/providers/better-t-stack/utils/get-package-execution-command.d.ts +0 -10
- package/bin/impl/providers/better-t-stack/utils/get-package-execution-command.js +0 -10
- package/bin/impl/providers/better-t-stack/utils/get-package-manager.d.ts +0 -2
- package/bin/impl/providers/better-t-stack/utils/get-package-manager.js +0 -10
- package/bin/impl/providers/better-t-stack/utils/open-url.d.ts +0 -1
- package/bin/impl/providers/better-t-stack/utils/open-url.js +0 -22
- package/bin/impl/providers/better-t-stack/utils/render-title.d.ts +0 -2
- package/bin/impl/providers/better-t-stack/utils/render-title.js +0 -43
- package/bin/impl/providers/better-t-stack/utils/sponsors.d.ts +0 -16
- package/bin/impl/providers/better-t-stack/utils/sponsors.js +0 -37
- package/bin/impl/providers/better-t-stack/utils/template-processor.d.ts +0 -8
- package/bin/impl/providers/better-t-stack/utils/template-processor.js +0 -23
- package/bin/impl/providers/better-t-stack/validation.d.ts +0 -4
- package/bin/impl/providers/better-t-stack/validation.js +0 -436
- package/bin/impl/providers/package.json +0 -3
- package/bin/impl/providers/reliverse-stack/reliverse-stack-mod.d.ts +0 -6
- package/bin/impl/providers/reliverse-stack/reliverse-stack-mod.js +0 -146
- package/bin/impl/providers/reliverse-stack/rs-impl.d.ts +0 -37
- package/bin/impl/providers/reliverse-stack/rs-impl.js +0 -367
- package/bin/impl/pub/impl.d.ts +0 -8
- package/bin/impl/pub/impl.js +0 -87
- package/bin/impl/pub/pub-library.d.ts +0 -5
- package/bin/impl/pub/pub-library.js +0 -149
- package/bin/impl/pub/pub-regular.d.ts +0 -9
- package/bin/impl/pub/pub-regular.js +0 -87
- package/bin/impl/remdn/mod.d.ts +0 -45
- package/bin/impl/remdn/mod.js +0 -648
- package/bin/impl/rempts/cmd.d.ts +0 -18
- package/bin/impl/rempts/cmd.js +0 -260
- package/bin/impl/rules/reliverse/dler-config-health/dler-config-health.d.ts +0 -2
- package/bin/impl/rules/reliverse/dler-config-health/dler-config-health.js +0 -37
- package/bin/impl/rules/reliverse/file-extensions/file-extensions.d.ts +0 -2
- package/bin/impl/rules/reliverse/file-extensions/file-extensions.js +0 -62
- package/bin/impl/rules/reliverse/missing-deps/analyzer.d.ts +0 -2
- package/bin/impl/rules/reliverse/missing-deps/analyzer.js +0 -49
- package/bin/impl/rules/reliverse/missing-deps/deps-mod.d.ts +0 -2
- package/bin/impl/rules/reliverse/missing-deps/deps-mod.js +0 -57
- package/bin/impl/rules/reliverse/missing-deps/deps-types.d.ts +0 -28
- package/bin/impl/rules/reliverse/missing-deps/deps-types.js +0 -0
- package/bin/impl/rules/reliverse/missing-deps/filesystem.d.ts +0 -4
- package/bin/impl/rules/reliverse/missing-deps/filesystem.js +0 -39
- package/bin/impl/rules/reliverse/missing-deps/formatter.d.ts +0 -2
- package/bin/impl/rules/reliverse/missing-deps/formatter.js +0 -101
- package/bin/impl/rules/reliverse/missing-deps/parser.d.ts +0 -5
- package/bin/impl/rules/reliverse/missing-deps/parser.js +0 -57
- package/bin/impl/rules/reliverse/no-dynamic-imports/no-dynamic-imports.d.ts +0 -7
- package/bin/impl/rules/reliverse/no-dynamic-imports/no-dynamic-imports.js +0 -89
- package/bin/impl/rules/reliverse/no-index-files/no-index-files.d.ts +0 -2
- package/bin/impl/rules/reliverse/no-index-files/no-index-files.js +0 -31
- package/bin/impl/rules/reliverse/package-json-health/package-json-health.d.ts +0 -2
- package/bin/impl/rules/reliverse/package-json-health/package-json-health.js +0 -61
- package/bin/impl/rules/reliverse/path-extensions/path-extensions.d.ts +0 -2
- package/bin/impl/rules/reliverse/path-extensions/path-extensions.js +0 -87
- package/bin/impl/rules/reliverse/self-include/self-include.d.ts +0 -2
- package/bin/impl/rules/reliverse/self-include/self-include.js +0 -93
- package/bin/impl/rules/reliverse/tsconfig-health/tsconfig-health.d.ts +0 -2
- package/bin/impl/rules/reliverse/tsconfig-health/tsconfig-health.js +0 -35
- package/bin/impl/rules/rules-consts.d.ts +0 -29
- package/bin/impl/rules/rules-consts.js +0 -48
- package/bin/impl/rules/rules-mod.d.ts +0 -2
- package/bin/impl/rules/rules-mod.js +0 -87
- package/bin/impl/rules/rules-utils.d.ts +0 -4
- package/bin/impl/rules/rules-utils.js +0 -49
- package/bin/impl/schema/gen.d.ts +0 -3
- package/bin/impl/schema/gen.js +0 -1493
- package/bin/impl/schema/mod.d.ts +0 -1329
- package/bin/impl/schema/mod.js +0 -344
- package/bin/impl/schema/utils.d.ts +0 -17
- package/bin/impl/schema/utils.js +0 -86
- package/bin/impl/split/impl.d.ts +0 -18
- package/bin/impl/split/impl.js +0 -89
- package/bin/impl/toolbox/toolbox-impl.d.ts +0 -5
- package/bin/impl/toolbox/toolbox-impl.js +0 -78
- package/bin/impl/toolbox/toolbox-vercel.d.ts +0 -6
- package/bin/impl/toolbox/toolbox-vercel.js +0 -97
- package/bin/impl/transform/transform-impl-mod.d.ts +0 -117
- package/bin/impl/transform/transform-impl-mod.js +0 -172
- package/bin/impl/types/mod.d.ts +0 -634
- package/bin/impl/types/mod.js +0 -0
- package/bin/impl/update/impl.d.ts +0 -21
- package/bin/impl/update/impl.js +0 -142
- package/bin/impl/update/utils.d.ts +0 -87
- package/bin/impl/update/utils.js +0 -448
- package/bin/impl/upload/providers/providers-mod.d.ts +0 -20
- package/bin/impl/upload/providers/providers-mod.js +0 -40
- package/bin/impl/upload/providers/uploadcare.d.ts +0 -13
- package/bin/impl/upload/providers/uploadcare.js +0 -26
- package/bin/impl/upload/providers/uploadthing.d.ts +0 -11
- package/bin/impl/upload/providers/uploadthing.js +0 -31
- package/bin/impl/upload/upload-utils.d.ts +0 -1
- package/bin/impl/upload/upload-utils.js +0 -7
- package/bin/impl/utils/agg/agg-1.d.ts +0 -1
- package/bin/impl/utils/agg/agg-1.js +0 -196
- package/bin/impl/utils/agg/agg-2.d.ts +0 -35
- package/bin/impl/utils/agg/agg-2.js +0 -148
- package/bin/impl/utils/agg/agg-3.d.ts +0 -41
- package/bin/impl/utils/agg/agg-3.js +0 -197
- package/bin/impl/utils/agg/agg-4.d.ts +0 -8
- package/bin/impl/utils/agg/agg-4.js +0 -26
- package/bin/impl/utils/agg/agg-5.d.ts +0 -4
- package/bin/impl/utils/agg/agg-5.js +0 -10
- package/bin/impl/utils/b-exts.d.ts +0 -5
- package/bin/impl/utils/b-exts.js +0 -406
- package/bin/impl/utils/badgeNotifiers.d.ts +0 -2
- package/bin/impl/utils/badgeNotifiers.js +0 -3
- package/bin/impl/utils/binary.d.ts +0 -4
- package/bin/impl/utils/binary.js +0 -11
- package/bin/impl/utils/codemods/convertCjsToEsm.d.ts +0 -1
- package/bin/impl/utils/codemods/convertCjsToEsm.js +0 -27
- package/bin/impl/utils/codemods/convertDatabase.d.ts +0 -2
- package/bin/impl/utils/codemods/convertDatabase.js +0 -229
- package/bin/impl/utils/codemods/convertDefinitions.d.ts +0 -1
- package/bin/impl/utils/codemods/convertDefinitions.js +0 -42
- package/bin/impl/utils/codemods/convertImportStyle.d.ts +0 -1
- package/bin/impl/utils/codemods/convertImportStyle.js +0 -30
- package/bin/impl/utils/codemods/convertJsToTs.d.ts +0 -1
- package/bin/impl/utils/codemods/convertJsToTs.js +0 -99
- package/bin/impl/utils/codemods/convertQuoteStyle.d.ts +0 -1
- package/bin/impl/utils/codemods/convertQuoteStyle.js +0 -31
- package/bin/impl/utils/codemods/convertRuntime.d.ts +0 -1
- package/bin/impl/utils/codemods/convertRuntime.js +0 -116
- package/bin/impl/utils/codemods/convertToMonorepo.d.ts +0 -2
- package/bin/impl/utils/codemods/convertToMonorepo.js +0 -137
- package/bin/impl/utils/codemods/removeComments.d.ts +0 -1
- package/bin/impl/utils/codemods/removeComments.js +0 -13
- package/bin/impl/utils/codemods/removeUnusedDeps.d.ts +0 -1
- package/bin/impl/utils/codemods/removeUnusedDeps.js +0 -29
- package/bin/impl/utils/codemods/replaceImportSymbol.d.ts +0 -1
- package/bin/impl/utils/codemods/replaceImportSymbol.js +0 -57
- package/bin/impl/utils/codemods/replaceWithModern.d.ts +0 -1
- package/bin/impl/utils/codemods/replaceWithModern.js +0 -122
- package/bin/impl/utils/comments.d.ts +0 -6
- package/bin/impl/utils/comments.js +0 -41
- package/bin/impl/utils/common.d.ts +0 -9
- package/bin/impl/utils/common.js +0 -37
- package/bin/impl/utils/createPackageJSON.d.ts +0 -6
- package/bin/impl/utils/createPackageJSON.js +0 -20
- package/bin/impl/utils/decideHelper.d.ts +0 -12
- package/bin/impl/utils/decideHelper.js +0 -32
- package/bin/impl/utils/dependencies/getUserPkgManager.d.ts +0 -13
- package/bin/impl/utils/dependencies/getUserPkgManager.js +0 -178
- package/bin/impl/utils/downloading/downloadI18nFiles.d.ts +0 -1
- package/bin/impl/utils/downloading/downloadI18nFiles.js +0 -98
- package/bin/impl/utils/downloading/downloadRepo.d.ts +0 -41
- package/bin/impl/utils/downloading/downloadRepo.js +0 -412
- package/bin/impl/utils/downloading/handleDownload.d.ts +0 -17
- package/bin/impl/utils/downloading/handleDownload.js +0 -160
- package/bin/impl/utils/exec/exec-enoent.d.ts +0 -15
- package/bin/impl/utils/exec/exec-enoent.js +0 -38
- package/bin/impl/utils/exec/exec-env.d.ts +0 -6
- package/bin/impl/utils/exec/exec-env.js +0 -34
- package/bin/impl/utils/exec/exec-error.d.ts +0 -7
- package/bin/impl/utils/exec/exec-error.js +0 -15
- package/bin/impl/utils/exec/exec-escape.d.ts +0 -2
- package/bin/impl/utils/exec/exec-escape.js +0 -15
- package/bin/impl/utils/exec/exec-mod.d.ts +0 -58
- package/bin/impl/utils/exec/exec-mod.js +0 -224
- package/bin/impl/utils/exec/exec-parse.d.ts +0 -2
- package/bin/impl/utils/exec/exec-parse.js +0 -71
- package/bin/impl/utils/exec/exec-resolve.d.ts +0 -2
- package/bin/impl/utils/exec/exec-resolve.js +0 -39
- package/bin/impl/utils/exec/exec-shebang.d.ts +0 -1
- package/bin/impl/utils/exec/exec-shebang.js +0 -14
- package/bin/impl/utils/exec/exec-spawn.d.ts +0 -3
- package/bin/impl/utils/exec/exec-spawn.js +0 -18
- package/bin/impl/utils/exec/exec-stream.d.ts +0 -4
- package/bin/impl/utils/exec/exec-stream.js +0 -18
- package/bin/impl/utils/exec/exec-types.d.ts +0 -13
- package/bin/impl/utils/exec/exec-types.js +0 -9
- package/bin/impl/utils/file-type.d.ts +0 -21
- package/bin/impl/utils/file-type.js +0 -78
- package/bin/impl/utils/finalize.d.ts +0 -10
- package/bin/impl/utils/finalize.js +0 -33
- package/bin/impl/utils/finish-text.d.ts +0 -6
- package/bin/impl/utils/finish-text.js +0 -41
- package/bin/impl/utils/fs-rename.d.ts +0 -2
- package/bin/impl/utils/fs-rename.js +0 -108
- package/bin/impl/utils/getEffectiveDir.d.ts +0 -5
- package/bin/impl/utils/getEffectiveDir.js +0 -4
- package/bin/impl/utils/getPackageManager.d.ts +0 -3
- package/bin/impl/utils/getPackageManager.js +0 -14
- package/bin/impl/utils/handlers/dependencies.d.ts +0 -1
- package/bin/impl/utils/handlers/dependencies.js +0 -19
- package/bin/impl/utils/handlers/handleCleanup.d.ts +0 -1
- package/bin/impl/utils/handlers/handleCleanup.js +0 -84
- package/bin/impl/utils/handlers/handleCodemods.d.ts +0 -2
- package/bin/impl/utils/handlers/handleCodemods.js +0 -203
- package/bin/impl/utils/handlers/isAppInstalled.d.ts +0 -1
- package/bin/impl/utils/handlers/isAppInstalled.js +0 -17
- package/bin/impl/utils/handlers/promptPackageJsonScripts.d.ts +0 -8
- package/bin/impl/utils/handlers/promptPackageJsonScripts.js +0 -130
- package/bin/impl/utils/handlers/shadcn.d.ts +0 -19
- package/bin/impl/utils/handlers/shadcn.js +0 -299
- package/bin/impl/utils/hasOnlyReliverseConfig.d.ts +0 -6
- package/bin/impl/utils/hasOnlyReliverseConfig.js +0 -15
- package/bin/impl/utils/init/init-const.d.ts +0 -34
- package/bin/impl/utils/init/init-const.js +0 -17
- package/bin/impl/utils/init/init-impl.d.ts +0 -22
- package/bin/impl/utils/init/init-impl.js +0 -229
- package/bin/impl/utils/init/init-tmpl.d.ts +0 -3
- package/bin/impl/utils/init/init-tmpl.js +0 -68
- package/bin/impl/utils/init/init-types.d.ts +0 -41
- package/bin/impl/utils/init/init-types.js +0 -0
- package/bin/impl/utils/instanceGithub.d.ts +0 -28
- package/bin/impl/utils/instanceGithub.js +0 -50
- package/bin/impl/utils/instanceVercel.d.ts +0 -16
- package/bin/impl/utils/instanceVercel.js +0 -39
- package/bin/impl/utils/microHelpers.d.ts +0 -11
- package/bin/impl/utils/microHelpers.js +0 -8
- package/bin/impl/utils/mrseHelpers.d.ts +0 -6
- package/bin/impl/utils/mrseHelpers.js +0 -21
- package/bin/impl/utils/pkgJsonHelpers.d.ts +0 -7
- package/bin/impl/utils/pkgJsonHelpers.js +0 -15
- package/bin/impl/utils/pm/pm-api.d.ts +0 -87
- package/bin/impl/utils/pm/pm-api.js +0 -170
- package/bin/impl/utils/pm/pm-catalog.d.ts +0 -36
- package/bin/impl/utils/pm/pm-catalog.js +0 -237
- package/bin/impl/utils/pm/pm-detect.d.ts +0 -12
- package/bin/impl/utils/pm/pm-detect.js +0 -99
- package/bin/impl/utils/pm/pm-meta.d.ts +0 -27
- package/bin/impl/utils/pm/pm-meta.js +0 -86
- package/bin/impl/utils/pm/pm-parse.d.ts +0 -8
- package/bin/impl/utils/pm/pm-parse.js +0 -29
- package/bin/impl/utils/pm/pm-types.d.ts +0 -46
- package/bin/impl/utils/pm/pm-types.js +0 -0
- package/bin/impl/utils/pm/pm-utils.d.ts +0 -12
- package/bin/impl/utils/pm/pm-utils.js +0 -115
- package/bin/impl/utils/projectRepository.d.ts +0 -58
- package/bin/impl/utils/projectRepository.js +0 -228
- package/bin/impl/utils/prompts/askAppOrLib.d.ts +0 -1
- package/bin/impl/utils/prompts/askAppOrLib.js +0 -30
- package/bin/impl/utils/prompts/askInstallDeps.d.ts +0 -7
- package/bin/impl/utils/prompts/askInstallDeps.js +0 -40
- package/bin/impl/utils/prompts/askOpenInIDE.d.ts +0 -5
- package/bin/impl/utils/prompts/askOpenInIDE.js +0 -43
- package/bin/impl/utils/prompts/askProjectName.d.ts +0 -3
- package/bin/impl/utils/prompts/askProjectName.js +0 -21
- package/bin/impl/utils/prompts/askUsernameFrontend.d.ts +0 -2
- package/bin/impl/utils/prompts/askUsernameFrontend.js +0 -28
- package/bin/impl/utils/prompts/askUsernameGithub.d.ts +0 -2
- package/bin/impl/utils/prompts/askUsernameGithub.js +0 -29
- package/bin/impl/utils/prompts/shouldInitGit.d.ts +0 -1
- package/bin/impl/utils/prompts/shouldInitGit.js +0 -8
- package/bin/impl/utils/reliverseMemory.d.ts +0 -3
- package/bin/impl/utils/reliverseMemory.js +0 -122
- package/bin/impl/utils/replacements/reps-impl.d.ts +0 -35
- package/bin/impl/utils/replacements/reps-impl.js +0 -220
- package/bin/impl/utils/replacements/reps-keys.d.ts +0 -16
- package/bin/impl/utils/replacements/reps-keys.js +0 -14
- package/bin/impl/utils/replacements/reps-mod.d.ts +0 -5
- package/bin/impl/utils/replacements/reps-mod.js +0 -211
- package/bin/impl/utils/replacements.d.ts +0 -0
- package/bin/impl/utils/replacements.js +0 -0
- package/bin/impl/utils/resolve-cross-libs.d.ts +0 -1
- package/bin/impl/utils/resolve-cross-libs.js +0 -641
- package/bin/impl/utils/schemaMemory.d.ts +0 -17
- package/bin/impl/utils/schemaMemory.js +0 -0
- package/bin/impl/utils/schemaTemplate.d.ts +0 -27
- package/bin/impl/utils/schemaTemplate.js +0 -98
- package/bin/impl/utils/startEndPrompts.d.ts +0 -8
- package/bin/impl/utils/startEndPrompts.js +0 -53
- package/bin/impl/utils/terminalHelpers.d.ts +0 -19
- package/bin/impl/utils/terminalHelpers.js +0 -43
- package/bin/impl/utils/testsRuntime.d.ts +0 -5
- package/bin/impl/utils/testsRuntime.js +0 -11
- package/bin/impl/utils/tsconfigHelpers.d.ts +0 -5
- package/bin/impl/utils/tsconfigHelpers.js +0 -14
- package/bin/impl/utils/utils-build.d.ts +0 -33
- package/bin/impl/utils/utils-build.js +0 -97
- package/bin/impl/utils/utils-clean.d.ts +0 -11
- package/bin/impl/utils/utils-clean.js +0 -70
- package/bin/impl/utils/utils-deps.d.ts +0 -5
- package/bin/impl/utils/utils-deps.js +0 -126
- package/bin/impl/utils/utils-determine.d.ts +0 -12
- package/bin/impl/utils/utils-determine.js +0 -25
- package/bin/impl/utils/utils-error-cwd.d.ts +0 -19
- package/bin/impl/utils/utils-error-cwd.js +0 -49
- package/bin/impl/utils/utils-fs.d.ts +0 -25
- package/bin/impl/utils/utils-fs.js +0 -183
- package/bin/impl/utils/utils-jsr-json.d.ts +0 -9
- package/bin/impl/utils/utils-jsr-json.js +0 -75
- package/bin/impl/utils/utils-misc.d.ts +0 -7
- package/bin/impl/utils/utils-misc.js +0 -7
- package/bin/impl/utils/utils-package-json-libraries.d.ts +0 -10
- package/bin/impl/utils/utils-package-json-libraries.js +0 -316
- package/bin/impl/utils/utils-package-json-regular.d.ts +0 -8
- package/bin/impl/utils/utils-package-json-regular.js +0 -165
- package/bin/impl/utils/utils-perf.d.ts +0 -5
- package/bin/impl/utils/utils-perf.js +0 -22
- package/bin/impl/utils/utils-security.d.ts +0 -12
- package/bin/impl/utils/utils-security.js +0 -95
- package/bin/impl/utils/utils-tsconfig.d.ts +0 -10
- package/bin/impl/utils/utils-tsconfig.js +0 -81
- package/bin/mod.d.ts +0 -437
- package/bin/mod.js +0 -1039
|
@@ -1,4277 +0,0 @@
|
|
|
1
|
-
export const DLER_TPL_AUTH = {
|
|
2
|
-
name: "auth",
|
|
3
|
-
description: "Template generated from 58 files",
|
|
4
|
-
updatedAt: "2025-06-17T20:33:59.599Z",
|
|
5
|
-
config: {
|
|
6
|
-
files: {
|
|
7
|
-
"auth/native/native-base/lib/auth-client.ts.hbs": {
|
|
8
|
-
metadata: {
|
|
9
|
-
updatedAt: "2025-06-17T06:06:35.000Z",
|
|
10
|
-
updatedHash: "0200f4eedc"
|
|
11
|
-
},
|
|
12
|
-
content: `import { createAuthClient } from "better-auth/react";
|
|
13
|
-
import { expoClient } from "@better-auth/expo/client";
|
|
14
|
-
import * as SecureStore from "expo-secure-store";
|
|
15
|
-
export const authClient = createAuthClient({
|
|
16
|
-
baseURL: process.env.EXPO_PUBLIC_SERVER_URL,
|
|
17
|
-
plugins: [
|
|
18
|
-
expoClient({
|
|
19
|
-
storagePrefix: "my-better-t-app",
|
|
20
|
-
storage: SecureStore,
|
|
21
|
-
}),
|
|
22
|
-
],
|
|
23
|
-
});
|
|
24
|
-
`,
|
|
25
|
-
type: "text"
|
|
26
|
-
},
|
|
27
|
-
"auth/native/nativewind/app/(drawer)/index.tsx.hbs": {
|
|
28
|
-
metadata: {
|
|
29
|
-
updatedAt: "2025-06-17T06:06:35.000Z",
|
|
30
|
-
updatedHash: "c97ce0cd75"
|
|
31
|
-
},
|
|
32
|
-
content: `import { authClient } from "@/lib/auth-client";
|
|
33
|
-
import { useQuery } from "@tanstack/react-query";
|
|
34
|
-
import { ScrollView, Text, TouchableOpacity, View } from "react-native";
|
|
35
|
-
import { Container } from "@/components/container";
|
|
36
|
-
import { SignIn } from "@/components/sign-in";
|
|
37
|
-
import { SignUp } from "@/components/sign-up";
|
|
38
|
-
{{#if (eq api "orpc")}}
|
|
39
|
-
import { queryClient, orpc } from "@/utils/orpc";
|
|
40
|
-
{{/if}}
|
|
41
|
-
{{#if (eq api "trpc")}}
|
|
42
|
-
import { queryClient, trpc } from "@/utils/trpc";
|
|
43
|
-
{{/if}}
|
|
44
|
-
export default function Home() {
|
|
45
|
-
{{#if (eq api "orpc")}}
|
|
46
|
-
const healthCheck = useQuery(orpc.healthCheck.queryOptions());
|
|
47
|
-
const privateData = useQuery(orpc.privateData.queryOptions());
|
|
48
|
-
{{/if}}
|
|
49
|
-
{{#if (eq api "trpc")}}
|
|
50
|
-
const healthCheck = useQuery(trpc.healthCheck.queryOptions());
|
|
51
|
-
const privateData = useQuery(trpc.privateData.queryOptions());
|
|
52
|
-
{{/if}}
|
|
53
|
-
const { data: session } = authClient.useSession();
|
|
54
|
-
return (
|
|
55
|
-
<Container>
|
|
56
|
-
<ScrollView className="flex-1">
|
|
57
|
-
<View className="px-4">
|
|
58
|
-
<Text className="font-mono text-foreground text-3xl font-bold mb-4">
|
|
59
|
-
BETTER T STACK
|
|
60
|
-
</Text>
|
|
61
|
-
{session?.user ? (
|
|
62
|
-
<View className="mb-6 p-4 bg-card rounded-lg border border-border">
|
|
63
|
-
<View className="flex-row justify-between items-center mb-2">
|
|
64
|
-
<Text className="text-foreground text-base">
|
|
65
|
-
Welcome,{" "}
|
|
66
|
-
<Text className="font-medium">{session.user.name}</Text>
|
|
67
|
-
</Text>
|
|
68
|
-
</View>
|
|
69
|
-
<Text className="text-muted-foreground text-sm mb-4">
|
|
70
|
-
{session.user.email}
|
|
71
|
-
</Text>
|
|
72
|
-
<TouchableOpacity
|
|
73
|
-
className="bg-destructive py-2 px-4 rounded-md self-start"
|
|
74
|
-
onPress={() => {
|
|
75
|
-
authClient.signOut();
|
|
76
|
-
queryClient.invalidateQueries();
|
|
77
|
-
}}
|
|
78
|
-
>
|
|
79
|
-
<Text className="text-white font-medium">Sign Out</Text>
|
|
80
|
-
</TouchableOpacity>
|
|
81
|
-
</View>
|
|
82
|
-
) : null}
|
|
83
|
-
<View className="mb-6 rounded-lg border border-border p-4">
|
|
84
|
-
<Text className="mb-3 font-medium text-foreground">API Status</Text>
|
|
85
|
-
<View className="flex-row items-center gap-2">
|
|
86
|
-
<View
|
|
87
|
-
className={\`h-3 w-3 rounded-full \${
|
|
88
|
-
healthCheck.data ? "bg-green-500" : "bg-red-500"
|
|
89
|
-
}\`}
|
|
90
|
-
/>
|
|
91
|
-
<Text className="text-muted-foreground">
|
|
92
|
-
{healthCheck.isLoading
|
|
93
|
-
? "Checking..."
|
|
94
|
-
: healthCheck.data
|
|
95
|
-
? "Connected to API"
|
|
96
|
-
: "API Disconnected"}
|
|
97
|
-
</Text>
|
|
98
|
-
</View>
|
|
99
|
-
</View>
|
|
100
|
-
<View className="mb-6 rounded-lg border border-border p-4">
|
|
101
|
-
<Text className="mb-3 font-medium text-foreground">
|
|
102
|
-
Private Data
|
|
103
|
-
</Text>
|
|
104
|
-
{privateData && (
|
|
105
|
-
<View>
|
|
106
|
-
<Text className="text-muted-foreground">
|
|
107
|
-
{privateData.data?.message}
|
|
108
|
-
</Text>
|
|
109
|
-
</View>
|
|
110
|
-
)}
|
|
111
|
-
</View>
|
|
112
|
-
{!session?.user && (
|
|
113
|
-
<>
|
|
114
|
-
<SignIn />
|
|
115
|
-
<SignUp />
|
|
116
|
-
</>
|
|
117
|
-
)}
|
|
118
|
-
</View>
|
|
119
|
-
</ScrollView>
|
|
120
|
-
</Container>
|
|
121
|
-
);
|
|
122
|
-
}
|
|
123
|
-
`,
|
|
124
|
-
type: "text"
|
|
125
|
-
},
|
|
126
|
-
"auth/native/nativewind/components/sign-in.tsx.hbs": {
|
|
127
|
-
metadata: {
|
|
128
|
-
updatedAt: "2025-06-17T06:06:35.000Z",
|
|
129
|
-
updatedHash: "4c4e7aa2b5"
|
|
130
|
-
},
|
|
131
|
-
content: `import { authClient } from "@/lib/auth-client";
|
|
132
|
-
{{#if (eq api "trpc")}}
|
|
133
|
-
import { queryClient } from "@/utils/trpc";
|
|
134
|
-
{{/if}}
|
|
135
|
-
{{#if (eq api "orpc")}}
|
|
136
|
-
import { queryClient } from "@/utils/orpc";
|
|
137
|
-
{{/if}}
|
|
138
|
-
import { useState } from "react";
|
|
139
|
-
import {
|
|
140
|
-
ActivityIndicator,
|
|
141
|
-
Text,
|
|
142
|
-
TextInput,
|
|
143
|
-
TouchableOpacity,
|
|
144
|
-
View,
|
|
145
|
-
} from "react-native";
|
|
146
|
-
export function SignIn() {
|
|
147
|
-
const [email, setEmail] = useState("");
|
|
148
|
-
const [password, setPassword] = useState("");
|
|
149
|
-
const [isLoading, setIsLoading] = useState(false);
|
|
150
|
-
const [error, setError] = useState<string | null>(null);
|
|
151
|
-
const handleLogin = async () => {
|
|
152
|
-
setIsLoading(true);
|
|
153
|
-
setError(null);
|
|
154
|
-
await authClient.signIn.email(
|
|
155
|
-
{
|
|
156
|
-
email,
|
|
157
|
-
password,
|
|
158
|
-
},
|
|
159
|
-
{
|
|
160
|
-
onError: (error) => {
|
|
161
|
-
setError(error.error?.message || "Failed to sign in");
|
|
162
|
-
setIsLoading(false);
|
|
163
|
-
},
|
|
164
|
-
onSuccess: () => {
|
|
165
|
-
setEmail("");
|
|
166
|
-
setPassword("");
|
|
167
|
-
queryClient.refetchQueries();
|
|
168
|
-
},
|
|
169
|
-
onFinished: () => {
|
|
170
|
-
setIsLoading(false);
|
|
171
|
-
},
|
|
172
|
-
},
|
|
173
|
-
);
|
|
174
|
-
};
|
|
175
|
-
return (
|
|
176
|
-
<View className="mt-6 p-4 bg-card rounded-lg border border-border">
|
|
177
|
-
<Text className="text-lg font-semibold text-foreground mb-4">
|
|
178
|
-
Sign In
|
|
179
|
-
</Text>
|
|
180
|
-
{error && (
|
|
181
|
-
<View className="mb-4 p-3 bg-destructive/10 rounded-md">
|
|
182
|
-
<Text className="text-destructive text-sm">{error}</Text>
|
|
183
|
-
</View>
|
|
184
|
-
)}
|
|
185
|
-
<TextInput
|
|
186
|
-
className="mb-3 p-4 rounded-md bg-input text-foreground border border-input"
|
|
187
|
-
placeholder="Email"
|
|
188
|
-
value={email}
|
|
189
|
-
onChangeText={setEmail}
|
|
190
|
-
placeholderTextColor="#9CA3AF"
|
|
191
|
-
keyboardType="email-address"
|
|
192
|
-
autoCapitalize="none"
|
|
193
|
-
/>
|
|
194
|
-
<TextInput
|
|
195
|
-
className="mb-4 p-4 rounded-md bg-input text-foreground border border-input"
|
|
196
|
-
placeholder="Password"
|
|
197
|
-
value={password}
|
|
198
|
-
onChangeText={setPassword}
|
|
199
|
-
placeholderTextColor="#9CA3AF"
|
|
200
|
-
secureTextEntry
|
|
201
|
-
/>
|
|
202
|
-
<TouchableOpacity
|
|
203
|
-
onPress={handleLogin}
|
|
204
|
-
disabled={isLoading}
|
|
205
|
-
className="bg-primary p-4 rounded-md flex-row justify-center items-center"
|
|
206
|
-
>
|
|
207
|
-
{isLoading ? (
|
|
208
|
-
<ActivityIndicator size="small" color="#fff" />
|
|
209
|
-
) : (
|
|
210
|
-
<Text className="text-primary-foreground font-medium">Sign In</Text>
|
|
211
|
-
)}
|
|
212
|
-
</TouchableOpacity>
|
|
213
|
-
</View>
|
|
214
|
-
);
|
|
215
|
-
}`,
|
|
216
|
-
type: "text"
|
|
217
|
-
},
|
|
218
|
-
"auth/native/nativewind/components/sign-up.tsx.hbs": {
|
|
219
|
-
metadata: {
|
|
220
|
-
updatedAt: "2025-06-17T06:06:35.000Z",
|
|
221
|
-
updatedHash: "0b0208cf24"
|
|
222
|
-
},
|
|
223
|
-
content: `import { authClient } from "@/lib/auth-client";
|
|
224
|
-
{{#if (eq api "trpc")}}
|
|
225
|
-
import { queryClient } from "@/utils/trpc";
|
|
226
|
-
{{/if}}
|
|
227
|
-
{{#if (eq api "orpc")}}
|
|
228
|
-
import { queryClient } from "@/utils/orpc";
|
|
229
|
-
{{/if}}
|
|
230
|
-
import { useState } from "react";
|
|
231
|
-
import {
|
|
232
|
-
ActivityIndicator,
|
|
233
|
-
Text,
|
|
234
|
-
TextInput,
|
|
235
|
-
TouchableOpacity,
|
|
236
|
-
View,
|
|
237
|
-
} from "react-native";
|
|
238
|
-
export function SignUp() {
|
|
239
|
-
const [name, setName] = useState("");
|
|
240
|
-
const [email, setEmail] = useState("");
|
|
241
|
-
const [password, setPassword] = useState("");
|
|
242
|
-
const [isLoading, setIsLoading] = useState(false);
|
|
243
|
-
const [error, setError] = useState<string | null>(null);
|
|
244
|
-
const handleSignUp = async () => {
|
|
245
|
-
setIsLoading(true);
|
|
246
|
-
setError(null);
|
|
247
|
-
await authClient.signUp.email(
|
|
248
|
-
{
|
|
249
|
-
name,
|
|
250
|
-
email,
|
|
251
|
-
password,
|
|
252
|
-
},
|
|
253
|
-
{
|
|
254
|
-
onError: (error) => {
|
|
255
|
-
setError(error.error?.message || "Failed to sign up");
|
|
256
|
-
setIsLoading(false);
|
|
257
|
-
},
|
|
258
|
-
onSuccess: () => {
|
|
259
|
-
setName("");
|
|
260
|
-
setEmail("");
|
|
261
|
-
setPassword("");
|
|
262
|
-
queryClient.refetchQueries();
|
|
263
|
-
},
|
|
264
|
-
onFinished: () => {
|
|
265
|
-
setIsLoading(false);
|
|
266
|
-
},
|
|
267
|
-
},
|
|
268
|
-
);
|
|
269
|
-
};
|
|
270
|
-
return (
|
|
271
|
-
<View className="mt-6 p-4 bg-card rounded-lg border border-border">
|
|
272
|
-
<Text className="text-lg font-semibold text-foreground mb-4">
|
|
273
|
-
Create Account
|
|
274
|
-
</Text>
|
|
275
|
-
{error && (
|
|
276
|
-
<View className="mb-4 p-3 bg-destructive/10 rounded-md">
|
|
277
|
-
<Text className="text-destructive text-sm">{error}</Text>
|
|
278
|
-
</View>
|
|
279
|
-
)}
|
|
280
|
-
<TextInput
|
|
281
|
-
className="mb-3 p-4 rounded-md bg-input text-foreground border border-input"
|
|
282
|
-
placeholder="Name"
|
|
283
|
-
value={name}
|
|
284
|
-
onChangeText={setName}
|
|
285
|
-
placeholderTextColor="#9CA3AF"
|
|
286
|
-
/>
|
|
287
|
-
<TextInput
|
|
288
|
-
className="mb-3 p-4 rounded-md bg-input text-foreground border border-input"
|
|
289
|
-
placeholder="Email"
|
|
290
|
-
value={email}
|
|
291
|
-
onChangeText={setEmail}
|
|
292
|
-
placeholderTextColor="#9CA3AF"
|
|
293
|
-
keyboardType="email-address"
|
|
294
|
-
autoCapitalize="none"
|
|
295
|
-
/>
|
|
296
|
-
<TextInput
|
|
297
|
-
className="mb-4 p-4 rounded-md bg-input text-foreground border border-input"
|
|
298
|
-
placeholder="Password"
|
|
299
|
-
value={password}
|
|
300
|
-
onChangeText={setPassword}
|
|
301
|
-
placeholderTextColor="#9CA3AF"
|
|
302
|
-
secureTextEntry
|
|
303
|
-
/>
|
|
304
|
-
<TouchableOpacity
|
|
305
|
-
onPress={handleSignUp}
|
|
306
|
-
disabled={isLoading}
|
|
307
|
-
className="bg-primary p-4 rounded-md flex-row justify-center items-center"
|
|
308
|
-
>
|
|
309
|
-
{isLoading ? (
|
|
310
|
-
<ActivityIndicator size="small" color="#fff" />
|
|
311
|
-
) : (
|
|
312
|
-
<Text className="text-primary-foreground font-medium">Sign Up</Text>
|
|
313
|
-
)}
|
|
314
|
-
</TouchableOpacity>
|
|
315
|
-
</View>
|
|
316
|
-
);
|
|
317
|
-
}
|
|
318
|
-
`,
|
|
319
|
-
type: "text"
|
|
320
|
-
},
|
|
321
|
-
"auth/native/unistyles/app/(drawer)/index.tsx.hbs": {
|
|
322
|
-
metadata: {
|
|
323
|
-
updatedAt: "2025-06-17T06:06:35.000Z",
|
|
324
|
-
updatedHash: "60da1070a7"
|
|
325
|
-
},
|
|
326
|
-
content: `import { authClient } from "@/lib/auth-client";
|
|
327
|
-
import { useQuery } from "@tanstack/react-query";
|
|
328
|
-
import { ScrollView, Text, TouchableOpacity, View } from "react-native";
|
|
329
|
-
import { StyleSheet } from "react-native-unistyles";
|
|
330
|
-
import { Container } from "@/components/container";
|
|
331
|
-
import { SignIn } from "@/components/sign-in";
|
|
332
|
-
import { SignUp } from "@/components/sign-up";
|
|
333
|
-
{{#if (eq api "orpc")}}
|
|
334
|
-
import { queryClient, orpc } from "@/utils/orpc";
|
|
335
|
-
{{/if}}
|
|
336
|
-
{{#if (eq api "trpc")}}
|
|
337
|
-
import { queryClient, trpc } from "@/utils/trpc";
|
|
338
|
-
{{/if}}
|
|
339
|
-
export default function Home() {
|
|
340
|
-
{{#if (eq api "orpc")}}
|
|
341
|
-
const healthCheck = useQuery(orpc.healthCheck.queryOptions());
|
|
342
|
-
const privateData = useQuery(orpc.privateData.queryOptions());
|
|
343
|
-
{{/if}}
|
|
344
|
-
{{#if (eq api "trpc")}}
|
|
345
|
-
const healthCheck = useQuery(trpc.healthCheck.queryOptions());
|
|
346
|
-
const privateData = useQuery(trpc.privateData.queryOptions());
|
|
347
|
-
{{/if}}
|
|
348
|
-
const { data: session } = authClient.useSession();
|
|
349
|
-
return (
|
|
350
|
-
<Container>
|
|
351
|
-
<ScrollView>
|
|
352
|
-
<View style={styles.pageContainer}>
|
|
353
|
-
<Text style={styles.headerTitle}>BETTER T STACK</Text>
|
|
354
|
-
{session?.user ? (
|
|
355
|
-
<View style={styles.sessionInfoCard}>
|
|
356
|
-
<View style={styles.sessionUserRow}>
|
|
357
|
-
<Text style={styles.welcomeText}>
|
|
358
|
-
Welcome,{" "}
|
|
359
|
-
<Text style={styles.userNameText}>{session.user.name}</Text>
|
|
360
|
-
</Text>
|
|
361
|
-
</View>
|
|
362
|
-
<Text style={styles.emailText}>{session.user.email}</Text>
|
|
363
|
-
<TouchableOpacity
|
|
364
|
-
style={styles.signOutButton}
|
|
365
|
-
onPress={() => {
|
|
366
|
-
authClient.signOut();
|
|
367
|
-
queryClient.invalidateQueries();
|
|
368
|
-
}}
|
|
369
|
-
>
|
|
370
|
-
<Text style={styles.signOutButtonText}>Sign Out</Text>
|
|
371
|
-
</TouchableOpacity>
|
|
372
|
-
</View>
|
|
373
|
-
) : null}
|
|
374
|
-
<View style={styles.apiStatusCard}>
|
|
375
|
-
<Text style={styles.cardTitle}>API Status</Text>
|
|
376
|
-
<View style={styles.apiStatusRow}>
|
|
377
|
-
<View
|
|
378
|
-
style={[
|
|
379
|
-
styles.statusIndicatorDot,
|
|
380
|
-
healthCheck.data
|
|
381
|
-
? styles.statusIndicatorGreen
|
|
382
|
-
: styles.statusIndicatorRed,
|
|
383
|
-
]}
|
|
384
|
-
/>
|
|
385
|
-
<Text style={styles.mutedText}>
|
|
386
|
-
{healthCheck.isLoading
|
|
387
|
-
? "Checking..."
|
|
388
|
-
: healthCheck.data
|
|
389
|
-
? "Connected to API"
|
|
390
|
-
: "API Disconnected"}
|
|
391
|
-
</Text>
|
|
392
|
-
</View>
|
|
393
|
-
</View>
|
|
394
|
-
<View style={styles.privateDataCard}>
|
|
395
|
-
<Text style={styles.cardTitle}>Private Data</Text>
|
|
396
|
-
{privateData && (
|
|
397
|
-
<View>
|
|
398
|
-
<Text style={styles.mutedText}>
|
|
399
|
-
{privateData.data?.message}
|
|
400
|
-
</Text>
|
|
401
|
-
</View>
|
|
402
|
-
)}
|
|
403
|
-
</View>
|
|
404
|
-
{!session?.user && (
|
|
405
|
-
<>
|
|
406
|
-
<SignIn />
|
|
407
|
-
<SignUp />
|
|
408
|
-
</>
|
|
409
|
-
)}
|
|
410
|
-
</View>
|
|
411
|
-
</ScrollView>
|
|
412
|
-
</Container>
|
|
413
|
-
);
|
|
414
|
-
}
|
|
415
|
-
const styles = StyleSheet.create((theme) => ({
|
|
416
|
-
pageContainer: {
|
|
417
|
-
paddingHorizontal: 8,
|
|
418
|
-
},
|
|
419
|
-
headerTitle: {
|
|
420
|
-
color: theme?.colors?.typography,
|
|
421
|
-
fontSize: 30,
|
|
422
|
-
fontWeight: "bold",
|
|
423
|
-
marginBottom: 16,
|
|
424
|
-
},
|
|
425
|
-
sessionInfoCard: {
|
|
426
|
-
marginBottom: 24,
|
|
427
|
-
padding: 16,
|
|
428
|
-
borderRadius: 8,
|
|
429
|
-
borderWidth: 1,
|
|
430
|
-
borderColor: theme?.colors?.border,
|
|
431
|
-
},
|
|
432
|
-
sessionUserRow: {
|
|
433
|
-
flexDirection: "row",
|
|
434
|
-
justifyContent: "space-between",
|
|
435
|
-
alignItems: "center",
|
|
436
|
-
marginBottom: 8,
|
|
437
|
-
},
|
|
438
|
-
welcomeText: {
|
|
439
|
-
color: theme?.colors?.typography,
|
|
440
|
-
fontSize: 16,
|
|
441
|
-
},
|
|
442
|
-
userNameText: {
|
|
443
|
-
fontWeight: "500",
|
|
444
|
-
color: theme?.colors?.typography,
|
|
445
|
-
},
|
|
446
|
-
emailText: {
|
|
447
|
-
color: theme?.colors?.typography,
|
|
448
|
-
fontSize: 14,
|
|
449
|
-
marginBottom: 16,
|
|
450
|
-
},
|
|
451
|
-
signOutButton: {
|
|
452
|
-
backgroundColor: theme?.colors?.destructive,
|
|
453
|
-
paddingVertical: 8,
|
|
454
|
-
paddingHorizontal: 16,
|
|
455
|
-
borderRadius: 6,
|
|
456
|
-
alignSelf: "flex-start",
|
|
457
|
-
},
|
|
458
|
-
signOutButtonText: {
|
|
459
|
-
fontWeight: "500",
|
|
460
|
-
},
|
|
461
|
-
apiStatusCard: {
|
|
462
|
-
marginBottom: 24,
|
|
463
|
-
borderRadius: 8,
|
|
464
|
-
borderWidth: 1,
|
|
465
|
-
borderColor: theme?.colors?.border,
|
|
466
|
-
padding: 16,
|
|
467
|
-
},
|
|
468
|
-
cardTitle: {
|
|
469
|
-
marginBottom: 12,
|
|
470
|
-
fontWeight: "500",
|
|
471
|
-
color: theme?.colors?.typography,
|
|
472
|
-
},
|
|
473
|
-
apiStatusRow: {
|
|
474
|
-
flexDirection: "row",
|
|
475
|
-
alignItems: "center",
|
|
476
|
-
gap: 8,
|
|
477
|
-
},
|
|
478
|
-
statusIndicatorDot: {
|
|
479
|
-
height: 12,
|
|
480
|
-
width: 12,
|
|
481
|
-
borderRadius: 9999,
|
|
482
|
-
},
|
|
483
|
-
statusIndicatorGreen: {
|
|
484
|
-
backgroundColor: theme.colors.success,
|
|
485
|
-
},
|
|
486
|
-
statusIndicatorRed: {
|
|
487
|
-
backgroundColor: theme.colors.destructive,
|
|
488
|
-
},
|
|
489
|
-
mutedText: {
|
|
490
|
-
color: theme?.colors?.typography,
|
|
491
|
-
},
|
|
492
|
-
privateDataCard: {
|
|
493
|
-
marginBottom: 24,
|
|
494
|
-
borderRadius: 8,
|
|
495
|
-
borderWidth: 1,
|
|
496
|
-
borderColor: theme?.colors?.border,
|
|
497
|
-
padding: 16,
|
|
498
|
-
},
|
|
499
|
-
}));
|
|
500
|
-
`,
|
|
501
|
-
type: "text"
|
|
502
|
-
},
|
|
503
|
-
"auth/native/unistyles/components/sign-in.tsx.hbs": {
|
|
504
|
-
metadata: {
|
|
505
|
-
updatedAt: "2025-06-17T06:06:35.000Z",
|
|
506
|
-
updatedHash: "b18567e2a0"
|
|
507
|
-
},
|
|
508
|
-
content: `import { authClient } from "@/lib/auth-client";
|
|
509
|
-
{{#if (eq api "trpc")}}
|
|
510
|
-
import { queryClient } from "@/utils/trpc";
|
|
511
|
-
{{/if}}
|
|
512
|
-
{{#if (eq api "orpc")}}
|
|
513
|
-
import { queryClient } from "@/utils/orpc";
|
|
514
|
-
{{/if}}
|
|
515
|
-
import { useState } from "react";
|
|
516
|
-
import {
|
|
517
|
-
ActivityIndicator,
|
|
518
|
-
Text,
|
|
519
|
-
TextInput,
|
|
520
|
-
TouchableOpacity,
|
|
521
|
-
View,
|
|
522
|
-
} from "react-native";
|
|
523
|
-
import { StyleSheet } from "react-native-unistyles";
|
|
524
|
-
export function SignIn() {
|
|
525
|
-
const [email, setEmail] = useState("");
|
|
526
|
-
const [password, setPassword] = useState("");
|
|
527
|
-
const [isLoading, setIsLoading] = useState(false);
|
|
528
|
-
const [error, setError] = useState<string | null>(null);
|
|
529
|
-
const handleLogin = async () => {
|
|
530
|
-
setIsLoading(true);
|
|
531
|
-
setError(null);
|
|
532
|
-
await authClient.signIn.email(
|
|
533
|
-
{
|
|
534
|
-
email,
|
|
535
|
-
password,
|
|
536
|
-
},
|
|
537
|
-
{
|
|
538
|
-
onError: (error) => {
|
|
539
|
-
setError(error.error?.message || "Failed to sign in");
|
|
540
|
-
setIsLoading(false);
|
|
541
|
-
},
|
|
542
|
-
onSuccess: () => {
|
|
543
|
-
setEmail("");
|
|
544
|
-
setPassword("");
|
|
545
|
-
queryClient.refetchQueries();
|
|
546
|
-
},
|
|
547
|
-
onFinished: () => {
|
|
548
|
-
setIsLoading(false);
|
|
549
|
-
},
|
|
550
|
-
},
|
|
551
|
-
);
|
|
552
|
-
};
|
|
553
|
-
return (
|
|
554
|
-
<View style={styles.container}>
|
|
555
|
-
<Text style={styles.title}>Sign In</Text>
|
|
556
|
-
{error && (
|
|
557
|
-
<View style={styles.errorContainer}>
|
|
558
|
-
<Text style={styles.errorText}>{error}</Text>
|
|
559
|
-
</View>
|
|
560
|
-
)}
|
|
561
|
-
<TextInput
|
|
562
|
-
style={styles.input}
|
|
563
|
-
placeholder="Email"
|
|
564
|
-
value={email}
|
|
565
|
-
onChangeText={setEmail}
|
|
566
|
-
keyboardType="email-address"
|
|
567
|
-
autoCapitalize="none"
|
|
568
|
-
/>
|
|
569
|
-
<TextInput
|
|
570
|
-
style={styles.input}
|
|
571
|
-
placeholder="Password"
|
|
572
|
-
value={password}
|
|
573
|
-
onChangeText={setPassword}
|
|
574
|
-
secureTextEntry
|
|
575
|
-
/>
|
|
576
|
-
<TouchableOpacity
|
|
577
|
-
onPress={handleLogin}
|
|
578
|
-
disabled={isLoading}
|
|
579
|
-
style={styles.button}
|
|
580
|
-
>
|
|
581
|
-
{isLoading ? (
|
|
582
|
-
<ActivityIndicator size="small" color="#fff" />
|
|
583
|
-
) : (
|
|
584
|
-
<Text style={styles.buttonText}>Sign In</Text>
|
|
585
|
-
)}
|
|
586
|
-
</TouchableOpacity>
|
|
587
|
-
</View>
|
|
588
|
-
);
|
|
589
|
-
}
|
|
590
|
-
const styles = StyleSheet.create((theme) => ({
|
|
591
|
-
container: {
|
|
592
|
-
marginTop: 24,
|
|
593
|
-
padding: 16,
|
|
594
|
-
borderRadius: 8,
|
|
595
|
-
borderWidth: 1,
|
|
596
|
-
borderColor: theme.colors.border,
|
|
597
|
-
},
|
|
598
|
-
title: {
|
|
599
|
-
fontSize: 18,
|
|
600
|
-
fontWeight: "600",
|
|
601
|
-
color: theme.colors.typography,
|
|
602
|
-
marginBottom: 16,
|
|
603
|
-
},
|
|
604
|
-
errorContainer: {
|
|
605
|
-
marginBottom: 16,
|
|
606
|
-
padding: 12,
|
|
607
|
-
borderRadius: 6,
|
|
608
|
-
},
|
|
609
|
-
errorText: {
|
|
610
|
-
color: theme.colors.destructive,
|
|
611
|
-
fontSize: 14,
|
|
612
|
-
},
|
|
613
|
-
input: {
|
|
614
|
-
marginBottom: 12,
|
|
615
|
-
padding: 16,
|
|
616
|
-
borderRadius: 6,
|
|
617
|
-
color: theme.colors.typography,
|
|
618
|
-
borderWidth: 1,
|
|
619
|
-
borderColor: theme.colors.border,
|
|
620
|
-
},
|
|
621
|
-
button: {
|
|
622
|
-
backgroundColor: theme.colors.primary,
|
|
623
|
-
padding: 16,
|
|
624
|
-
borderRadius: 6,
|
|
625
|
-
flexDirection: "row",
|
|
626
|
-
justifyContent: "center",
|
|
627
|
-
alignItems: "center",
|
|
628
|
-
},
|
|
629
|
-
buttonText: {
|
|
630
|
-
fontWeight: "500",
|
|
631
|
-
},
|
|
632
|
-
}));
|
|
633
|
-
`,
|
|
634
|
-
type: "text"
|
|
635
|
-
},
|
|
636
|
-
"auth/native/unistyles/components/sign-up.tsx.hbs": {
|
|
637
|
-
metadata: {
|
|
638
|
-
updatedAt: "2025-06-17T06:06:35.000Z",
|
|
639
|
-
updatedHash: "6d011348a6"
|
|
640
|
-
},
|
|
641
|
-
content: `import { authClient } from "@/lib/auth-client";
|
|
642
|
-
{{#if (eq api "trpc")}}
|
|
643
|
-
import { queryClient } from "@/utils/trpc";
|
|
644
|
-
{{/if}}
|
|
645
|
-
{{#if (eq api "orpc")}}
|
|
646
|
-
import { queryClient } from "@/utils/orpc";
|
|
647
|
-
{{/if}}
|
|
648
|
-
import { useState } from "react";
|
|
649
|
-
import {
|
|
650
|
-
ActivityIndicator,
|
|
651
|
-
Text,
|
|
652
|
-
TextInput,
|
|
653
|
-
TouchableOpacity,
|
|
654
|
-
View,
|
|
655
|
-
} from "react-native";
|
|
656
|
-
import { StyleSheet } from "react-native-unistyles";
|
|
657
|
-
export function SignUp() {
|
|
658
|
-
const [name, setName] = useState("");
|
|
659
|
-
const [email, setEmail] = useState("");
|
|
660
|
-
const [password, setPassword] = useState("");
|
|
661
|
-
const [isLoading, setIsLoading] = useState(false);
|
|
662
|
-
const [error, setError] = useState<string | null>(null);
|
|
663
|
-
const handleSignUp = async () => {
|
|
664
|
-
setIsLoading(true);
|
|
665
|
-
setError(null);
|
|
666
|
-
await authClient.signUp.email(
|
|
667
|
-
{
|
|
668
|
-
name,
|
|
669
|
-
email,
|
|
670
|
-
password,
|
|
671
|
-
},
|
|
672
|
-
{
|
|
673
|
-
onError: (error) => {
|
|
674
|
-
setError(error.error?.message || "Failed to sign up");
|
|
675
|
-
setIsLoading(false);
|
|
676
|
-
},
|
|
677
|
-
onSuccess: () => {
|
|
678
|
-
setName("");
|
|
679
|
-
setEmail("");
|
|
680
|
-
setPassword("");
|
|
681
|
-
queryClient.refetchQueries();
|
|
682
|
-
},
|
|
683
|
-
onFinished: () => {
|
|
684
|
-
setIsLoading(false);
|
|
685
|
-
},
|
|
686
|
-
},
|
|
687
|
-
);
|
|
688
|
-
};
|
|
689
|
-
return (
|
|
690
|
-
<View style={styles.container}>
|
|
691
|
-
<Text style={styles.title}>Create Account</Text>
|
|
692
|
-
{error && (
|
|
693
|
-
<View style={styles.errorContainer}>
|
|
694
|
-
<Text style={styles.errorText}>{error}</Text>
|
|
695
|
-
</View>
|
|
696
|
-
)}
|
|
697
|
-
<TextInput
|
|
698
|
-
style={styles.input}
|
|
699
|
-
placeholder="Name"
|
|
700
|
-
value={name}
|
|
701
|
-
onChangeText={setName}
|
|
702
|
-
/>
|
|
703
|
-
<TextInput
|
|
704
|
-
style={styles.input}
|
|
705
|
-
placeholder="Email"
|
|
706
|
-
value={email}
|
|
707
|
-
onChangeText={setEmail}
|
|
708
|
-
keyboardType="email-address"
|
|
709
|
-
autoCapitalize="none"
|
|
710
|
-
/>
|
|
711
|
-
<TextInput
|
|
712
|
-
style={styles.inputLast}
|
|
713
|
-
placeholder="Password"
|
|
714
|
-
value={password}
|
|
715
|
-
onChangeText={setPassword}
|
|
716
|
-
secureTextEntry
|
|
717
|
-
/>
|
|
718
|
-
<TouchableOpacity
|
|
719
|
-
onPress={handleSignUp}
|
|
720
|
-
disabled={isLoading}
|
|
721
|
-
style={styles.button}
|
|
722
|
-
>
|
|
723
|
-
{isLoading ? (
|
|
724
|
-
<ActivityIndicator size="small" color="#fff" />
|
|
725
|
-
) : (
|
|
726
|
-
<Text style={styles.buttonText}>Sign Up</Text>
|
|
727
|
-
)}
|
|
728
|
-
</TouchableOpacity>
|
|
729
|
-
</View>
|
|
730
|
-
);
|
|
731
|
-
}
|
|
732
|
-
const styles = StyleSheet.create((theme) => ({
|
|
733
|
-
container: {
|
|
734
|
-
marginTop: 24,
|
|
735
|
-
padding: 16,
|
|
736
|
-
borderRadius: 8,
|
|
737
|
-
borderWidth: 1,
|
|
738
|
-
borderColor: theme.colors.border,
|
|
739
|
-
},
|
|
740
|
-
title: {
|
|
741
|
-
fontSize: 18,
|
|
742
|
-
fontWeight: "600",
|
|
743
|
-
color: theme.colors.typography,
|
|
744
|
-
marginBottom: 16,
|
|
745
|
-
},
|
|
746
|
-
errorContainer: {
|
|
747
|
-
marginBottom: 16,
|
|
748
|
-
padding: 12,
|
|
749
|
-
borderRadius: 6,
|
|
750
|
-
},
|
|
751
|
-
errorText: {
|
|
752
|
-
color: theme.colors.destructive,
|
|
753
|
-
fontSize: 14,
|
|
754
|
-
},
|
|
755
|
-
input: {
|
|
756
|
-
marginBottom: 12,
|
|
757
|
-
padding: 16,
|
|
758
|
-
borderRadius: 6,
|
|
759
|
-
color: theme.colors.typography,
|
|
760
|
-
borderWidth: 1,
|
|
761
|
-
borderColor: theme.colors.border,
|
|
762
|
-
},
|
|
763
|
-
inputLast: {
|
|
764
|
-
marginBottom: 16,
|
|
765
|
-
padding: 16,
|
|
766
|
-
borderRadius: 6,
|
|
767
|
-
color: theme.colors.typography,
|
|
768
|
-
borderWidth: 1,
|
|
769
|
-
borderColor: theme.colors.border,
|
|
770
|
-
},
|
|
771
|
-
button: {
|
|
772
|
-
backgroundColor: theme.colors.primary,
|
|
773
|
-
padding: 16,
|
|
774
|
-
borderRadius: 6,
|
|
775
|
-
flexDirection: "row",
|
|
776
|
-
justifyContent: "center",
|
|
777
|
-
alignItems: "center",
|
|
778
|
-
},
|
|
779
|
-
buttonText: {
|
|
780
|
-
fontWeight: "500",
|
|
781
|
-
},
|
|
782
|
-
}));
|
|
783
|
-
`,
|
|
784
|
-
type: "text"
|
|
785
|
-
},
|
|
786
|
-
"auth/server/base/src/lib/auth.ts.hbs": {
|
|
787
|
-
metadata: {
|
|
788
|
-
updatedAt: "2025-06-17T06:06:35.000Z",
|
|
789
|
-
updatedHash: "70bcb75db7"
|
|
790
|
-
},
|
|
791
|
-
content: `{{#if (eq orm "prisma")}}
|
|
792
|
-
import { betterAuth } from "better-auth";
|
|
793
|
-
import { prismaAdapter } from "better-auth/adapters/prisma";
|
|
794
|
-
{{#if (or (includes frontend "native-nativewind") (includes frontend "native-unistyles"))}}
|
|
795
|
-
import { expo } from "@better-auth/expo";
|
|
796
|
-
{{/if}}
|
|
797
|
-
import prisma from "../../prisma";
|
|
798
|
-
export const auth = betterAuth({
|
|
799
|
-
database: prismaAdapter(prisma, {
|
|
800
|
-
{{#if (eq database "postgres")}}provider: "postgresql"{{/if}}
|
|
801
|
-
{{#if (eq database "sqlite")}}provider: "sqlite"{{/if}}
|
|
802
|
-
{{#if (eq database "mysql")}}provider: "mysql"{{/if}}
|
|
803
|
-
{{#if (eq database "mongodb")}}provider: "mongodb"{{/if}}
|
|
804
|
-
}),
|
|
805
|
-
trustedOrigins: [
|
|
806
|
-
process.env.CORS_ORIGIN || "",
|
|
807
|
-
{{#if (or (includes frontend "native-nativewind") (includes frontend "native-unistyles"))}}
|
|
808
|
-
"my-better-t-app://",
|
|
809
|
-
{{/if}}
|
|
810
|
-
],
|
|
811
|
-
emailAndPassword: {
|
|
812
|
-
enabled: true,
|
|
813
|
-
}
|
|
814
|
-
{{#if (or (includes frontend "native-nativewind") (includes frontend "native-unistyles"))}}
|
|
815
|
-
, plugins: [expo()]
|
|
816
|
-
{{/if}}
|
|
817
|
-
});
|
|
818
|
-
{{/if}}
|
|
819
|
-
{{#if (eq orm "drizzle")}}
|
|
820
|
-
{{#if (or (eq runtime "bun") (eq runtime "node"))}}
|
|
821
|
-
import { betterAuth } from "better-auth";
|
|
822
|
-
import { drizzleAdapter } from "better-auth/adapters/drizzle";
|
|
823
|
-
{{#if (or (includes frontend "native-nativewind") (includes frontend "native-unistyles"))}}
|
|
824
|
-
import { expo } from "@better-auth/expo";
|
|
825
|
-
{{/if}}
|
|
826
|
-
import { db } from "../db";
|
|
827
|
-
import * as schema from "../db/schema/auth";
|
|
828
|
-
export const auth = betterAuth({
|
|
829
|
-
database: drizzleAdapter(db, {
|
|
830
|
-
{{#if (eq database "postgres")}}provider: "pg",{{/if}}
|
|
831
|
-
{{#if (eq database "sqlite")}}provider: "sqlite",{{/if}}
|
|
832
|
-
{{#if (eq database "mysql")}}provider: "mysql",{{/if}}
|
|
833
|
-
schema: schema,
|
|
834
|
-
}),
|
|
835
|
-
trustedOrigins: [
|
|
836
|
-
process.env.CORS_ORIGIN || "",
|
|
837
|
-
{{#if (or (includes frontend "native-nativewind") (includes frontend "native-unistyles"))}}
|
|
838
|
-
"my-better-t-app://",
|
|
839
|
-
{{/if}}
|
|
840
|
-
],
|
|
841
|
-
emailAndPassword: {
|
|
842
|
-
enabled: true,
|
|
843
|
-
},
|
|
844
|
-
secret: process.env.BETTER_AUTH_SECRET,
|
|
845
|
-
baseURL: process.env.BETTER_AUTH_URL,
|
|
846
|
-
{{#if (or (includes frontend "native-nativewind") (includes frontend "native-unistyles"))}}
|
|
847
|
-
plugins: [expo()],
|
|
848
|
-
{{/if}}
|
|
849
|
-
});
|
|
850
|
-
{{/if}}
|
|
851
|
-
{{#if (eq runtime "workers")}}
|
|
852
|
-
import { betterAuth } from "better-auth";
|
|
853
|
-
import { drizzleAdapter } from "better-auth/adapters/drizzle";
|
|
854
|
-
{{#if (or (includes frontend "native-nativewind") (includes frontend "native-unistyles"))}}
|
|
855
|
-
import { expo } from "@better-auth/expo";
|
|
856
|
-
{{/if}}
|
|
857
|
-
import { db } from "@/db";
|
|
858
|
-
import * as schema from "../db/schema/auth";
|
|
859
|
-
import { env } from "cloudflare:workers";
|
|
860
|
-
export const auth = betterAuth({
|
|
861
|
-
database: drizzleAdapter(db, {
|
|
862
|
-
{{#if (eq database "postgres")}}provider: "pg",{{/if}}
|
|
863
|
-
{{#if (eq database "sqlite")}}provider: "sqlite",{{/if}}
|
|
864
|
-
{{#if (eq database "mysql")}}provider: "mysql",{{/if}}
|
|
865
|
-
schema: schema,
|
|
866
|
-
}),
|
|
867
|
-
trustedOrigins: [env.CORS_ORIGIN],
|
|
868
|
-
emailAndPassword: {
|
|
869
|
-
enabled: true,
|
|
870
|
-
},
|
|
871
|
-
secret: env.BETTER_AUTH_SECRET,
|
|
872
|
-
baseURL: env.BETTER_AUTH_URL,
|
|
873
|
-
{{#if (or (includes frontend "native-nativewind") (includes frontend "native-unistyles"))}}
|
|
874
|
-
plugins: [expo()],
|
|
875
|
-
{{/if}}
|
|
876
|
-
});
|
|
877
|
-
{{/if}}
|
|
878
|
-
{{/if}}
|
|
879
|
-
{{#if (eq orm "mongoose")}}
|
|
880
|
-
import { betterAuth } from "better-auth";
|
|
881
|
-
import { mongodbAdapter } from "better-auth/adapters/mongodb";
|
|
882
|
-
{{#if (or (includes frontend "native-nativewind") (includes frontend "native-unistyles"))}}
|
|
883
|
-
import { expo } from "@better-auth/expo";
|
|
884
|
-
{{/if}}
|
|
885
|
-
import { client } from "../db";
|
|
886
|
-
export const auth = betterAuth({
|
|
887
|
-
database: mongodbAdapter(client),
|
|
888
|
-
trustedOrigins: [
|
|
889
|
-
process.env.CORS_ORIGIN || "",
|
|
890
|
-
{{#if (or (includes frontend "native-nativewind") (includes frontend "native-unistyles"))}}
|
|
891
|
-
"my-better-t-app://",
|
|
892
|
-
{{/if}}
|
|
893
|
-
],
|
|
894
|
-
emailAndPassword: {
|
|
895
|
-
enabled: true,
|
|
896
|
-
}
|
|
897
|
-
{{#if (or (includes frontend "native-nativewind") (includes frontend "native-unistyles"))}}
|
|
898
|
-
, plugins: [expo()]
|
|
899
|
-
{{/if}}
|
|
900
|
-
});
|
|
901
|
-
{{/if}}
|
|
902
|
-
{{#if (eq orm "none")}}
|
|
903
|
-
import { betterAuth } from "better-auth";
|
|
904
|
-
{{#if (or (includes frontend "native-nativewind") (includes frontend "native-unistyles"))}}
|
|
905
|
-
import { expo } from "@better-auth/expo";
|
|
906
|
-
{{/if}}
|
|
907
|
-
export const auth = betterAuth({
|
|
908
|
-
database: "", // Invalid configuration
|
|
909
|
-
trustedOrigins: [
|
|
910
|
-
process.env.CORS_ORIGIN || "",
|
|
911
|
-
{{#if (or (includes frontend "native-nativewind") (includes frontend "native-unistyles"))}}
|
|
912
|
-
"my-better-t-app://",
|
|
913
|
-
{{/if}}
|
|
914
|
-
],
|
|
915
|
-
emailAndPassword: {
|
|
916
|
-
enabled: true,
|
|
917
|
-
}
|
|
918
|
-
{{#if (or (includes frontend "native-nativewind") (includes frontend "native-unistyles"))}}
|
|
919
|
-
, plugins: [expo()]
|
|
920
|
-
{{/if}}
|
|
921
|
-
});
|
|
922
|
-
{{/if}}
|
|
923
|
-
`,
|
|
924
|
-
type: "text"
|
|
925
|
-
},
|
|
926
|
-
"auth/server/db/drizzle/mysql/src/db/schema/auth.ts": {
|
|
927
|
-
metadata: {
|
|
928
|
-
updatedAt: "2025-06-17T06:06:35.000Z",
|
|
929
|
-
updatedHash: "f865fa9316"
|
|
930
|
-
},
|
|
931
|
-
content: `import {
|
|
932
|
-
mysqlTable,
|
|
933
|
-
varchar,
|
|
934
|
-
text,
|
|
935
|
-
timestamp,
|
|
936
|
-
boolean,
|
|
937
|
-
} from "drizzle-orm/mysql-core";
|
|
938
|
-
export const user = mysqlTable("user", {
|
|
939
|
-
id: varchar("id", { length: 36 }).primaryKey(),
|
|
940
|
-
name: text("name").notNull(),
|
|
941
|
-
email: varchar("email", { length: 255 }).notNull().unique(),
|
|
942
|
-
emailVerified: boolean("email_verified").notNull(),
|
|
943
|
-
image: text("image"),
|
|
944
|
-
createdAt: timestamp("created_at").notNull(),
|
|
945
|
-
updatedAt: timestamp("updated_at").notNull(),
|
|
946
|
-
});
|
|
947
|
-
export const session = mysqlTable("session", {
|
|
948
|
-
id: varchar("id", { length: 36 }).primaryKey(),
|
|
949
|
-
expiresAt: timestamp("expires_at").notNull(),
|
|
950
|
-
token: varchar("token", { length: 255 }).notNull().unique(),
|
|
951
|
-
createdAt: timestamp("created_at").notNull(),
|
|
952
|
-
updatedAt: timestamp("updated_at").notNull(),
|
|
953
|
-
ipAddress: text("ip_address"),
|
|
954
|
-
userAgent: text("user_agent"),
|
|
955
|
-
userId: varchar("user_id", { length: 36 })
|
|
956
|
-
.notNull()
|
|
957
|
-
.references(() => user.id, { onDelete: "cascade" }),
|
|
958
|
-
});
|
|
959
|
-
export const account = mysqlTable("account", {
|
|
960
|
-
id: varchar("id", { length: 36 }).primaryKey(),
|
|
961
|
-
accountId: text("account_id").notNull(),
|
|
962
|
-
providerId: text("provider_id").notNull(),
|
|
963
|
-
userId: varchar("user_id", { length: 36 })
|
|
964
|
-
.notNull()
|
|
965
|
-
.references(() => user.id, { onDelete: "cascade" }),
|
|
966
|
-
accessToken: text("access_token"),
|
|
967
|
-
refreshToken: text("refresh_token"),
|
|
968
|
-
idToken: text("id_token"),
|
|
969
|
-
accessTokenExpiresAt: timestamp("access_token_expires_at"),
|
|
970
|
-
refreshTokenExpiresAt: timestamp("refresh_token_expires_at"),
|
|
971
|
-
scope: text("scope"),
|
|
972
|
-
password: text("password"),
|
|
973
|
-
createdAt: timestamp("created_at").notNull(),
|
|
974
|
-
updatedAt: timestamp("updated_at").notNull(),
|
|
975
|
-
});
|
|
976
|
-
export const verification = mysqlTable("verification", {
|
|
977
|
-
id: varchar("id", { length: 36 }).primaryKey(),
|
|
978
|
-
identifier: text("identifier").notNull(),
|
|
979
|
-
value: text("value").notNull(),
|
|
980
|
-
expiresAt: timestamp("expires_at").notNull(),
|
|
981
|
-
createdAt: timestamp("created_at"),
|
|
982
|
-
updatedAt: timestamp("updated_at"),
|
|
983
|
-
});
|
|
984
|
-
`,
|
|
985
|
-
type: "text"
|
|
986
|
-
},
|
|
987
|
-
"auth/server/db/drizzle/postgres/src/db/schema/auth.ts": {
|
|
988
|
-
metadata: {
|
|
989
|
-
updatedAt: "2025-06-17T06:06:35.000Z",
|
|
990
|
-
updatedHash: "11be4c3757"
|
|
991
|
-
},
|
|
992
|
-
content: `import { pgTable, text, timestamp, boolean, serial } from "drizzle-orm/pg-core";
|
|
993
|
-
export const user = pgTable("user", {
|
|
994
|
-
id: text("id").primaryKey(),
|
|
995
|
-
name: text('name').notNull(),
|
|
996
|
-
email: text('email').notNull().unique(),
|
|
997
|
-
emailVerified: boolean('email_verified').notNull(),
|
|
998
|
-
image: text('image'),
|
|
999
|
-
createdAt: timestamp('created_at').notNull(),
|
|
1000
|
-
updatedAt: timestamp('updated_at').notNull()
|
|
1001
|
-
});
|
|
1002
|
-
export const session = pgTable("session", {
|
|
1003
|
-
id: text("id").primaryKey(),
|
|
1004
|
-
expiresAt: timestamp('expires_at').notNull(),
|
|
1005
|
-
token: text('token').notNull().unique(),
|
|
1006
|
-
createdAt: timestamp('created_at').notNull(),
|
|
1007
|
-
updatedAt: timestamp('updated_at').notNull(),
|
|
1008
|
-
ipAddress: text('ip_address'),
|
|
1009
|
-
userAgent: text('user_agent'),
|
|
1010
|
-
userId: text('user_id').notNull().references(()=> user.id, { onDelete: 'cascade' })
|
|
1011
|
-
});
|
|
1012
|
-
export const account = pgTable("account", {
|
|
1013
|
-
id: text("id").primaryKey(),
|
|
1014
|
-
accountId: text('account_id').notNull(),
|
|
1015
|
-
providerId: text('provider_id').notNull(),
|
|
1016
|
-
userId: text('user_id').notNull().references(()=> user.id, { onDelete: 'cascade' }),
|
|
1017
|
-
accessToken: text('access_token'),
|
|
1018
|
-
refreshToken: text('refresh_token'),
|
|
1019
|
-
idToken: text('id_token'),
|
|
1020
|
-
accessTokenExpiresAt: timestamp('access_token_expires_at'),
|
|
1021
|
-
refreshTokenExpiresAt: timestamp('refresh_token_expires_at'),
|
|
1022
|
-
scope: text('scope'),
|
|
1023
|
-
password: text('password'),
|
|
1024
|
-
createdAt: timestamp('created_at').notNull(),
|
|
1025
|
-
updatedAt: timestamp('updated_at').notNull()
|
|
1026
|
-
});
|
|
1027
|
-
export const verification = pgTable("verification", {
|
|
1028
|
-
id: text("id").primaryKey(),
|
|
1029
|
-
identifier: text('identifier').notNull(),
|
|
1030
|
-
value: text('value').notNull(),
|
|
1031
|
-
expiresAt: timestamp('expires_at').notNull(),
|
|
1032
|
-
createdAt: timestamp('created_at'),
|
|
1033
|
-
updatedAt: timestamp('updated_at')
|
|
1034
|
-
});
|
|
1035
|
-
`,
|
|
1036
|
-
type: "text"
|
|
1037
|
-
},
|
|
1038
|
-
"auth/server/db/drizzle/sqlite/src/db/schema/auth.ts": {
|
|
1039
|
-
metadata: {
|
|
1040
|
-
updatedAt: "2025-06-17T06:06:35.000Z",
|
|
1041
|
-
updatedHash: "2fd698c3c5"
|
|
1042
|
-
},
|
|
1043
|
-
content: `import { sqliteTable, text, integer } from "drizzle-orm/sqlite-core";
|
|
1044
|
-
export const user = sqliteTable("user", {
|
|
1045
|
-
id: text("id").primaryKey(),
|
|
1046
|
-
name: text("name").notNull(),
|
|
1047
|
-
email: text("email").notNull().unique(),
|
|
1048
|
-
emailVerified: integer("email_verified", { mode: "boolean" }).notNull(),
|
|
1049
|
-
image: text("image"),
|
|
1050
|
-
createdAt: integer("created_at", { mode: "timestamp" }).notNull(),
|
|
1051
|
-
updatedAt: integer("updated_at", { mode: "timestamp" }).notNull(),
|
|
1052
|
-
});
|
|
1053
|
-
export const session = sqliteTable("session", {
|
|
1054
|
-
id: text("id").primaryKey(),
|
|
1055
|
-
expiresAt: integer("expires_at", { mode: "timestamp" }).notNull(),
|
|
1056
|
-
token: text("token").notNull().unique(),
|
|
1057
|
-
createdAt: integer("created_at", { mode: "timestamp" }).notNull(),
|
|
1058
|
-
updatedAt: integer("updated_at", { mode: "timestamp" }).notNull(),
|
|
1059
|
-
ipAddress: text("ip_address"),
|
|
1060
|
-
userAgent: text("user_agent"),
|
|
1061
|
-
userId: text("user_id")
|
|
1062
|
-
.notNull()
|
|
1063
|
-
.references(() => user.id),
|
|
1064
|
-
});
|
|
1065
|
-
export const account = sqliteTable("account", {
|
|
1066
|
-
id: text("id").primaryKey(),
|
|
1067
|
-
accountId: text("account_id").notNull(),
|
|
1068
|
-
providerId: text("provider_id").notNull(),
|
|
1069
|
-
userId: text("user_id")
|
|
1070
|
-
.notNull()
|
|
1071
|
-
.references(() => user.id),
|
|
1072
|
-
accessToken: text("access_token"),
|
|
1073
|
-
refreshToken: text("refresh_token"),
|
|
1074
|
-
idToken: text("id_token"),
|
|
1075
|
-
accessTokenExpiresAt: integer("access_token_expires_at", {
|
|
1076
|
-
mode: "timestamp",
|
|
1077
|
-
}),
|
|
1078
|
-
refreshTokenExpiresAt: integer("refresh_token_expires_at", {
|
|
1079
|
-
mode: "timestamp",
|
|
1080
|
-
}),
|
|
1081
|
-
scope: text("scope"),
|
|
1082
|
-
password: text("password"),
|
|
1083
|
-
createdAt: integer("created_at", { mode: "timestamp" }).notNull(),
|
|
1084
|
-
updatedAt: integer("updated_at", { mode: "timestamp" }).notNull(),
|
|
1085
|
-
});
|
|
1086
|
-
export const verification = sqliteTable("verification", {
|
|
1087
|
-
id: text("id").primaryKey(),
|
|
1088
|
-
identifier: text("identifier").notNull(),
|
|
1089
|
-
value: text("value").notNull(),
|
|
1090
|
-
expiresAt: integer("expires_at", { mode: "timestamp" }).notNull(),
|
|
1091
|
-
createdAt: integer("created_at", { mode: "timestamp" }),
|
|
1092
|
-
updatedAt: integer("updated_at", { mode: "timestamp" }),
|
|
1093
|
-
});
|
|
1094
|
-
`,
|
|
1095
|
-
type: "text"
|
|
1096
|
-
},
|
|
1097
|
-
"auth/server/db/mongoose/mongodb/src/db/models/auth.model.ts": {
|
|
1098
|
-
metadata: {
|
|
1099
|
-
updatedAt: "2025-06-17T06:06:35.000Z",
|
|
1100
|
-
updatedHash: "844c2e8227"
|
|
1101
|
-
},
|
|
1102
|
-
content: `import mongoose from 'mongoose';
|
|
1103
|
-
const { Schema, model } = mongoose;
|
|
1104
|
-
const userSchema = new Schema(
|
|
1105
|
-
{
|
|
1106
|
-
_id: { type: String },
|
|
1107
|
-
name: { type: String, required: true },
|
|
1108
|
-
email: { type: String, required: true, unique: true },
|
|
1109
|
-
emailVerified: { type: Boolean, required: true },
|
|
1110
|
-
image: { type: String },
|
|
1111
|
-
createdAt: { type: Date, required: true },
|
|
1112
|
-
updatedAt: { type: Date, required: true },
|
|
1113
|
-
},
|
|
1114
|
-
{ collection: 'user' }
|
|
1115
|
-
);
|
|
1116
|
-
const sessionSchema = new Schema(
|
|
1117
|
-
{
|
|
1118
|
-
_id: { type: String },
|
|
1119
|
-
expiresAt: { type: Date, required: true },
|
|
1120
|
-
token: { type: String, required: true, unique: true },
|
|
1121
|
-
createdAt: { type: Date, required: true },
|
|
1122
|
-
updatedAt: { type: Date, required: true },
|
|
1123
|
-
ipAddress: { type: String },
|
|
1124
|
-
userAgent: { type: String },
|
|
1125
|
-
userId: { type: String, ref: 'User', required: true },
|
|
1126
|
-
},
|
|
1127
|
-
{ collection: 'session' }
|
|
1128
|
-
);
|
|
1129
|
-
const accountSchema = new Schema(
|
|
1130
|
-
{
|
|
1131
|
-
_id: { type: String },
|
|
1132
|
-
accountId: { type: String, required: true },
|
|
1133
|
-
providerId: { type: String, required: true },
|
|
1134
|
-
userId: { type: String, ref: 'User', required: true },
|
|
1135
|
-
accessToken: { type: String },
|
|
1136
|
-
refreshToken: { type: String },
|
|
1137
|
-
idToken: { type: String },
|
|
1138
|
-
accessTokenExpiresAt: { type: Date },
|
|
1139
|
-
refreshTokenExpiresAt: { type: Date },
|
|
1140
|
-
scope: { type: String },
|
|
1141
|
-
password: { type: String },
|
|
1142
|
-
createdAt: { type: Date, required: true },
|
|
1143
|
-
updatedAt: { type: Date, required: true },
|
|
1144
|
-
},
|
|
1145
|
-
{ collection: 'account' }
|
|
1146
|
-
);
|
|
1147
|
-
const verificationSchema = new Schema(
|
|
1148
|
-
{
|
|
1149
|
-
_id: { type: String },
|
|
1150
|
-
identifier: { type: String, required: true },
|
|
1151
|
-
value: { type: String, required: true },
|
|
1152
|
-
expiresAt: { type: Date, required: true },
|
|
1153
|
-
createdAt: { type: Date },
|
|
1154
|
-
updatedAt: { type: Date },
|
|
1155
|
-
},
|
|
1156
|
-
{ collection: 'verification' }
|
|
1157
|
-
);
|
|
1158
|
-
const User = model('User', userSchema);
|
|
1159
|
-
const Session = model('Session', sessionSchema);
|
|
1160
|
-
const Account = model('Account', accountSchema);
|
|
1161
|
-
const Verification = model('Verification', verificationSchema);
|
|
1162
|
-
export { User, Session, Account, Verification };
|
|
1163
|
-
`,
|
|
1164
|
-
type: "text"
|
|
1165
|
-
},
|
|
1166
|
-
"auth/server/db/prisma/mongodb/prisma/schema/auth.prisma": {
|
|
1167
|
-
metadata: {
|
|
1168
|
-
updatedAt: "2025-06-17T06:06:35.000Z",
|
|
1169
|
-
updatedHash: "ef642790d1"
|
|
1170
|
-
},
|
|
1171
|
-
content: `model User {
|
|
1172
|
-
id String @id @map("_id")
|
|
1173
|
-
name String
|
|
1174
|
-
email String
|
|
1175
|
-
emailVerified Boolean
|
|
1176
|
-
image String?
|
|
1177
|
-
createdAt DateTime
|
|
1178
|
-
updatedAt DateTime
|
|
1179
|
-
sessions Session[]
|
|
1180
|
-
accounts Account[]
|
|
1181
|
-
@@unique([email])
|
|
1182
|
-
@@map("user")
|
|
1183
|
-
}
|
|
1184
|
-
model Session {
|
|
1185
|
-
id String @id @map("_id")
|
|
1186
|
-
expiresAt DateTime
|
|
1187
|
-
token String
|
|
1188
|
-
createdAt DateTime
|
|
1189
|
-
updatedAt DateTime
|
|
1190
|
-
ipAddress String?
|
|
1191
|
-
userAgent String?
|
|
1192
|
-
userId String
|
|
1193
|
-
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
1194
|
-
@@unique([token])
|
|
1195
|
-
@@map("session")
|
|
1196
|
-
}
|
|
1197
|
-
model Account {
|
|
1198
|
-
id String @id @map("_id")
|
|
1199
|
-
accountId String
|
|
1200
|
-
providerId String
|
|
1201
|
-
userId String
|
|
1202
|
-
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
1203
|
-
accessToken String?
|
|
1204
|
-
refreshToken String?
|
|
1205
|
-
idToken String?
|
|
1206
|
-
accessTokenExpiresAt DateTime?
|
|
1207
|
-
refreshTokenExpiresAt DateTime?
|
|
1208
|
-
scope String?
|
|
1209
|
-
password String?
|
|
1210
|
-
createdAt DateTime
|
|
1211
|
-
updatedAt DateTime
|
|
1212
|
-
@@map("account")
|
|
1213
|
-
}
|
|
1214
|
-
model Verification {
|
|
1215
|
-
id String @id @map("_id")
|
|
1216
|
-
identifier String
|
|
1217
|
-
value String
|
|
1218
|
-
expiresAt DateTime
|
|
1219
|
-
createdAt DateTime?
|
|
1220
|
-
updatedAt DateTime?
|
|
1221
|
-
@@map("verification")
|
|
1222
|
-
}
|
|
1223
|
-
`,
|
|
1224
|
-
type: "text"
|
|
1225
|
-
},
|
|
1226
|
-
"auth/server/db/prisma/mysql/prisma/schema/auth.prisma": {
|
|
1227
|
-
metadata: {
|
|
1228
|
-
updatedAt: "2025-06-17T06:06:35.000Z",
|
|
1229
|
-
updatedHash: "f747cb428d"
|
|
1230
|
-
},
|
|
1231
|
-
content: `model User {
|
|
1232
|
-
id String @id
|
|
1233
|
-
name String @db.Text
|
|
1234
|
-
email String
|
|
1235
|
-
emailVerified Boolean
|
|
1236
|
-
image String? @db.Text
|
|
1237
|
-
createdAt DateTime
|
|
1238
|
-
updatedAt DateTime
|
|
1239
|
-
sessions Session[]
|
|
1240
|
-
accounts Account[]
|
|
1241
|
-
@@unique([email])
|
|
1242
|
-
@@map("user")
|
|
1243
|
-
}
|
|
1244
|
-
model Session {
|
|
1245
|
-
id String @id
|
|
1246
|
-
expiresAt DateTime
|
|
1247
|
-
token String
|
|
1248
|
-
createdAt DateTime
|
|
1249
|
-
updatedAt DateTime
|
|
1250
|
-
ipAddress String? @db.Text
|
|
1251
|
-
userAgent String? @db.Text
|
|
1252
|
-
userId String
|
|
1253
|
-
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
1254
|
-
@@unique([token])
|
|
1255
|
-
@@map("session")
|
|
1256
|
-
}
|
|
1257
|
-
model Account {
|
|
1258
|
-
id String @id
|
|
1259
|
-
accountId String @db.Text
|
|
1260
|
-
providerId String @db.Text
|
|
1261
|
-
userId String
|
|
1262
|
-
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
1263
|
-
accessToken String? @db.Text
|
|
1264
|
-
refreshToken String? @db.Text
|
|
1265
|
-
idToken String? @db.Text
|
|
1266
|
-
accessTokenExpiresAt DateTime?
|
|
1267
|
-
refreshTokenExpiresAt DateTime?
|
|
1268
|
-
scope String? @db.Text
|
|
1269
|
-
password String? @db.Text
|
|
1270
|
-
createdAt DateTime
|
|
1271
|
-
updatedAt DateTime
|
|
1272
|
-
@@map("account")
|
|
1273
|
-
}
|
|
1274
|
-
model Verification {
|
|
1275
|
-
id String @id
|
|
1276
|
-
identifier String @db.Text
|
|
1277
|
-
value String @db.Text
|
|
1278
|
-
expiresAt DateTime
|
|
1279
|
-
createdAt DateTime?
|
|
1280
|
-
updatedAt DateTime?
|
|
1281
|
-
@@map("verification")
|
|
1282
|
-
}
|
|
1283
|
-
`,
|
|
1284
|
-
type: "text"
|
|
1285
|
-
},
|
|
1286
|
-
"auth/server/db/prisma/postgres/prisma/schema/auth.prisma": {
|
|
1287
|
-
metadata: {
|
|
1288
|
-
updatedAt: "2025-06-17T06:06:35.000Z",
|
|
1289
|
-
updatedHash: "ef642790d1"
|
|
1290
|
-
},
|
|
1291
|
-
content: `model User {
|
|
1292
|
-
id String @id @map("_id")
|
|
1293
|
-
name String
|
|
1294
|
-
email String
|
|
1295
|
-
emailVerified Boolean
|
|
1296
|
-
image String?
|
|
1297
|
-
createdAt DateTime
|
|
1298
|
-
updatedAt DateTime
|
|
1299
|
-
sessions Session[]
|
|
1300
|
-
accounts Account[]
|
|
1301
|
-
@@unique([email])
|
|
1302
|
-
@@map("user")
|
|
1303
|
-
}
|
|
1304
|
-
model Session {
|
|
1305
|
-
id String @id @map("_id")
|
|
1306
|
-
expiresAt DateTime
|
|
1307
|
-
token String
|
|
1308
|
-
createdAt DateTime
|
|
1309
|
-
updatedAt DateTime
|
|
1310
|
-
ipAddress String?
|
|
1311
|
-
userAgent String?
|
|
1312
|
-
userId String
|
|
1313
|
-
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
1314
|
-
@@unique([token])
|
|
1315
|
-
@@map("session")
|
|
1316
|
-
}
|
|
1317
|
-
model Account {
|
|
1318
|
-
id String @id @map("_id")
|
|
1319
|
-
accountId String
|
|
1320
|
-
providerId String
|
|
1321
|
-
userId String
|
|
1322
|
-
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
1323
|
-
accessToken String?
|
|
1324
|
-
refreshToken String?
|
|
1325
|
-
idToken String?
|
|
1326
|
-
accessTokenExpiresAt DateTime?
|
|
1327
|
-
refreshTokenExpiresAt DateTime?
|
|
1328
|
-
scope String?
|
|
1329
|
-
password String?
|
|
1330
|
-
createdAt DateTime
|
|
1331
|
-
updatedAt DateTime
|
|
1332
|
-
@@map("account")
|
|
1333
|
-
}
|
|
1334
|
-
model Verification {
|
|
1335
|
-
id String @id @map("_id")
|
|
1336
|
-
identifier String
|
|
1337
|
-
value String
|
|
1338
|
-
expiresAt DateTime
|
|
1339
|
-
createdAt DateTime?
|
|
1340
|
-
updatedAt DateTime?
|
|
1341
|
-
@@map("verification")
|
|
1342
|
-
}
|
|
1343
|
-
`,
|
|
1344
|
-
type: "text"
|
|
1345
|
-
},
|
|
1346
|
-
"auth/server/db/prisma/sqlite/prisma/schema/auth.prisma": {
|
|
1347
|
-
metadata: {
|
|
1348
|
-
updatedAt: "2025-06-17T06:06:35.000Z",
|
|
1349
|
-
updatedHash: "ef642790d1"
|
|
1350
|
-
},
|
|
1351
|
-
content: `model User {
|
|
1352
|
-
id String @id @map("_id")
|
|
1353
|
-
name String
|
|
1354
|
-
email String
|
|
1355
|
-
emailVerified Boolean
|
|
1356
|
-
image String?
|
|
1357
|
-
createdAt DateTime
|
|
1358
|
-
updatedAt DateTime
|
|
1359
|
-
sessions Session[]
|
|
1360
|
-
accounts Account[]
|
|
1361
|
-
@@unique([email])
|
|
1362
|
-
@@map("user")
|
|
1363
|
-
}
|
|
1364
|
-
model Session {
|
|
1365
|
-
id String @id @map("_id")
|
|
1366
|
-
expiresAt DateTime
|
|
1367
|
-
token String
|
|
1368
|
-
createdAt DateTime
|
|
1369
|
-
updatedAt DateTime
|
|
1370
|
-
ipAddress String?
|
|
1371
|
-
userAgent String?
|
|
1372
|
-
userId String
|
|
1373
|
-
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
1374
|
-
@@unique([token])
|
|
1375
|
-
@@map("session")
|
|
1376
|
-
}
|
|
1377
|
-
model Account {
|
|
1378
|
-
id String @id @map("_id")
|
|
1379
|
-
accountId String
|
|
1380
|
-
providerId String
|
|
1381
|
-
userId String
|
|
1382
|
-
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
1383
|
-
accessToken String?
|
|
1384
|
-
refreshToken String?
|
|
1385
|
-
idToken String?
|
|
1386
|
-
accessTokenExpiresAt DateTime?
|
|
1387
|
-
refreshTokenExpiresAt DateTime?
|
|
1388
|
-
scope String?
|
|
1389
|
-
password String?
|
|
1390
|
-
createdAt DateTime
|
|
1391
|
-
updatedAt DateTime
|
|
1392
|
-
@@map("account")
|
|
1393
|
-
}
|
|
1394
|
-
model Verification {
|
|
1395
|
-
id String @id @map("_id")
|
|
1396
|
-
identifier String
|
|
1397
|
-
value String
|
|
1398
|
-
expiresAt DateTime
|
|
1399
|
-
createdAt DateTime?
|
|
1400
|
-
updatedAt DateTime?
|
|
1401
|
-
@@map("verification")
|
|
1402
|
-
}
|
|
1403
|
-
`,
|
|
1404
|
-
type: "text"
|
|
1405
|
-
},
|
|
1406
|
-
"auth/server/next/src/impl/api/auth/[...all]/route.ts": {
|
|
1407
|
-
metadata: {
|
|
1408
|
-
updatedAt: "2025-06-17T06:06:35.000Z",
|
|
1409
|
-
updatedHash: "1eeae5d0e3"
|
|
1410
|
-
},
|
|
1411
|
-
content: `import { auth } from "@/lib/auth";
|
|
1412
|
-
import { toNextJsHandler } from "better-auth/next-js";
|
|
1413
|
-
export const { GET, POST } = toNextJsHandler(auth.handler);
|
|
1414
|
-
`,
|
|
1415
|
-
type: "text"
|
|
1416
|
-
},
|
|
1417
|
-
"auth/web/nuxt/app/components/SignInForm.vue": {
|
|
1418
|
-
metadata: {
|
|
1419
|
-
updatedAt: "2025-06-17T06:06:35.000Z",
|
|
1420
|
-
updatedHash: "4d70f0e8c7"
|
|
1421
|
-
},
|
|
1422
|
-
content: `<script setup lang="ts">
|
|
1423
|
-
import z from 'zod/v4'
|
|
1424
|
-
const {$authClient} = useNuxtApp()
|
|
1425
|
-
import type { FormSubmitEvent } from '#ui/types'
|
|
1426
|
-
const emit = defineEmits(['switchToSignUp'])
|
|
1427
|
-
const toast = useToast()
|
|
1428
|
-
const loading = ref(false)
|
|
1429
|
-
const schema = z.object({
|
|
1430
|
-
email: z.email('Invalid email address'),
|
|
1431
|
-
password: z.string().min(8, 'Password must be at least 8 characters'),
|
|
1432
|
-
})
|
|
1433
|
-
type Schema = z.output<typeof schema>
|
|
1434
|
-
const state = reactive({
|
|
1435
|
-
email: '',
|
|
1436
|
-
password: '',
|
|
1437
|
-
})
|
|
1438
|
-
async function onSubmit (event: FormSubmitEvent<Schema>) {
|
|
1439
|
-
loading.value = true
|
|
1440
|
-
try {
|
|
1441
|
-
await $authClient.signIn.email(
|
|
1442
|
-
{
|
|
1443
|
-
email: event.data.email,
|
|
1444
|
-
password: event.data.password,
|
|
1445
|
-
},
|
|
1446
|
-
{
|
|
1447
|
-
onSuccess: () => {
|
|
1448
|
-
toast.add({ title: 'Sign in successful' })
|
|
1449
|
-
navigateTo('/dashboard', { replace: true })
|
|
1450
|
-
},
|
|
1451
|
-
onError: (error) => {
|
|
1452
|
-
toast.add({ title: 'Sign in failed', description: error.error.message })
|
|
1453
|
-
},
|
|
1454
|
-
},
|
|
1455
|
-
)
|
|
1456
|
-
} catch (error: any) {
|
|
1457
|
-
toast.add({ title: 'An unexpected error occurred', description: error.message || 'Please try again.' })
|
|
1458
|
-
} finally {
|
|
1459
|
-
loading.value = false
|
|
1460
|
-
}
|
|
1461
|
-
}
|
|
1462
|
-
<\/script>
|
|
1463
|
-
<template>
|
|
1464
|
-
<div class="mx-auto w-full mt-10 max-w-md p-6">
|
|
1465
|
-
<h1 class="mb-6 text-center text-3xl font-bold">Welcome Back</h1>
|
|
1466
|
-
<UForm :schema="schema" :state="state" class="space-y-4" @submit="onSubmit">
|
|
1467
|
-
<UFormField label="Email" name="email">
|
|
1468
|
-
<UInput v-model="state.email" type="email" class="w-full" />
|
|
1469
|
-
</UFormField>
|
|
1470
|
-
<UFormField label="Password" name="password">
|
|
1471
|
-
<UInput v-model="state.password" type="password" class="w-full" />
|
|
1472
|
-
</UFormField>
|
|
1473
|
-
<UButton type="submit" block :loading="loading">
|
|
1474
|
-
Sign In
|
|
1475
|
-
</UButton>
|
|
1476
|
-
</UForm>
|
|
1477
|
-
<div class="mt-4 text-center">
|
|
1478
|
-
<UButton
|
|
1479
|
-
variant="link"
|
|
1480
|
-
@click="$emit('switchToSignUp')"
|
|
1481
|
-
class="text-primary hover:text-primary-dark"
|
|
1482
|
-
>
|
|
1483
|
-
Need an account? Sign Up
|
|
1484
|
-
</UButton>
|
|
1485
|
-
</div>
|
|
1486
|
-
</div>
|
|
1487
|
-
</template>
|
|
1488
|
-
`,
|
|
1489
|
-
type: "text"
|
|
1490
|
-
},
|
|
1491
|
-
"auth/web/nuxt/app/components/SignUpForm.vue": {
|
|
1492
|
-
metadata: {
|
|
1493
|
-
updatedAt: "2025-06-17T06:06:35.000Z",
|
|
1494
|
-
updatedHash: "414fb57522"
|
|
1495
|
-
},
|
|
1496
|
-
content: `<script setup lang="ts">
|
|
1497
|
-
import z from 'zod/v4'
|
|
1498
|
-
import type { FormSubmitEvent } from '#ui/types'
|
|
1499
|
-
const {$authClient} = useNuxtApp()
|
|
1500
|
-
const emit = defineEmits(['switchToSignIn'])
|
|
1501
|
-
const toast = useToast()
|
|
1502
|
-
const loading = ref(false)
|
|
1503
|
-
const schema = z.object({
|
|
1504
|
-
name: z.string().min(2, 'Name must be at least 2 characters'),
|
|
1505
|
-
email: z.email('Invalid email address'),
|
|
1506
|
-
password: z.string().min(8, 'Password must be at least 8 characters'),
|
|
1507
|
-
})
|
|
1508
|
-
type Schema = z.output<typeof schema>
|
|
1509
|
-
const state = reactive({
|
|
1510
|
-
name: '',
|
|
1511
|
-
email: '',
|
|
1512
|
-
password: '',
|
|
1513
|
-
})
|
|
1514
|
-
async function onSubmit (event: FormSubmitEvent<Schema>) {
|
|
1515
|
-
loading.value = true
|
|
1516
|
-
try {
|
|
1517
|
-
await $authClient.signUp.email(
|
|
1518
|
-
{
|
|
1519
|
-
name: event.data.name,
|
|
1520
|
-
email: event.data.email,
|
|
1521
|
-
password: event.data.password,
|
|
1522
|
-
},
|
|
1523
|
-
{
|
|
1524
|
-
onSuccess: () => {
|
|
1525
|
-
toast.add({ title: 'Sign up successful' })
|
|
1526
|
-
navigateTo('/dashboard', { replace: true })
|
|
1527
|
-
},
|
|
1528
|
-
onError: (error) => {
|
|
1529
|
-
toast.add({ title: 'Sign up failed', description: error.error.message })
|
|
1530
|
-
},
|
|
1531
|
-
},
|
|
1532
|
-
)
|
|
1533
|
-
} catch (error: any) {
|
|
1534
|
-
toast.add({ title: 'An unexpected error occurred', description: error.message || 'Please try again.' })
|
|
1535
|
-
} finally {
|
|
1536
|
-
loading.value = false
|
|
1537
|
-
}
|
|
1538
|
-
}
|
|
1539
|
-
<\/script>
|
|
1540
|
-
<template>
|
|
1541
|
-
<div class="mx-auto w-full mt-10 max-w-md p-6">
|
|
1542
|
-
<h1 class="mb-6 text-center text-3xl font-bold">Create Account</h1>
|
|
1543
|
-
<UForm :schema="schema" :state="state" class="space-y-4" @submit="onSubmit">
|
|
1544
|
-
<UFormField label="Name" name="name">
|
|
1545
|
-
<UInput v-model="state.name" class="w-full" />
|
|
1546
|
-
</UFormField>
|
|
1547
|
-
<UFormField label="Email" name="email">
|
|
1548
|
-
<UInput v-model="state.email" type="email" class="w-full" />
|
|
1549
|
-
</UFormField>
|
|
1550
|
-
<UFormField label="Password" name="password">
|
|
1551
|
-
<UInput v-model="state.password" type="password" class="w-full" />
|
|
1552
|
-
</UFormField>
|
|
1553
|
-
<UButton type="submit" block :loading="loading">
|
|
1554
|
-
Sign Up
|
|
1555
|
-
</UButton>
|
|
1556
|
-
</UForm>
|
|
1557
|
-
<div class="mt-4 text-center">
|
|
1558
|
-
<UButton
|
|
1559
|
-
variant="link"
|
|
1560
|
-
@click="$emit('switchToSignIn')"
|
|
1561
|
-
class="text-primary hover:text-primary-dark"
|
|
1562
|
-
>
|
|
1563
|
-
Already have an account? Sign In
|
|
1564
|
-
</UButton>
|
|
1565
|
-
</div>
|
|
1566
|
-
</div>
|
|
1567
|
-
</template>
|
|
1568
|
-
`,
|
|
1569
|
-
type: "text"
|
|
1570
|
-
},
|
|
1571
|
-
"auth/web/nuxt/app/components/UserMenu.vue": {
|
|
1572
|
-
metadata: {
|
|
1573
|
-
updatedAt: "2025-06-17T06:06:35.000Z",
|
|
1574
|
-
updatedHash: "fc4335c0e0"
|
|
1575
|
-
},
|
|
1576
|
-
content: `<script setup lang="ts">
|
|
1577
|
-
const {$authClient} = useNuxtApp()
|
|
1578
|
-
const session = $authClient.useSession()
|
|
1579
|
-
const toast = useToast()
|
|
1580
|
-
const handleSignOut = async () => {
|
|
1581
|
-
try {
|
|
1582
|
-
await $authClient.signOut({
|
|
1583
|
-
fetchOptions: {
|
|
1584
|
-
onSuccess: async () => {
|
|
1585
|
-
toast.add({ title: 'Signed out successfully' })
|
|
1586
|
-
await navigateTo('/', { replace: true, external: true })
|
|
1587
|
-
},
|
|
1588
|
-
onError: (error) => {
|
|
1589
|
-
toast.add({ title: 'Sign out failed', description: error?.error?.message || 'Unknown error'})
|
|
1590
|
-
}
|
|
1591
|
-
},
|
|
1592
|
-
})
|
|
1593
|
-
} catch (error: any) {
|
|
1594
|
-
toast.add({ title: 'An unexpected error occurred during sign out', description: error.message || 'Please try again.'})
|
|
1595
|
-
}
|
|
1596
|
-
}
|
|
1597
|
-
<\/script>
|
|
1598
|
-
<template>
|
|
1599
|
-
<div>
|
|
1600
|
-
<USkeleton v-if="session.isPending" class="h-9 w-24" />
|
|
1601
|
-
<UButton v-else-if="!session.data" variant="outline" to="/login">
|
|
1602
|
-
Sign In
|
|
1603
|
-
</UButton>
|
|
1604
|
-
<UButton
|
|
1605
|
-
v-else
|
|
1606
|
-
variant="solid"
|
|
1607
|
-
icon="i-lucide-log-out"
|
|
1608
|
-
label="Sign out"
|
|
1609
|
-
@click="handleSignOut()"
|
|
1610
|
-
/>
|
|
1611
|
-
</div>
|
|
1612
|
-
</template>
|
|
1613
|
-
`,
|
|
1614
|
-
type: "text"
|
|
1615
|
-
},
|
|
1616
|
-
"auth/web/nuxt/app/middleware/auth.ts": {
|
|
1617
|
-
metadata: {
|
|
1618
|
-
updatedAt: "2025-06-17T06:06:35.000Z",
|
|
1619
|
-
updatedHash: "e1df215c73"
|
|
1620
|
-
},
|
|
1621
|
-
content: `export default defineNuxtRouteMiddleware(async (to, from) => {
|
|
1622
|
-
if (import.meta.server) return
|
|
1623
|
-
const { $authClient } = useNuxtApp()
|
|
1624
|
-
const session = $authClient.useSession()
|
|
1625
|
-
if (session.value.isPending || !session.value) {
|
|
1626
|
-
if (to.path === "/dashboard") {
|
|
1627
|
-
return navigateTo("/login");
|
|
1628
|
-
}
|
|
1629
|
-
}
|
|
1630
|
-
});
|
|
1631
|
-
`,
|
|
1632
|
-
type: "text"
|
|
1633
|
-
},
|
|
1634
|
-
"auth/web/nuxt/app/pages/dashboard.vue": {
|
|
1635
|
-
metadata: {
|
|
1636
|
-
updatedAt: "2025-06-17T06:06:35.000Z",
|
|
1637
|
-
updatedHash: "c21e12fd96"
|
|
1638
|
-
},
|
|
1639
|
-
content: `<script setup lang="ts">
|
|
1640
|
-
import { useQuery } from '@tanstack/vue-query'
|
|
1641
|
-
const {$authClient} = useNuxtApp()
|
|
1642
|
-
definePageMeta({
|
|
1643
|
-
middleware: ['auth']
|
|
1644
|
-
})
|
|
1645
|
-
const { $orpc } = useNuxtApp()
|
|
1646
|
-
const session = $authClient.useSession()
|
|
1647
|
-
const privateData = useQuery($orpc.privateData.queryOptions())
|
|
1648
|
-
<\/script>
|
|
1649
|
-
<template>
|
|
1650
|
-
<div class="container mx-auto p-4">
|
|
1651
|
-
<h1 class="text-2xl font-bold mb-4">Dashboard</h1>
|
|
1652
|
-
<div v-if="session?.data?.user">
|
|
1653
|
-
<p class="mb-2">Welcome {{ session.data.user.name }}</p>
|
|
1654
|
-
</div>
|
|
1655
|
-
<div v-if="privateData.status.value === 'pending'">Loading private data...</div>
|
|
1656
|
-
<div v-else-if="privateData.status.value === 'error'">Error loading private data: {{ privateData.error.value?.message }}</div>
|
|
1657
|
-
<p v-else-if="privateData.data.value">Private Data: {{ privateData.data.value.message }}</p>
|
|
1658
|
-
</div>
|
|
1659
|
-
</template>
|
|
1660
|
-
`,
|
|
1661
|
-
type: "text"
|
|
1662
|
-
},
|
|
1663
|
-
"auth/web/nuxt/app/pages/login.vue": {
|
|
1664
|
-
metadata: {
|
|
1665
|
-
updatedAt: "2025-06-17T06:06:35.000Z",
|
|
1666
|
-
updatedHash: "d6c3c73480"
|
|
1667
|
-
},
|
|
1668
|
-
content: `<script setup lang="ts">
|
|
1669
|
-
const { $authClient } = useNuxtApp();
|
|
1670
|
-
import SignInForm from "../../../../components/SignInForm.vue";
|
|
1671
|
-
import SignUpForm from "../../../../components/SignUpForm.vue";
|
|
1672
|
-
const session = $authClient.useSession();
|
|
1673
|
-
const showSignIn = ref(true);
|
|
1674
|
-
watchEffect(() => {
|
|
1675
|
-
if (!session?.value.isPending && session?.value.data) {
|
|
1676
|
-
navigateTo("/dashboard", { replace: true });
|
|
1677
|
-
}
|
|
1678
|
-
});
|
|
1679
|
-
<\/script>
|
|
1680
|
-
<template>
|
|
1681
|
-
<div>
|
|
1682
|
-
<Loader v-if="session.isPending" />
|
|
1683
|
-
<div v-else-if="!session.data">
|
|
1684
|
-
<SignInForm v-if="showSignIn" @switch-to-sign-up="showSignIn = false" />
|
|
1685
|
-
<SignUpForm v-else @switch-to-sign-in="showSignIn = true" />
|
|
1686
|
-
</div>
|
|
1687
|
-
</div>
|
|
1688
|
-
</template>
|
|
1689
|
-
`,
|
|
1690
|
-
type: "text"
|
|
1691
|
-
},
|
|
1692
|
-
"auth/web/nuxt/app/plugins/auth-client.ts": {
|
|
1693
|
-
metadata: {
|
|
1694
|
-
updatedAt: "2025-06-17T06:06:35.000Z",
|
|
1695
|
-
updatedHash: "6fc7eac334"
|
|
1696
|
-
},
|
|
1697
|
-
content: `import { createAuthClient } from "better-auth/vue";
|
|
1698
|
-
export default defineNuxtPlugin(nuxtApp => {
|
|
1699
|
-
const config = useRuntimeConfig()
|
|
1700
|
-
const serverUrl = config.public.serverURL
|
|
1701
|
-
const authClient = createAuthClient({
|
|
1702
|
-
baseURL: serverUrl
|
|
1703
|
-
})
|
|
1704
|
-
return {
|
|
1705
|
-
provide: {
|
|
1706
|
-
authClient: authClient
|
|
1707
|
-
}
|
|
1708
|
-
}
|
|
1709
|
-
})
|
|
1710
|
-
`,
|
|
1711
|
-
type: "text"
|
|
1712
|
-
},
|
|
1713
|
-
"auth/web/react/base/src/lib/auth-client.ts.hbs": {
|
|
1714
|
-
metadata: {
|
|
1715
|
-
updatedAt: "2025-06-17T06:06:35.000Z",
|
|
1716
|
-
updatedHash: "f4805c24d3"
|
|
1717
|
-
},
|
|
1718
|
-
content: `import { createAuthClient } from "better-auth/react";
|
|
1719
|
-
export const authClient = createAuthClient({
|
|
1720
|
-
baseURL:
|
|
1721
|
-
{{#if (includes frontend "next")}}
|
|
1722
|
-
process.env.NEXT_PUBLIC_SERVER_URL,
|
|
1723
|
-
{{else}}
|
|
1724
|
-
import.meta.env.VITE_SERVER_URL,
|
|
1725
|
-
{{/if}}
|
|
1726
|
-
});
|
|
1727
|
-
`,
|
|
1728
|
-
type: "text"
|
|
1729
|
-
},
|
|
1730
|
-
"auth/web/react/next/src/impl/dashboard/page.tsx.hbs": {
|
|
1731
|
-
metadata: {
|
|
1732
|
-
updatedAt: "2025-06-17T06:06:35.000Z",
|
|
1733
|
-
updatedHash: "354fab95c7"
|
|
1734
|
-
},
|
|
1735
|
-
content: `"use client"
|
|
1736
|
-
import { authClient } from "@/lib/auth-client";
|
|
1737
|
-
{{#if (eq api "orpc")}}
|
|
1738
|
-
import { useQuery } from "@tanstack/react-query";
|
|
1739
|
-
import { orpc } from "@/utils/orpc";
|
|
1740
|
-
{{/if}}
|
|
1741
|
-
{{#if (eq api "trpc")}}
|
|
1742
|
-
import { useQuery } from "@tanstack/react-query";
|
|
1743
|
-
import { trpc } from "@/utils/trpc";
|
|
1744
|
-
{{/if}}
|
|
1745
|
-
import { useRouter } from "next/navigation";
|
|
1746
|
-
import { useEffect } from "react";
|
|
1747
|
-
export default function Dashboard() {
|
|
1748
|
-
const router = useRouter();
|
|
1749
|
-
const { data: session, isPending } = authClient.useSession();
|
|
1750
|
-
{{#if (eq api "orpc")}}
|
|
1751
|
-
const privateData = useQuery(orpc.privateData.queryOptions());
|
|
1752
|
-
{{/if}}
|
|
1753
|
-
{{#if (eq api "trpc")}}
|
|
1754
|
-
const privateData = useQuery(trpc.privateData.queryOptions());
|
|
1755
|
-
{{/if}}
|
|
1756
|
-
useEffect(() => {
|
|
1757
|
-
if (!session && !isPending) {
|
|
1758
|
-
router.push("/login");
|
|
1759
|
-
}
|
|
1760
|
-
}, [session, isPending]);
|
|
1761
|
-
if (isPending) {
|
|
1762
|
-
return <div>Loading...</div>;
|
|
1763
|
-
}
|
|
1764
|
-
return (
|
|
1765
|
-
<div>
|
|
1766
|
-
<h1>Dashboard</h1>
|
|
1767
|
-
<p>Welcome {session?.user.name}</p>
|
|
1768
|
-
{{#if (eq api "orpc")}}
|
|
1769
|
-
<p>privateData: {privateData.data?.message}</p>
|
|
1770
|
-
{{/if}}
|
|
1771
|
-
{{#if (eq api "trpc")}}
|
|
1772
|
-
<p>privateData: {privateData.data?.message}</p>
|
|
1773
|
-
{{/if}}
|
|
1774
|
-
</div>
|
|
1775
|
-
);
|
|
1776
|
-
}
|
|
1777
|
-
`,
|
|
1778
|
-
type: "text"
|
|
1779
|
-
},
|
|
1780
|
-
"auth/web/react/next/src/impl/login/page.tsx": {
|
|
1781
|
-
metadata: {
|
|
1782
|
-
updatedAt: "2025-06-17T06:06:35.000Z",
|
|
1783
|
-
updatedHash: "bdd103cc10"
|
|
1784
|
-
},
|
|
1785
|
-
content: `"use client"
|
|
1786
|
-
import SignInForm from "@/components/sign-in-form";
|
|
1787
|
-
import SignUpForm from "@/components/sign-up-form";
|
|
1788
|
-
import { useState } from "react";
|
|
1789
|
-
export default function LoginPage() {
|
|
1790
|
-
const [showSignIn, setShowSignIn] = useState(false);
|
|
1791
|
-
return showSignIn ? (
|
|
1792
|
-
<SignInForm onSwitchToSignUp={() => setShowSignIn(false)} />
|
|
1793
|
-
) : (
|
|
1794
|
-
<SignUpForm onSwitchToSignIn={() => setShowSignIn(true)} />
|
|
1795
|
-
);
|
|
1796
|
-
}
|
|
1797
|
-
`,
|
|
1798
|
-
type: "text"
|
|
1799
|
-
},
|
|
1800
|
-
"auth/web/react/next/src/components/sign-in-form.tsx": {
|
|
1801
|
-
metadata: {
|
|
1802
|
-
updatedAt: "2025-06-17T06:06:35.000Z",
|
|
1803
|
-
updatedHash: "f14d3860de"
|
|
1804
|
-
},
|
|
1805
|
-
content: `import { authClient } from "@/lib/auth-client";
|
|
1806
|
-
import { useForm } from "@tanstack/react-form";
|
|
1807
|
-
import { toast } from "sonner";
|
|
1808
|
-
import z from "zod/v4";
|
|
1809
|
-
import Loader from "./loader";
|
|
1810
|
-
import { Button } from "./ui/button";
|
|
1811
|
-
import { Input } from "./ui/input";
|
|
1812
|
-
import { Label } from "./ui/label";
|
|
1813
|
-
import { useRouter } from "next/navigation";
|
|
1814
|
-
export default function SignInForm({
|
|
1815
|
-
onSwitchToSignUp,
|
|
1816
|
-
}: {
|
|
1817
|
-
onSwitchToSignUp: () => void;
|
|
1818
|
-
}) {
|
|
1819
|
-
const router = useRouter()
|
|
1820
|
-
const { isPending } = authClient.useSession();
|
|
1821
|
-
const form = useForm({
|
|
1822
|
-
defaultValues: {
|
|
1823
|
-
email: "",
|
|
1824
|
-
password: "",
|
|
1825
|
-
},
|
|
1826
|
-
onSubmit: async ({ value }) => {
|
|
1827
|
-
await authClient.signIn.email(
|
|
1828
|
-
{
|
|
1829
|
-
email: value.email,
|
|
1830
|
-
password: value.password,
|
|
1831
|
-
},
|
|
1832
|
-
{
|
|
1833
|
-
onSuccess: () => {
|
|
1834
|
-
router.push("/dashboard")
|
|
1835
|
-
toast.success("Sign in successful");
|
|
1836
|
-
},
|
|
1837
|
-
onError: (error) => {
|
|
1838
|
-
toast.error(error.error.message);
|
|
1839
|
-
},
|
|
1840
|
-
},
|
|
1841
|
-
);
|
|
1842
|
-
},
|
|
1843
|
-
validators: {
|
|
1844
|
-
onSubmit: z.object({
|
|
1845
|
-
email: z.email("Invalid email address"),
|
|
1846
|
-
password: z.string().min(8, "Password must be at least 8 characters"),
|
|
1847
|
-
}),
|
|
1848
|
-
},
|
|
1849
|
-
});
|
|
1850
|
-
if (isPending) {
|
|
1851
|
-
return <Loader />;
|
|
1852
|
-
}
|
|
1853
|
-
return (
|
|
1854
|
-
<div className="mx-auto w-full mt-10 max-w-md p-6">
|
|
1855
|
-
<h1 className="mb-6 text-center text-3xl font-bold">Welcome Back</h1>
|
|
1856
|
-
<form
|
|
1857
|
-
onSubmit={(e) => {
|
|
1858
|
-
e.preventDefault();
|
|
1859
|
-
e.stopPropagation();
|
|
1860
|
-
void form.handleSubmit();
|
|
1861
|
-
}}
|
|
1862
|
-
className="space-y-4"
|
|
1863
|
-
>
|
|
1864
|
-
<div>
|
|
1865
|
-
<form.Field name="email">
|
|
1866
|
-
{(field) => (
|
|
1867
|
-
<div className="space-y-2">
|
|
1868
|
-
<Label htmlFor={field.name}>Email</Label>
|
|
1869
|
-
<Input
|
|
1870
|
-
id={field.name}
|
|
1871
|
-
name={field.name}
|
|
1872
|
-
type="email"
|
|
1873
|
-
value={field.state.value}
|
|
1874
|
-
onBlur={field.handleBlur}
|
|
1875
|
-
onChange={(e) => field.handleChange(e.target.value)}
|
|
1876
|
-
/>
|
|
1877
|
-
{field.state.meta.errors.map((error) => (
|
|
1878
|
-
<p key={error?.message} className="text-red-500">
|
|
1879
|
-
{error?.message}
|
|
1880
|
-
</p>
|
|
1881
|
-
))}
|
|
1882
|
-
</div>
|
|
1883
|
-
)}
|
|
1884
|
-
</form.Field>
|
|
1885
|
-
</div>
|
|
1886
|
-
<div>
|
|
1887
|
-
<form.Field name="password">
|
|
1888
|
-
{(field) => (
|
|
1889
|
-
<div className="space-y-2">
|
|
1890
|
-
<Label htmlFor={field.name}>Password</Label>
|
|
1891
|
-
<Input
|
|
1892
|
-
id={field.name}
|
|
1893
|
-
name={field.name}
|
|
1894
|
-
type="password"
|
|
1895
|
-
value={field.state.value}
|
|
1896
|
-
onBlur={field.handleBlur}
|
|
1897
|
-
onChange={(e) => field.handleChange(e.target.value)}
|
|
1898
|
-
/>
|
|
1899
|
-
{field.state.meta.errors.map((error) => (
|
|
1900
|
-
<p key={error?.message} className="text-red-500">
|
|
1901
|
-
{error?.message}
|
|
1902
|
-
</p>
|
|
1903
|
-
))}
|
|
1904
|
-
</div>
|
|
1905
|
-
)}
|
|
1906
|
-
</form.Field>
|
|
1907
|
-
</div>
|
|
1908
|
-
<form.Subscribe>
|
|
1909
|
-
{(state) => (
|
|
1910
|
-
<Button
|
|
1911
|
-
type="submit"
|
|
1912
|
-
className="w-full"
|
|
1913
|
-
disabled={!state.canSubmit || state.isSubmitting}
|
|
1914
|
-
>
|
|
1915
|
-
{state.isSubmitting ? "Submitting..." : "Sign In"}
|
|
1916
|
-
</Button>
|
|
1917
|
-
)}
|
|
1918
|
-
</form.Subscribe>
|
|
1919
|
-
</form>
|
|
1920
|
-
<div className="mt-4 text-center">
|
|
1921
|
-
<Button
|
|
1922
|
-
variant="link"
|
|
1923
|
-
onClick={onSwitchToSignUp}
|
|
1924
|
-
className="text-indigo-600 hover:text-indigo-800"
|
|
1925
|
-
>
|
|
1926
|
-
Need an account? Sign Up
|
|
1927
|
-
</Button>
|
|
1928
|
-
</div>
|
|
1929
|
-
</div>
|
|
1930
|
-
);
|
|
1931
|
-
}
|
|
1932
|
-
`,
|
|
1933
|
-
type: "text"
|
|
1934
|
-
},
|
|
1935
|
-
"auth/web/react/next/src/components/sign-up-form.tsx": {
|
|
1936
|
-
metadata: {
|
|
1937
|
-
updatedAt: "2025-06-17T06:06:35.000Z",
|
|
1938
|
-
updatedHash: "2235152dbf"
|
|
1939
|
-
},
|
|
1940
|
-
content: `import { authClient } from "@/lib/auth-client";
|
|
1941
|
-
import { useForm } from "@tanstack/react-form";
|
|
1942
|
-
import { toast } from "sonner";
|
|
1943
|
-
import z from "zod/v4";
|
|
1944
|
-
import Loader from "./loader";
|
|
1945
|
-
import { Button } from "./ui/button";
|
|
1946
|
-
import { Input } from "./ui/input";
|
|
1947
|
-
import { Label } from "./ui/label";
|
|
1948
|
-
import { useRouter } from "next/navigation";
|
|
1949
|
-
export default function SignUpForm({
|
|
1950
|
-
onSwitchToSignIn,
|
|
1951
|
-
}: {
|
|
1952
|
-
onSwitchToSignIn: () => void;
|
|
1953
|
-
}) {
|
|
1954
|
-
const router = useRouter();
|
|
1955
|
-
const { isPending } = authClient.useSession();
|
|
1956
|
-
const form = useForm({
|
|
1957
|
-
defaultValues: {
|
|
1958
|
-
email: "",
|
|
1959
|
-
password: "",
|
|
1960
|
-
name: "",
|
|
1961
|
-
},
|
|
1962
|
-
onSubmit: async ({ value }) => {
|
|
1963
|
-
await authClient.signUp.email(
|
|
1964
|
-
{
|
|
1965
|
-
email: value.email,
|
|
1966
|
-
password: value.password,
|
|
1967
|
-
name: value.name,
|
|
1968
|
-
},
|
|
1969
|
-
{
|
|
1970
|
-
onSuccess: () => {
|
|
1971
|
-
router.push("/dashboard");
|
|
1972
|
-
toast.success("Sign up successful");
|
|
1973
|
-
},
|
|
1974
|
-
onError: (error) => {
|
|
1975
|
-
toast.error(error.error.message);
|
|
1976
|
-
},
|
|
1977
|
-
},
|
|
1978
|
-
);
|
|
1979
|
-
},
|
|
1980
|
-
validators: {
|
|
1981
|
-
onSubmit: z.object({
|
|
1982
|
-
name: z.string().min(2, "Name must be at least 2 characters"),
|
|
1983
|
-
email: z.email("Invalid email address"),
|
|
1984
|
-
password: z.string().min(8, "Password must be at least 8 characters"),
|
|
1985
|
-
}),
|
|
1986
|
-
},
|
|
1987
|
-
});
|
|
1988
|
-
if (isPending) {
|
|
1989
|
-
return <Loader />;
|
|
1990
|
-
}
|
|
1991
|
-
return (
|
|
1992
|
-
<div className="mx-auto w-full mt-10 max-w-md p-6">
|
|
1993
|
-
<h1 className="mb-6 text-center text-3xl font-bold">Create Account</h1>
|
|
1994
|
-
<form
|
|
1995
|
-
onSubmit={(e) => {
|
|
1996
|
-
e.preventDefault();
|
|
1997
|
-
e.stopPropagation();
|
|
1998
|
-
void form.handleSubmit();
|
|
1999
|
-
}}
|
|
2000
|
-
className="space-y-4"
|
|
2001
|
-
>
|
|
2002
|
-
<div>
|
|
2003
|
-
<form.Field name="name">
|
|
2004
|
-
{(field) => (
|
|
2005
|
-
<div className="space-y-2">
|
|
2006
|
-
<Label htmlFor={field.name}>Name</Label>
|
|
2007
|
-
<Input
|
|
2008
|
-
id={field.name}
|
|
2009
|
-
name={field.name}
|
|
2010
|
-
value={field.state.value}
|
|
2011
|
-
onBlur={field.handleBlur}
|
|
2012
|
-
onChange={(e) => field.handleChange(e.target.value)}
|
|
2013
|
-
/>
|
|
2014
|
-
{field.state.meta.errors.map((error) => (
|
|
2015
|
-
<p key={error?.message} className="text-red-500">
|
|
2016
|
-
{error?.message}
|
|
2017
|
-
</p>
|
|
2018
|
-
))}
|
|
2019
|
-
</div>
|
|
2020
|
-
)}
|
|
2021
|
-
</form.Field>
|
|
2022
|
-
</div>
|
|
2023
|
-
<div>
|
|
2024
|
-
<form.Field name="email">
|
|
2025
|
-
{(field) => (
|
|
2026
|
-
<div className="space-y-2">
|
|
2027
|
-
<Label htmlFor={field.name}>Email</Label>
|
|
2028
|
-
<Input
|
|
2029
|
-
id={field.name}
|
|
2030
|
-
name={field.name}
|
|
2031
|
-
type="email"
|
|
2032
|
-
value={field.state.value}
|
|
2033
|
-
onBlur={field.handleBlur}
|
|
2034
|
-
onChange={(e) => field.handleChange(e.target.value)}
|
|
2035
|
-
/>
|
|
2036
|
-
{field.state.meta.errors.map((error) => (
|
|
2037
|
-
<p key={error?.message} className="text-red-500">
|
|
2038
|
-
{error?.message}
|
|
2039
|
-
</p>
|
|
2040
|
-
))}
|
|
2041
|
-
</div>
|
|
2042
|
-
)}
|
|
2043
|
-
</form.Field>
|
|
2044
|
-
</div>
|
|
2045
|
-
<div>
|
|
2046
|
-
<form.Field name="password">
|
|
2047
|
-
{(field) => (
|
|
2048
|
-
<div className="space-y-2">
|
|
2049
|
-
<Label htmlFor={field.name}>Password</Label>
|
|
2050
|
-
<Input
|
|
2051
|
-
id={field.name}
|
|
2052
|
-
name={field.name}
|
|
2053
|
-
type="password"
|
|
2054
|
-
value={field.state.value}
|
|
2055
|
-
onBlur={field.handleBlur}
|
|
2056
|
-
onChange={(e) => field.handleChange(e.target.value)}
|
|
2057
|
-
/>
|
|
2058
|
-
{field.state.meta.errors.map((error) => (
|
|
2059
|
-
<p key={error?.message} className="text-red-500">
|
|
2060
|
-
{error?.message}
|
|
2061
|
-
</p>
|
|
2062
|
-
))}
|
|
2063
|
-
</div>
|
|
2064
|
-
)}
|
|
2065
|
-
</form.Field>
|
|
2066
|
-
</div>
|
|
2067
|
-
<form.Subscribe>
|
|
2068
|
-
{(state) => (
|
|
2069
|
-
<Button
|
|
2070
|
-
type="submit"
|
|
2071
|
-
className="w-full"
|
|
2072
|
-
disabled={!state.canSubmit || state.isSubmitting}
|
|
2073
|
-
>
|
|
2074
|
-
{state.isSubmitting ? "Submitting..." : "Sign Up"}
|
|
2075
|
-
</Button>
|
|
2076
|
-
)}
|
|
2077
|
-
</form.Subscribe>
|
|
2078
|
-
</form>
|
|
2079
|
-
<div className="mt-4 text-center">
|
|
2080
|
-
<Button
|
|
2081
|
-
variant="link"
|
|
2082
|
-
onClick={onSwitchToSignIn}
|
|
2083
|
-
className="text-indigo-600 hover:text-indigo-800"
|
|
2084
|
-
>
|
|
2085
|
-
Already have an account? Sign In
|
|
2086
|
-
</Button>
|
|
2087
|
-
</div>
|
|
2088
|
-
</div>
|
|
2089
|
-
);
|
|
2090
|
-
}
|
|
2091
|
-
`,
|
|
2092
|
-
type: "text"
|
|
2093
|
-
},
|
|
2094
|
-
"auth/web/react/next/src/components/theme-provider.tsx": {
|
|
2095
|
-
metadata: {
|
|
2096
|
-
updatedAt: "2025-06-17T06:06:35.000Z",
|
|
2097
|
-
updatedHash: "454fd475e0"
|
|
2098
|
-
},
|
|
2099
|
-
content: `"use client"
|
|
2100
|
-
import * as React from "react"
|
|
2101
|
-
import { ThemeProvider as NextThemesProvider } from "next-themes"
|
|
2102
|
-
export function ThemeProvider({
|
|
2103
|
-
children,
|
|
2104
|
-
...props
|
|
2105
|
-
}: React.ComponentProps<typeof NextThemesProvider>) {
|
|
2106
|
-
return <NextThemesProvider {...props}>{children}</NextThemesProvider>
|
|
2107
|
-
}
|
|
2108
|
-
`,
|
|
2109
|
-
type: "text"
|
|
2110
|
-
},
|
|
2111
|
-
"auth/web/react/next/src/components/user-menu.tsx": {
|
|
2112
|
-
metadata: {
|
|
2113
|
-
updatedAt: "2025-06-17T06:06:35.000Z",
|
|
2114
|
-
updatedHash: "2a991ef0ba"
|
|
2115
|
-
},
|
|
2116
|
-
content: `import {
|
|
2117
|
-
DropdownMenu,
|
|
2118
|
-
DropdownMenuContent,
|
|
2119
|
-
DropdownMenuItem,
|
|
2120
|
-
DropdownMenuLabel,
|
|
2121
|
-
DropdownMenuSeparator,
|
|
2122
|
-
DropdownMenuTrigger,
|
|
2123
|
-
} from "@/components/ui/dropdown-menu";
|
|
2124
|
-
import { authClient } from "@/lib/auth-client";
|
|
2125
|
-
import { Button } from "./ui/button";
|
|
2126
|
-
import { Skeleton } from "./ui/skeleton";
|
|
2127
|
-
import { useRouter } from "next/navigation";
|
|
2128
|
-
import Link from "next/link";
|
|
2129
|
-
export default function UserMenu() {
|
|
2130
|
-
const router = useRouter();
|
|
2131
|
-
const { data: session, isPending } = authClient.useSession();
|
|
2132
|
-
if (isPending) {
|
|
2133
|
-
return <Skeleton className="h-9 w-24" />;
|
|
2134
|
-
}
|
|
2135
|
-
if (!session) {
|
|
2136
|
-
return (
|
|
2137
|
-
<Button variant="outline" asChild>
|
|
2138
|
-
<Link href="/login">Sign In</Link>
|
|
2139
|
-
</Button>
|
|
2140
|
-
);
|
|
2141
|
-
}
|
|
2142
|
-
return (
|
|
2143
|
-
<DropdownMenu>
|
|
2144
|
-
<DropdownMenuTrigger asChild>
|
|
2145
|
-
<Button variant="outline">{session.user.name}</Button>
|
|
2146
|
-
</DropdownMenuTrigger>
|
|
2147
|
-
<DropdownMenuContent className="bg-card">
|
|
2148
|
-
<DropdownMenuLabel>My Account</DropdownMenuLabel>
|
|
2149
|
-
<DropdownMenuSeparator />
|
|
2150
|
-
<DropdownMenuItem>{session.user.email}</DropdownMenuItem>
|
|
2151
|
-
<DropdownMenuItem asChild>
|
|
2152
|
-
<Button
|
|
2153
|
-
variant="destructive"
|
|
2154
|
-
className="w-full"
|
|
2155
|
-
onClick={() => {
|
|
2156
|
-
authClient.signOut({
|
|
2157
|
-
fetchOptions: {
|
|
2158
|
-
onSuccess: () => {
|
|
2159
|
-
router.push("/");
|
|
2160
|
-
},
|
|
2161
|
-
},
|
|
2162
|
-
});
|
|
2163
|
-
}}
|
|
2164
|
-
>
|
|
2165
|
-
Sign Out
|
|
2166
|
-
</Button>
|
|
2167
|
-
</DropdownMenuItem>
|
|
2168
|
-
</DropdownMenuContent>
|
|
2169
|
-
</DropdownMenu>
|
|
2170
|
-
);
|
|
2171
|
-
}
|
|
2172
|
-
`,
|
|
2173
|
-
type: "text"
|
|
2174
|
-
},
|
|
2175
|
-
"auth/web/react/react-router/src/components/sign-in-form.tsx": {
|
|
2176
|
-
metadata: {
|
|
2177
|
-
updatedAt: "2025-06-17T06:06:35.000Z",
|
|
2178
|
-
updatedHash: "24c93e0c97"
|
|
2179
|
-
},
|
|
2180
|
-
content: `import { authClient } from "@/lib/auth-client";
|
|
2181
|
-
import { useForm } from "@tanstack/react-form";
|
|
2182
|
-
import { useNavigate } from "react-router";
|
|
2183
|
-
import { toast } from "sonner";
|
|
2184
|
-
import z from "zod/v4";
|
|
2185
|
-
import Loader from "./loader";
|
|
2186
|
-
import { Button } from "./ui/button";
|
|
2187
|
-
import { Input } from "./ui/input";
|
|
2188
|
-
import { Label } from "./ui/label";
|
|
2189
|
-
export default function SignInForm({
|
|
2190
|
-
onSwitchToSignUp,
|
|
2191
|
-
}: {
|
|
2192
|
-
onSwitchToSignUp: () => void;
|
|
2193
|
-
}) {
|
|
2194
|
-
const navigate = useNavigate();
|
|
2195
|
-
const { isPending } = authClient.useSession();
|
|
2196
|
-
const form = useForm({
|
|
2197
|
-
defaultValues: {
|
|
2198
|
-
email: "",
|
|
2199
|
-
password: "",
|
|
2200
|
-
},
|
|
2201
|
-
onSubmit: async ({ value }) => {
|
|
2202
|
-
await authClient.signIn.email(
|
|
2203
|
-
{
|
|
2204
|
-
email: value.email,
|
|
2205
|
-
password: value.password,
|
|
2206
|
-
},
|
|
2207
|
-
{
|
|
2208
|
-
onSuccess: () => {
|
|
2209
|
-
navigate("/dashboard");
|
|
2210
|
-
toast.success("Sign in successful");
|
|
2211
|
-
},
|
|
2212
|
-
onError: (error) => {
|
|
2213
|
-
toast.error(error.error.message);
|
|
2214
|
-
},
|
|
2215
|
-
}
|
|
2216
|
-
);
|
|
2217
|
-
},
|
|
2218
|
-
validators: {
|
|
2219
|
-
onSubmit: z.object({
|
|
2220
|
-
email: z.email("Invalid email address"),
|
|
2221
|
-
password: z.string().min(8, "Password must be at least 8 characters"),
|
|
2222
|
-
}),
|
|
2223
|
-
},
|
|
2224
|
-
});
|
|
2225
|
-
if (isPending) {
|
|
2226
|
-
return <Loader />;
|
|
2227
|
-
}
|
|
2228
|
-
return (
|
|
2229
|
-
<div className="mx-auto w-full mt-10 max-w-md p-6">
|
|
2230
|
-
<h1 className="mb-6 text-center text-3xl font-bold">Welcome Back</h1>
|
|
2231
|
-
<form
|
|
2232
|
-
onSubmit={(e) => {
|
|
2233
|
-
e.preventDefault();
|
|
2234
|
-
e.stopPropagation();
|
|
2235
|
-
void form.handleSubmit();
|
|
2236
|
-
}}
|
|
2237
|
-
className="space-y-4"
|
|
2238
|
-
>
|
|
2239
|
-
<div>
|
|
2240
|
-
<form.Field name="email">
|
|
2241
|
-
{(field) => (
|
|
2242
|
-
<div className="space-y-2">
|
|
2243
|
-
<Label htmlFor={field.name}>Email</Label>
|
|
2244
|
-
<Input
|
|
2245
|
-
id={field.name}
|
|
2246
|
-
name={field.name}
|
|
2247
|
-
type="email"
|
|
2248
|
-
value={field.state.value}
|
|
2249
|
-
onBlur={field.handleBlur}
|
|
2250
|
-
onChange={(e) => field.handleChange(e.target.value)}
|
|
2251
|
-
/>
|
|
2252
|
-
{field.state.meta.errors.map((error) => (
|
|
2253
|
-
<p key={error?.message} className="text-red-500">
|
|
2254
|
-
{error?.message}
|
|
2255
|
-
</p>
|
|
2256
|
-
))}
|
|
2257
|
-
</div>
|
|
2258
|
-
)}
|
|
2259
|
-
</form.Field>
|
|
2260
|
-
</div>
|
|
2261
|
-
<div>
|
|
2262
|
-
<form.Field name="password">
|
|
2263
|
-
{(field) => (
|
|
2264
|
-
<div className="space-y-2">
|
|
2265
|
-
<Label htmlFor={field.name}>Password</Label>
|
|
2266
|
-
<Input
|
|
2267
|
-
id={field.name}
|
|
2268
|
-
name={field.name}
|
|
2269
|
-
type="password"
|
|
2270
|
-
value={field.state.value}
|
|
2271
|
-
onBlur={field.handleBlur}
|
|
2272
|
-
onChange={(e) => field.handleChange(e.target.value)}
|
|
2273
|
-
/>
|
|
2274
|
-
{field.state.meta.errors.map((error) => (
|
|
2275
|
-
<p key={error?.message} className="text-red-500">
|
|
2276
|
-
{error?.message}
|
|
2277
|
-
</p>
|
|
2278
|
-
))}
|
|
2279
|
-
</div>
|
|
2280
|
-
)}
|
|
2281
|
-
</form.Field>
|
|
2282
|
-
</div>
|
|
2283
|
-
<form.Subscribe>
|
|
2284
|
-
{(state) => (
|
|
2285
|
-
<Button
|
|
2286
|
-
type="submit"
|
|
2287
|
-
className="w-full"
|
|
2288
|
-
disabled={!state.canSubmit || state.isSubmitting}
|
|
2289
|
-
>
|
|
2290
|
-
{state.isSubmitting ? "Submitting..." : "Sign In"}
|
|
2291
|
-
</Button>
|
|
2292
|
-
)}
|
|
2293
|
-
</form.Subscribe>
|
|
2294
|
-
</form>
|
|
2295
|
-
<div className="mt-4 text-center">
|
|
2296
|
-
<Button
|
|
2297
|
-
variant="link"
|
|
2298
|
-
onClick={onSwitchToSignUp}
|
|
2299
|
-
className="text-indigo-600 hover:text-indigo-800"
|
|
2300
|
-
>
|
|
2301
|
-
Need an account? Sign Up
|
|
2302
|
-
</Button>
|
|
2303
|
-
</div>
|
|
2304
|
-
</div>
|
|
2305
|
-
);
|
|
2306
|
-
}
|
|
2307
|
-
`,
|
|
2308
|
-
type: "text"
|
|
2309
|
-
},
|
|
2310
|
-
"auth/web/react/react-router/src/components/sign-up-form.tsx": {
|
|
2311
|
-
metadata: {
|
|
2312
|
-
updatedAt: "2025-06-17T06:06:35.000Z",
|
|
2313
|
-
updatedHash: "e255f8a212"
|
|
2314
|
-
},
|
|
2315
|
-
content: `import { authClient } from "@/lib/auth-client";
|
|
2316
|
-
import { useForm } from "@tanstack/react-form";
|
|
2317
|
-
import { useNavigate } from "react-router";
|
|
2318
|
-
import { toast } from "sonner";
|
|
2319
|
-
import z from "zod/v4";
|
|
2320
|
-
import Loader from "./loader";
|
|
2321
|
-
import { Button } from "./ui/button";
|
|
2322
|
-
import { Input } from "./ui/input";
|
|
2323
|
-
import { Label } from "./ui/label";
|
|
2324
|
-
export default function SignUpForm({
|
|
2325
|
-
onSwitchToSignIn,
|
|
2326
|
-
}: {
|
|
2327
|
-
onSwitchToSignIn: () => void;
|
|
2328
|
-
}) {
|
|
2329
|
-
const navigate = useNavigate();
|
|
2330
|
-
const { isPending } = authClient.useSession();
|
|
2331
|
-
const form = useForm({
|
|
2332
|
-
defaultValues: {
|
|
2333
|
-
email: "",
|
|
2334
|
-
password: "",
|
|
2335
|
-
name: "",
|
|
2336
|
-
},
|
|
2337
|
-
onSubmit: async ({ value }) => {
|
|
2338
|
-
await authClient.signUp.email(
|
|
2339
|
-
{
|
|
2340
|
-
email: value.email,
|
|
2341
|
-
password: value.password,
|
|
2342
|
-
name: value.name,
|
|
2343
|
-
},
|
|
2344
|
-
{
|
|
2345
|
-
onSuccess: () => {
|
|
2346
|
-
navigate("/dashboard");
|
|
2347
|
-
toast.success("Sign up successful");
|
|
2348
|
-
},
|
|
2349
|
-
onError: (error) => {
|
|
2350
|
-
toast.error(error.error.message);
|
|
2351
|
-
},
|
|
2352
|
-
}
|
|
2353
|
-
);
|
|
2354
|
-
},
|
|
2355
|
-
validators: {
|
|
2356
|
-
onSubmit: z.object({
|
|
2357
|
-
name: z.string().min(2, "Name must be at least 2 characters"),
|
|
2358
|
-
email: z.email("Invalid email address"),
|
|
2359
|
-
password: z.string().min(8, "Password must be at least 8 characters"),
|
|
2360
|
-
}),
|
|
2361
|
-
},
|
|
2362
|
-
});
|
|
2363
|
-
if (isPending) {
|
|
2364
|
-
return <Loader />;
|
|
2365
|
-
}
|
|
2366
|
-
return (
|
|
2367
|
-
<div className="mx-auto w-full mt-10 max-w-md p-6">
|
|
2368
|
-
<h1 className="mb-6 text-center text-3xl font-bold">Create Account</h1>
|
|
2369
|
-
<form
|
|
2370
|
-
onSubmit={(e) => {
|
|
2371
|
-
e.preventDefault();
|
|
2372
|
-
e.stopPropagation();
|
|
2373
|
-
void form.handleSubmit();
|
|
2374
|
-
}}
|
|
2375
|
-
className="space-y-4"
|
|
2376
|
-
>
|
|
2377
|
-
<div>
|
|
2378
|
-
<form.Field name="name">
|
|
2379
|
-
{(field) => (
|
|
2380
|
-
<div className="space-y-2">
|
|
2381
|
-
<Label htmlFor={field.name}>Name</Label>
|
|
2382
|
-
<Input
|
|
2383
|
-
id={field.name}
|
|
2384
|
-
name={field.name}
|
|
2385
|
-
value={field.state.value}
|
|
2386
|
-
onBlur={field.handleBlur}
|
|
2387
|
-
onChange={(e) => field.handleChange(e.target.value)}
|
|
2388
|
-
/>
|
|
2389
|
-
{field.state.meta.errors.map((error) => (
|
|
2390
|
-
<p key={error?.message} className="text-red-500">
|
|
2391
|
-
{error?.message}
|
|
2392
|
-
</p>
|
|
2393
|
-
))}
|
|
2394
|
-
</div>
|
|
2395
|
-
)}
|
|
2396
|
-
</form.Field>
|
|
2397
|
-
</div>
|
|
2398
|
-
<div>
|
|
2399
|
-
<form.Field name="email">
|
|
2400
|
-
{(field) => (
|
|
2401
|
-
<div className="space-y-2">
|
|
2402
|
-
<Label htmlFor={field.name}>Email</Label>
|
|
2403
|
-
<Input
|
|
2404
|
-
id={field.name}
|
|
2405
|
-
name={field.name}
|
|
2406
|
-
type="email"
|
|
2407
|
-
value={field.state.value}
|
|
2408
|
-
onBlur={field.handleBlur}
|
|
2409
|
-
onChange={(e) => field.handleChange(e.target.value)}
|
|
2410
|
-
/>
|
|
2411
|
-
{field.state.meta.errors.map((error) => (
|
|
2412
|
-
<p key={error?.message} className="text-red-500">
|
|
2413
|
-
{error?.message}
|
|
2414
|
-
</p>
|
|
2415
|
-
))}
|
|
2416
|
-
</div>
|
|
2417
|
-
)}
|
|
2418
|
-
</form.Field>
|
|
2419
|
-
</div>
|
|
2420
|
-
<div>
|
|
2421
|
-
<form.Field name="password">
|
|
2422
|
-
{(field) => (
|
|
2423
|
-
<div className="space-y-2">
|
|
2424
|
-
<Label htmlFor={field.name}>Password</Label>
|
|
2425
|
-
<Input
|
|
2426
|
-
id={field.name}
|
|
2427
|
-
name={field.name}
|
|
2428
|
-
type="password"
|
|
2429
|
-
value={field.state.value}
|
|
2430
|
-
onBlur={field.handleBlur}
|
|
2431
|
-
onChange={(e) => field.handleChange(e.target.value)}
|
|
2432
|
-
/>
|
|
2433
|
-
{field.state.meta.errors.map((error) => (
|
|
2434
|
-
<p key={error?.message} className="text-red-500">
|
|
2435
|
-
{error?.message}
|
|
2436
|
-
</p>
|
|
2437
|
-
))}
|
|
2438
|
-
</div>
|
|
2439
|
-
)}
|
|
2440
|
-
</form.Field>
|
|
2441
|
-
</div>
|
|
2442
|
-
<form.Subscribe>
|
|
2443
|
-
{(state) => (
|
|
2444
|
-
<Button
|
|
2445
|
-
type="submit"
|
|
2446
|
-
className="w-full"
|
|
2447
|
-
disabled={!state.canSubmit || state.isSubmitting}
|
|
2448
|
-
>
|
|
2449
|
-
{state.isSubmitting ? "Submitting..." : "Sign Up"}
|
|
2450
|
-
</Button>
|
|
2451
|
-
)}
|
|
2452
|
-
</form.Subscribe>
|
|
2453
|
-
</form>
|
|
2454
|
-
<div className="mt-4 text-center">
|
|
2455
|
-
<Button
|
|
2456
|
-
variant="link"
|
|
2457
|
-
onClick={onSwitchToSignIn}
|
|
2458
|
-
className="text-indigo-600 hover:text-indigo-800"
|
|
2459
|
-
>
|
|
2460
|
-
Already have an account? Sign In
|
|
2461
|
-
</Button>
|
|
2462
|
-
</div>
|
|
2463
|
-
</div>
|
|
2464
|
-
);
|
|
2465
|
-
}
|
|
2466
|
-
`,
|
|
2467
|
-
type: "text"
|
|
2468
|
-
},
|
|
2469
|
-
"auth/web/react/react-router/src/components/user-menu.tsx": {
|
|
2470
|
-
metadata: {
|
|
2471
|
-
updatedAt: "2025-06-17T06:06:35.000Z",
|
|
2472
|
-
updatedHash: "e0e976a589"
|
|
2473
|
-
},
|
|
2474
|
-
content: `import {
|
|
2475
|
-
DropdownMenu,
|
|
2476
|
-
DropdownMenuContent,
|
|
2477
|
-
DropdownMenuItem,
|
|
2478
|
-
DropdownMenuLabel,
|
|
2479
|
-
DropdownMenuSeparator,
|
|
2480
|
-
DropdownMenuTrigger,
|
|
2481
|
-
} from "@/components/ui/dropdown-menu";
|
|
2482
|
-
import { authClient } from "@/lib/auth-client";
|
|
2483
|
-
import { useNavigate } from "react-router";
|
|
2484
|
-
import { Button } from "./ui/button";
|
|
2485
|
-
import { Skeleton } from "./ui/skeleton";
|
|
2486
|
-
import { Link } from "react-router";
|
|
2487
|
-
export default function UserMenu() {
|
|
2488
|
-
const navigate = useNavigate();
|
|
2489
|
-
const { data: session, isPending } = authClient.useSession();
|
|
2490
|
-
if (isPending) {
|
|
2491
|
-
return <Skeleton className="h-9 w-24" />;
|
|
2492
|
-
}
|
|
2493
|
-
if (!session) {
|
|
2494
|
-
return (
|
|
2495
|
-
<Button variant="outline" asChild>
|
|
2496
|
-
<Link to="/login">Sign In</Link>
|
|
2497
|
-
</Button>
|
|
2498
|
-
);
|
|
2499
|
-
}
|
|
2500
|
-
return (
|
|
2501
|
-
<DropdownMenu>
|
|
2502
|
-
<DropdownMenuTrigger asChild>
|
|
2503
|
-
<Button variant="outline">{session.user.name}</Button>
|
|
2504
|
-
</DropdownMenuTrigger>
|
|
2505
|
-
<DropdownMenuContent className="bg-card">
|
|
2506
|
-
<DropdownMenuLabel>My Account</DropdownMenuLabel>
|
|
2507
|
-
<DropdownMenuSeparator />
|
|
2508
|
-
<DropdownMenuItem>{session.user.email}</DropdownMenuItem>
|
|
2509
|
-
<DropdownMenuItem asChild>
|
|
2510
|
-
<Button
|
|
2511
|
-
variant="destructive"
|
|
2512
|
-
className="w-full"
|
|
2513
|
-
onClick={() => {
|
|
2514
|
-
authClient.signOut({
|
|
2515
|
-
fetchOptions: {
|
|
2516
|
-
onSuccess: () => {
|
|
2517
|
-
navigate("/");
|
|
2518
|
-
},
|
|
2519
|
-
},
|
|
2520
|
-
});
|
|
2521
|
-
}}
|
|
2522
|
-
>
|
|
2523
|
-
Sign Out
|
|
2524
|
-
</Button>
|
|
2525
|
-
</DropdownMenuItem>
|
|
2526
|
-
</DropdownMenuContent>
|
|
2527
|
-
</DropdownMenu>
|
|
2528
|
-
);
|
|
2529
|
-
}
|
|
2530
|
-
`,
|
|
2531
|
-
type: "text"
|
|
2532
|
-
},
|
|
2533
|
-
"auth/web/react/react-router/src/routes/dashboard.tsx.hbs": {
|
|
2534
|
-
metadata: {
|
|
2535
|
-
updatedAt: "2025-06-17T06:06:35.000Z",
|
|
2536
|
-
updatedHash: "89b645f778"
|
|
2537
|
-
},
|
|
2538
|
-
content: `import { authClient } from "@/lib/auth-client";
|
|
2539
|
-
{{#if (eq api "orpc")}}
|
|
2540
|
-
import { orpc } from "@/utils/orpc";
|
|
2541
|
-
{{/if}}
|
|
2542
|
-
{{#if (eq api "trpc")}}
|
|
2543
|
-
import { trpc } from "@/utils/trpc";
|
|
2544
|
-
{{/if}}
|
|
2545
|
-
import { useQuery } from "@tanstack/react-query";
|
|
2546
|
-
import { useEffect } from "react";
|
|
2547
|
-
import { useNavigate } from "react-router";
|
|
2548
|
-
export default function Dashboard() {
|
|
2549
|
-
const { data: session, isPending } = authClient.useSession();
|
|
2550
|
-
const navigate = useNavigate();
|
|
2551
|
-
{{#if (eq api "orpc")}}
|
|
2552
|
-
const privateData = useQuery(orpc.privateData.queryOptions());
|
|
2553
|
-
{{/if}}
|
|
2554
|
-
{{#if (eq api "trpc")}}
|
|
2555
|
-
const privateData = useQuery(trpc.privateData.queryOptions());
|
|
2556
|
-
{{/if}}
|
|
2557
|
-
useEffect(() => {
|
|
2558
|
-
if (!session && !isPending) {
|
|
2559
|
-
navigate("/login");
|
|
2560
|
-
}
|
|
2561
|
-
}, [session, isPending]);
|
|
2562
|
-
if (isPending) {
|
|
2563
|
-
return <div>Loading...</div>;
|
|
2564
|
-
}
|
|
2565
|
-
return (
|
|
2566
|
-
<div>
|
|
2567
|
-
<h1>Dashboard</h1>
|
|
2568
|
-
<p>Welcome {session?.user.name}</p>
|
|
2569
|
-
<p>privateData: {privateData.data?.message}</p>
|
|
2570
|
-
</div>
|
|
2571
|
-
);
|
|
2572
|
-
}
|
|
2573
|
-
`,
|
|
2574
|
-
type: "text"
|
|
2575
|
-
},
|
|
2576
|
-
"auth/web/react/react-router/src/routes/login.tsx": {
|
|
2577
|
-
metadata: {
|
|
2578
|
-
updatedAt: "2025-06-17T06:06:35.000Z",
|
|
2579
|
-
updatedHash: "363d5a97fa"
|
|
2580
|
-
},
|
|
2581
|
-
content: `import SignInForm from "@/components/sign-in-form";
|
|
2582
|
-
import SignUpForm from "@/components/sign-up-form";
|
|
2583
|
-
import { useState } from "react";
|
|
2584
|
-
export default function Login() {
|
|
2585
|
-
const [showSignIn, setShowSignIn] = useState(false);
|
|
2586
|
-
return showSignIn ? (
|
|
2587
|
-
<SignInForm onSwitchToSignUp={() => setShowSignIn(false)} />
|
|
2588
|
-
) : (
|
|
2589
|
-
<SignUpForm onSwitchToSignIn={() => setShowSignIn(true)} />
|
|
2590
|
-
);
|
|
2591
|
-
}
|
|
2592
|
-
`,
|
|
2593
|
-
type: "text"
|
|
2594
|
-
},
|
|
2595
|
-
"auth/web/react/tanstack-router/src/components/sign-in-form.tsx": {
|
|
2596
|
-
metadata: {
|
|
2597
|
-
updatedAt: "2025-06-17T06:06:35.000Z",
|
|
2598
|
-
updatedHash: "e1a9d1f7c1"
|
|
2599
|
-
},
|
|
2600
|
-
content: `import { authClient } from "@/lib/auth-client";
|
|
2601
|
-
import { useForm } from "@tanstack/react-form";
|
|
2602
|
-
import { useNavigate } from "@tanstack/react-router";
|
|
2603
|
-
import { toast } from "sonner";
|
|
2604
|
-
import z from "zod/v4";
|
|
2605
|
-
import Loader from "./loader";
|
|
2606
|
-
import { Button } from "./ui/button";
|
|
2607
|
-
import { Input } from "./ui/input";
|
|
2608
|
-
import { Label } from "./ui/label";
|
|
2609
|
-
export default function SignInForm({
|
|
2610
|
-
onSwitchToSignUp,
|
|
2611
|
-
}: {
|
|
2612
|
-
onSwitchToSignUp: () => void;
|
|
2613
|
-
}) {
|
|
2614
|
-
const navigate = useNavigate({
|
|
2615
|
-
from: "/",
|
|
2616
|
-
});
|
|
2617
|
-
const { isPending } = authClient.useSession();
|
|
2618
|
-
const form = useForm({
|
|
2619
|
-
defaultValues: {
|
|
2620
|
-
email: "",
|
|
2621
|
-
password: "",
|
|
2622
|
-
},
|
|
2623
|
-
onSubmit: async ({ value }) => {
|
|
2624
|
-
await authClient.signIn.email(
|
|
2625
|
-
{
|
|
2626
|
-
email: value.email,
|
|
2627
|
-
password: value.password,
|
|
2628
|
-
},
|
|
2629
|
-
{
|
|
2630
|
-
onSuccess: () => {
|
|
2631
|
-
navigate({
|
|
2632
|
-
to: "/dashboard",
|
|
2633
|
-
});
|
|
2634
|
-
toast.success("Sign in successful");
|
|
2635
|
-
},
|
|
2636
|
-
onError: (error) => {
|
|
2637
|
-
toast.error(error.error.message);
|
|
2638
|
-
},
|
|
2639
|
-
},
|
|
2640
|
-
);
|
|
2641
|
-
},
|
|
2642
|
-
validators: {
|
|
2643
|
-
onSubmit: z.object({
|
|
2644
|
-
email: z.email("Invalid email address"),
|
|
2645
|
-
password: z.string().min(8, "Password must be at least 8 characters"),
|
|
2646
|
-
}),
|
|
2647
|
-
},
|
|
2648
|
-
});
|
|
2649
|
-
if (isPending) {
|
|
2650
|
-
return <Loader />;
|
|
2651
|
-
}
|
|
2652
|
-
return (
|
|
2653
|
-
<div className="mx-auto w-full mt-10 max-w-md p-6">
|
|
2654
|
-
<h1 className="mb-6 text-center text-3xl font-bold">Welcome Back</h1>
|
|
2655
|
-
<form
|
|
2656
|
-
onSubmit={(e) => {
|
|
2657
|
-
e.preventDefault();
|
|
2658
|
-
e.stopPropagation();
|
|
2659
|
-
void form.handleSubmit();
|
|
2660
|
-
}}
|
|
2661
|
-
className="space-y-4"
|
|
2662
|
-
>
|
|
2663
|
-
<div>
|
|
2664
|
-
<form.Field name="email">
|
|
2665
|
-
{(field) => (
|
|
2666
|
-
<div className="space-y-2">
|
|
2667
|
-
<Label htmlFor={field.name}>Email</Label>
|
|
2668
|
-
<Input
|
|
2669
|
-
id={field.name}
|
|
2670
|
-
name={field.name}
|
|
2671
|
-
type="email"
|
|
2672
|
-
value={field.state.value}
|
|
2673
|
-
onBlur={field.handleBlur}
|
|
2674
|
-
onChange={(e) => field.handleChange(e.target.value)}
|
|
2675
|
-
/>
|
|
2676
|
-
{field.state.meta.errors.map((error) => (
|
|
2677
|
-
<p key={error?.message} className="text-red-500">
|
|
2678
|
-
{error?.message}
|
|
2679
|
-
</p>
|
|
2680
|
-
))}
|
|
2681
|
-
</div>
|
|
2682
|
-
)}
|
|
2683
|
-
</form.Field>
|
|
2684
|
-
</div>
|
|
2685
|
-
<div>
|
|
2686
|
-
<form.Field name="password">
|
|
2687
|
-
{(field) => (
|
|
2688
|
-
<div className="space-y-2">
|
|
2689
|
-
<Label htmlFor={field.name}>Password</Label>
|
|
2690
|
-
<Input
|
|
2691
|
-
id={field.name}
|
|
2692
|
-
name={field.name}
|
|
2693
|
-
type="password"
|
|
2694
|
-
value={field.state.value}
|
|
2695
|
-
onBlur={field.handleBlur}
|
|
2696
|
-
onChange={(e) => field.handleChange(e.target.value)}
|
|
2697
|
-
/>
|
|
2698
|
-
{field.state.meta.errors.map((error) => (
|
|
2699
|
-
<p key={error?.message} className="text-red-500">
|
|
2700
|
-
{error?.message}
|
|
2701
|
-
</p>
|
|
2702
|
-
))}
|
|
2703
|
-
</div>
|
|
2704
|
-
)}
|
|
2705
|
-
</form.Field>
|
|
2706
|
-
</div>
|
|
2707
|
-
<form.Subscribe>
|
|
2708
|
-
{(state) => (
|
|
2709
|
-
<Button
|
|
2710
|
-
type="submit"
|
|
2711
|
-
className="w-full"
|
|
2712
|
-
disabled={!state.canSubmit || state.isSubmitting}
|
|
2713
|
-
>
|
|
2714
|
-
{state.isSubmitting ? "Submitting..." : "Sign In"}
|
|
2715
|
-
</Button>
|
|
2716
|
-
)}
|
|
2717
|
-
</form.Subscribe>
|
|
2718
|
-
</form>
|
|
2719
|
-
<div className="mt-4 text-center">
|
|
2720
|
-
<Button
|
|
2721
|
-
variant="link"
|
|
2722
|
-
onClick={onSwitchToSignUp}
|
|
2723
|
-
className="text-indigo-600 hover:text-indigo-800"
|
|
2724
|
-
>
|
|
2725
|
-
Need an account? Sign Up
|
|
2726
|
-
</Button>
|
|
2727
|
-
</div>
|
|
2728
|
-
</div>
|
|
2729
|
-
);
|
|
2730
|
-
}
|
|
2731
|
-
`,
|
|
2732
|
-
type: "text"
|
|
2733
|
-
},
|
|
2734
|
-
"auth/web/react/tanstack-router/src/components/sign-up-form.tsx": {
|
|
2735
|
-
metadata: {
|
|
2736
|
-
updatedAt: "2025-06-17T06:06:35.000Z",
|
|
2737
|
-
updatedHash: "82991981ef"
|
|
2738
|
-
},
|
|
2739
|
-
content: `import { authClient } from "@/lib/auth-client";
|
|
2740
|
-
import { useForm } from "@tanstack/react-form";
|
|
2741
|
-
import { useNavigate } from "@tanstack/react-router";
|
|
2742
|
-
import { toast } from "sonner";
|
|
2743
|
-
import z from "zod/v4";
|
|
2744
|
-
import Loader from "./loader";
|
|
2745
|
-
import { Button } from "./ui/button";
|
|
2746
|
-
import { Input } from "./ui/input";
|
|
2747
|
-
import { Label } from "./ui/label";
|
|
2748
|
-
export default function SignUpForm({
|
|
2749
|
-
onSwitchToSignIn,
|
|
2750
|
-
}: {
|
|
2751
|
-
onSwitchToSignIn: () => void;
|
|
2752
|
-
}) {
|
|
2753
|
-
const navigate = useNavigate({
|
|
2754
|
-
from: "/",
|
|
2755
|
-
});
|
|
2756
|
-
const { isPending } = authClient.useSession();
|
|
2757
|
-
const form = useForm({
|
|
2758
|
-
defaultValues: {
|
|
2759
|
-
email: "",
|
|
2760
|
-
password: "",
|
|
2761
|
-
name: "",
|
|
2762
|
-
},
|
|
2763
|
-
onSubmit: async ({ value }) => {
|
|
2764
|
-
await authClient.signUp.email(
|
|
2765
|
-
{
|
|
2766
|
-
email: value.email,
|
|
2767
|
-
password: value.password,
|
|
2768
|
-
name: value.name,
|
|
2769
|
-
},
|
|
2770
|
-
{
|
|
2771
|
-
onSuccess: () => {
|
|
2772
|
-
navigate({
|
|
2773
|
-
to: "/dashboard",
|
|
2774
|
-
});
|
|
2775
|
-
toast.success("Sign up successful");
|
|
2776
|
-
},
|
|
2777
|
-
onError: (error) => {
|
|
2778
|
-
toast.error(error.error.message);
|
|
2779
|
-
},
|
|
2780
|
-
},
|
|
2781
|
-
);
|
|
2782
|
-
},
|
|
2783
|
-
validators: {
|
|
2784
|
-
onSubmit: z.object({
|
|
2785
|
-
name: z.string().min(2, "Name must be at least 2 characters"),
|
|
2786
|
-
email: z.email("Invalid email address"),
|
|
2787
|
-
password: z.string().min(8, "Password must be at least 8 characters"),
|
|
2788
|
-
}),
|
|
2789
|
-
},
|
|
2790
|
-
});
|
|
2791
|
-
if (isPending) {
|
|
2792
|
-
return <Loader />;
|
|
2793
|
-
}
|
|
2794
|
-
return (
|
|
2795
|
-
<div className="mx-auto w-full mt-10 max-w-md p-6">
|
|
2796
|
-
<h1 className="mb-6 text-center text-3xl font-bold">Create Account</h1>
|
|
2797
|
-
<form
|
|
2798
|
-
onSubmit={(e) => {
|
|
2799
|
-
e.preventDefault();
|
|
2800
|
-
e.stopPropagation();
|
|
2801
|
-
void form.handleSubmit();
|
|
2802
|
-
}}
|
|
2803
|
-
className="space-y-4"
|
|
2804
|
-
>
|
|
2805
|
-
<div>
|
|
2806
|
-
<form.Field name="name">
|
|
2807
|
-
{(field) => (
|
|
2808
|
-
<div className="space-y-2">
|
|
2809
|
-
<Label htmlFor={field.name}>Name</Label>
|
|
2810
|
-
<Input
|
|
2811
|
-
id={field.name}
|
|
2812
|
-
name={field.name}
|
|
2813
|
-
value={field.state.value}
|
|
2814
|
-
onBlur={field.handleBlur}
|
|
2815
|
-
onChange={(e) => field.handleChange(e.target.value)}
|
|
2816
|
-
/>
|
|
2817
|
-
{field.state.meta.errors.map((error) => (
|
|
2818
|
-
<p key={error?.message} className="text-red-500">
|
|
2819
|
-
{error?.message}
|
|
2820
|
-
</p>
|
|
2821
|
-
))}
|
|
2822
|
-
</div>
|
|
2823
|
-
)}
|
|
2824
|
-
</form.Field>
|
|
2825
|
-
</div>
|
|
2826
|
-
<div>
|
|
2827
|
-
<form.Field name="email">
|
|
2828
|
-
{(field) => (
|
|
2829
|
-
<div className="space-y-2">
|
|
2830
|
-
<Label htmlFor={field.name}>Email</Label>
|
|
2831
|
-
<Input
|
|
2832
|
-
id={field.name}
|
|
2833
|
-
name={field.name}
|
|
2834
|
-
type="email"
|
|
2835
|
-
value={field.state.value}
|
|
2836
|
-
onBlur={field.handleBlur}
|
|
2837
|
-
onChange={(e) => field.handleChange(e.target.value)}
|
|
2838
|
-
/>
|
|
2839
|
-
{field.state.meta.errors.map((error) => (
|
|
2840
|
-
<p key={error?.message} className="text-red-500">
|
|
2841
|
-
{error?.message}
|
|
2842
|
-
</p>
|
|
2843
|
-
))}
|
|
2844
|
-
</div>
|
|
2845
|
-
)}
|
|
2846
|
-
</form.Field>
|
|
2847
|
-
</div>
|
|
2848
|
-
<div>
|
|
2849
|
-
<form.Field name="password">
|
|
2850
|
-
{(field) => (
|
|
2851
|
-
<div className="space-y-2">
|
|
2852
|
-
<Label htmlFor={field.name}>Password</Label>
|
|
2853
|
-
<Input
|
|
2854
|
-
id={field.name}
|
|
2855
|
-
name={field.name}
|
|
2856
|
-
type="password"
|
|
2857
|
-
value={field.state.value}
|
|
2858
|
-
onBlur={field.handleBlur}
|
|
2859
|
-
onChange={(e) => field.handleChange(e.target.value)}
|
|
2860
|
-
/>
|
|
2861
|
-
{field.state.meta.errors.map((error) => (
|
|
2862
|
-
<p key={error?.message} className="text-red-500">
|
|
2863
|
-
{error?.message}
|
|
2864
|
-
</p>
|
|
2865
|
-
))}
|
|
2866
|
-
</div>
|
|
2867
|
-
)}
|
|
2868
|
-
</form.Field>
|
|
2869
|
-
</div>
|
|
2870
|
-
<form.Subscribe>
|
|
2871
|
-
{(state) => (
|
|
2872
|
-
<Button
|
|
2873
|
-
type="submit"
|
|
2874
|
-
className="w-full"
|
|
2875
|
-
disabled={!state.canSubmit || state.isSubmitting}
|
|
2876
|
-
>
|
|
2877
|
-
{state.isSubmitting ? "Submitting..." : "Sign Up"}
|
|
2878
|
-
</Button>
|
|
2879
|
-
)}
|
|
2880
|
-
</form.Subscribe>
|
|
2881
|
-
</form>
|
|
2882
|
-
<div className="mt-4 text-center">
|
|
2883
|
-
<Button
|
|
2884
|
-
variant="link"
|
|
2885
|
-
onClick={onSwitchToSignIn}
|
|
2886
|
-
className="text-indigo-600 hover:text-indigo-800"
|
|
2887
|
-
>
|
|
2888
|
-
Already have an account? Sign In
|
|
2889
|
-
</Button>
|
|
2890
|
-
</div>
|
|
2891
|
-
</div>
|
|
2892
|
-
);
|
|
2893
|
-
}
|
|
2894
|
-
`,
|
|
2895
|
-
type: "text"
|
|
2896
|
-
},
|
|
2897
|
-
"auth/web/react/tanstack-router/src/components/user-menu.tsx": {
|
|
2898
|
-
metadata: {
|
|
2899
|
-
updatedAt: "2025-06-17T06:06:35.000Z",
|
|
2900
|
-
updatedHash: "663a5f6c2d"
|
|
2901
|
-
},
|
|
2902
|
-
content: `import {
|
|
2903
|
-
DropdownMenu,
|
|
2904
|
-
DropdownMenuContent,
|
|
2905
|
-
DropdownMenuItem,
|
|
2906
|
-
DropdownMenuLabel,
|
|
2907
|
-
DropdownMenuSeparator,
|
|
2908
|
-
DropdownMenuTrigger,
|
|
2909
|
-
} from "@/components/ui/dropdown-menu";
|
|
2910
|
-
import { authClient } from "@/lib/auth-client";
|
|
2911
|
-
import { useNavigate } from "@tanstack/react-router";
|
|
2912
|
-
import { Button } from "./ui/button";
|
|
2913
|
-
import { Skeleton } from "./ui/skeleton";
|
|
2914
|
-
import { Link } from "@tanstack/react-router";
|
|
2915
|
-
export default function UserMenu() {
|
|
2916
|
-
const navigate = useNavigate();
|
|
2917
|
-
const { data: session, isPending } = authClient.useSession();
|
|
2918
|
-
if (isPending) {
|
|
2919
|
-
return <Skeleton className="h-9 w-24" />;
|
|
2920
|
-
}
|
|
2921
|
-
if (!session) {
|
|
2922
|
-
return (
|
|
2923
|
-
<Button variant="outline" asChild>
|
|
2924
|
-
<Link to="/login">Sign In</Link>
|
|
2925
|
-
</Button>
|
|
2926
|
-
);
|
|
2927
|
-
}
|
|
2928
|
-
return (
|
|
2929
|
-
<DropdownMenu>
|
|
2930
|
-
<DropdownMenuTrigger asChild>
|
|
2931
|
-
<Button variant="outline">{session.user.name}</Button>
|
|
2932
|
-
</DropdownMenuTrigger>
|
|
2933
|
-
<DropdownMenuContent className="bg-card">
|
|
2934
|
-
<DropdownMenuLabel>My Account</DropdownMenuLabel>
|
|
2935
|
-
<DropdownMenuSeparator />
|
|
2936
|
-
<DropdownMenuItem>{session.user.email}</DropdownMenuItem>
|
|
2937
|
-
<DropdownMenuItem asChild>
|
|
2938
|
-
<Button
|
|
2939
|
-
variant="destructive"
|
|
2940
|
-
className="w-full"
|
|
2941
|
-
onClick={() => {
|
|
2942
|
-
authClient.signOut({
|
|
2943
|
-
fetchOptions: {
|
|
2944
|
-
onSuccess: () => {
|
|
2945
|
-
navigate({
|
|
2946
|
-
to: "/",
|
|
2947
|
-
});
|
|
2948
|
-
},
|
|
2949
|
-
},
|
|
2950
|
-
});
|
|
2951
|
-
}}
|
|
2952
|
-
>
|
|
2953
|
-
Sign Out
|
|
2954
|
-
</Button>
|
|
2955
|
-
</DropdownMenuItem>
|
|
2956
|
-
</DropdownMenuContent>
|
|
2957
|
-
</DropdownMenu>
|
|
2958
|
-
);
|
|
2959
|
-
}
|
|
2960
|
-
`,
|
|
2961
|
-
type: "text"
|
|
2962
|
-
},
|
|
2963
|
-
"auth/web/react/tanstack-router/src/routes/dashboard.tsx.hbs": {
|
|
2964
|
-
metadata: {
|
|
2965
|
-
updatedAt: "2025-06-17T06:06:35.000Z",
|
|
2966
|
-
updatedHash: "9caca31595"
|
|
2967
|
-
},
|
|
2968
|
-
content: `import { authClient } from "@/lib/auth-client";
|
|
2969
|
-
{{#if (eq api "orpc")}}
|
|
2970
|
-
import { orpc } from "@/utils/orpc";
|
|
2971
|
-
{{/if}}
|
|
2972
|
-
{{#if (eq api "trpc")}}
|
|
2973
|
-
import { trpc } from "@/utils/trpc";
|
|
2974
|
-
{{/if}}
|
|
2975
|
-
import { useQuery } from "@tanstack/react-query";
|
|
2976
|
-
import { createFileRoute } from "@tanstack/react-router";
|
|
2977
|
-
import { useEffect } from "react";
|
|
2978
|
-
export const Route = createFileRoute("/dashboard")({
|
|
2979
|
-
component: RouteComponent,
|
|
2980
|
-
});
|
|
2981
|
-
function RouteComponent() {
|
|
2982
|
-
const { data: session, isPending } = authClient.useSession();
|
|
2983
|
-
const navigate = Route.useNavigate();
|
|
2984
|
-
{{#if (eq api "orpc")}}
|
|
2985
|
-
const privateData = useQuery(orpc.privateData.queryOptions());
|
|
2986
|
-
{{/if}}
|
|
2987
|
-
{{#if (eq api "trpc")}}
|
|
2988
|
-
const privateData = useQuery(trpc.privateData.queryOptions());
|
|
2989
|
-
{{/if}}
|
|
2990
|
-
useEffect(() => {
|
|
2991
|
-
if (!session && !isPending) {
|
|
2992
|
-
navigate({
|
|
2993
|
-
to: "/login",
|
|
2994
|
-
});
|
|
2995
|
-
}
|
|
2996
|
-
}, [session, isPending]);
|
|
2997
|
-
if (isPending) {
|
|
2998
|
-
return <div>Loading...</div>;
|
|
2999
|
-
}
|
|
3000
|
-
return (
|
|
3001
|
-
<div>
|
|
3002
|
-
<h1>Dashboard</h1>
|
|
3003
|
-
<p>Welcome {session?.user.name}</p>
|
|
3004
|
-
<p>privateData: {privateData.data?.message}</p>
|
|
3005
|
-
</div>
|
|
3006
|
-
);
|
|
3007
|
-
}
|
|
3008
|
-
`,
|
|
3009
|
-
type: "text"
|
|
3010
|
-
},
|
|
3011
|
-
"auth/web/react/tanstack-router/src/routes/login.tsx": {
|
|
3012
|
-
metadata: {
|
|
3013
|
-
updatedAt: "2025-06-17T06:06:35.000Z",
|
|
3014
|
-
updatedHash: "dd3dd58a52"
|
|
3015
|
-
},
|
|
3016
|
-
content: `import SignInForm from "@/components/sign-in-form";
|
|
3017
|
-
import SignUpForm from "@/components/sign-up-form";
|
|
3018
|
-
import { createFileRoute } from "@tanstack/react-router";
|
|
3019
|
-
import { useState } from "react";
|
|
3020
|
-
export const Route = createFileRoute("/login")({
|
|
3021
|
-
component: RouteComponent,
|
|
3022
|
-
});
|
|
3023
|
-
function RouteComponent() {
|
|
3024
|
-
const [showSignIn, setShowSignIn] = useState(false);
|
|
3025
|
-
return showSignIn ? (
|
|
3026
|
-
<SignInForm onSwitchToSignUp={() => setShowSignIn(false)} />
|
|
3027
|
-
) : (
|
|
3028
|
-
<SignUpForm onSwitchToSignIn={() => setShowSignIn(true)} />
|
|
3029
|
-
);
|
|
3030
|
-
}
|
|
3031
|
-
`,
|
|
3032
|
-
type: "text"
|
|
3033
|
-
},
|
|
3034
|
-
"auth/web/react/tanstack-start/src/components/sign-in-form.tsx": {
|
|
3035
|
-
metadata: {
|
|
3036
|
-
updatedAt: "2025-06-17T06:06:35.000Z",
|
|
3037
|
-
updatedHash: "e1a9d1f7c1"
|
|
3038
|
-
},
|
|
3039
|
-
content: `import { authClient } from "@/lib/auth-client";
|
|
3040
|
-
import { useForm } from "@tanstack/react-form";
|
|
3041
|
-
import { useNavigate } from "@tanstack/react-router";
|
|
3042
|
-
import { toast } from "sonner";
|
|
3043
|
-
import z from "zod/v4";
|
|
3044
|
-
import Loader from "./loader";
|
|
3045
|
-
import { Button } from "./ui/button";
|
|
3046
|
-
import { Input } from "./ui/input";
|
|
3047
|
-
import { Label } from "./ui/label";
|
|
3048
|
-
export default function SignInForm({
|
|
3049
|
-
onSwitchToSignUp,
|
|
3050
|
-
}: {
|
|
3051
|
-
onSwitchToSignUp: () => void;
|
|
3052
|
-
}) {
|
|
3053
|
-
const navigate = useNavigate({
|
|
3054
|
-
from: "/",
|
|
3055
|
-
});
|
|
3056
|
-
const { isPending } = authClient.useSession();
|
|
3057
|
-
const form = useForm({
|
|
3058
|
-
defaultValues: {
|
|
3059
|
-
email: "",
|
|
3060
|
-
password: "",
|
|
3061
|
-
},
|
|
3062
|
-
onSubmit: async ({ value }) => {
|
|
3063
|
-
await authClient.signIn.email(
|
|
3064
|
-
{
|
|
3065
|
-
email: value.email,
|
|
3066
|
-
password: value.password,
|
|
3067
|
-
},
|
|
3068
|
-
{
|
|
3069
|
-
onSuccess: () => {
|
|
3070
|
-
navigate({
|
|
3071
|
-
to: "/dashboard",
|
|
3072
|
-
});
|
|
3073
|
-
toast.success("Sign in successful");
|
|
3074
|
-
},
|
|
3075
|
-
onError: (error) => {
|
|
3076
|
-
toast.error(error.error.message);
|
|
3077
|
-
},
|
|
3078
|
-
},
|
|
3079
|
-
);
|
|
3080
|
-
},
|
|
3081
|
-
validators: {
|
|
3082
|
-
onSubmit: z.object({
|
|
3083
|
-
email: z.email("Invalid email address"),
|
|
3084
|
-
password: z.string().min(8, "Password must be at least 8 characters"),
|
|
3085
|
-
}),
|
|
3086
|
-
},
|
|
3087
|
-
});
|
|
3088
|
-
if (isPending) {
|
|
3089
|
-
return <Loader />;
|
|
3090
|
-
}
|
|
3091
|
-
return (
|
|
3092
|
-
<div className="mx-auto w-full mt-10 max-w-md p-6">
|
|
3093
|
-
<h1 className="mb-6 text-center text-3xl font-bold">Welcome Back</h1>
|
|
3094
|
-
<form
|
|
3095
|
-
onSubmit={(e) => {
|
|
3096
|
-
e.preventDefault();
|
|
3097
|
-
e.stopPropagation();
|
|
3098
|
-
void form.handleSubmit();
|
|
3099
|
-
}}
|
|
3100
|
-
className="space-y-4"
|
|
3101
|
-
>
|
|
3102
|
-
<div>
|
|
3103
|
-
<form.Field name="email">
|
|
3104
|
-
{(field) => (
|
|
3105
|
-
<div className="space-y-2">
|
|
3106
|
-
<Label htmlFor={field.name}>Email</Label>
|
|
3107
|
-
<Input
|
|
3108
|
-
id={field.name}
|
|
3109
|
-
name={field.name}
|
|
3110
|
-
type="email"
|
|
3111
|
-
value={field.state.value}
|
|
3112
|
-
onBlur={field.handleBlur}
|
|
3113
|
-
onChange={(e) => field.handleChange(e.target.value)}
|
|
3114
|
-
/>
|
|
3115
|
-
{field.state.meta.errors.map((error) => (
|
|
3116
|
-
<p key={error?.message} className="text-red-500">
|
|
3117
|
-
{error?.message}
|
|
3118
|
-
</p>
|
|
3119
|
-
))}
|
|
3120
|
-
</div>
|
|
3121
|
-
)}
|
|
3122
|
-
</form.Field>
|
|
3123
|
-
</div>
|
|
3124
|
-
<div>
|
|
3125
|
-
<form.Field name="password">
|
|
3126
|
-
{(field) => (
|
|
3127
|
-
<div className="space-y-2">
|
|
3128
|
-
<Label htmlFor={field.name}>Password</Label>
|
|
3129
|
-
<Input
|
|
3130
|
-
id={field.name}
|
|
3131
|
-
name={field.name}
|
|
3132
|
-
type="password"
|
|
3133
|
-
value={field.state.value}
|
|
3134
|
-
onBlur={field.handleBlur}
|
|
3135
|
-
onChange={(e) => field.handleChange(e.target.value)}
|
|
3136
|
-
/>
|
|
3137
|
-
{field.state.meta.errors.map((error) => (
|
|
3138
|
-
<p key={error?.message} className="text-red-500">
|
|
3139
|
-
{error?.message}
|
|
3140
|
-
</p>
|
|
3141
|
-
))}
|
|
3142
|
-
</div>
|
|
3143
|
-
)}
|
|
3144
|
-
</form.Field>
|
|
3145
|
-
</div>
|
|
3146
|
-
<form.Subscribe>
|
|
3147
|
-
{(state) => (
|
|
3148
|
-
<Button
|
|
3149
|
-
type="submit"
|
|
3150
|
-
className="w-full"
|
|
3151
|
-
disabled={!state.canSubmit || state.isSubmitting}
|
|
3152
|
-
>
|
|
3153
|
-
{state.isSubmitting ? "Submitting..." : "Sign In"}
|
|
3154
|
-
</Button>
|
|
3155
|
-
)}
|
|
3156
|
-
</form.Subscribe>
|
|
3157
|
-
</form>
|
|
3158
|
-
<div className="mt-4 text-center">
|
|
3159
|
-
<Button
|
|
3160
|
-
variant="link"
|
|
3161
|
-
onClick={onSwitchToSignUp}
|
|
3162
|
-
className="text-indigo-600 hover:text-indigo-800"
|
|
3163
|
-
>
|
|
3164
|
-
Need an account? Sign Up
|
|
3165
|
-
</Button>
|
|
3166
|
-
</div>
|
|
3167
|
-
</div>
|
|
3168
|
-
);
|
|
3169
|
-
}
|
|
3170
|
-
`,
|
|
3171
|
-
type: "text"
|
|
3172
|
-
},
|
|
3173
|
-
"auth/web/react/tanstack-start/src/components/sign-up-form.tsx": {
|
|
3174
|
-
metadata: {
|
|
3175
|
-
updatedAt: "2025-06-17T06:06:35.000Z",
|
|
3176
|
-
updatedHash: "82991981ef"
|
|
3177
|
-
},
|
|
3178
|
-
content: `import { authClient } from "@/lib/auth-client";
|
|
3179
|
-
import { useForm } from "@tanstack/react-form";
|
|
3180
|
-
import { useNavigate } from "@tanstack/react-router";
|
|
3181
|
-
import { toast } from "sonner";
|
|
3182
|
-
import z from "zod/v4";
|
|
3183
|
-
import Loader from "./loader";
|
|
3184
|
-
import { Button } from "./ui/button";
|
|
3185
|
-
import { Input } from "./ui/input";
|
|
3186
|
-
import { Label } from "./ui/label";
|
|
3187
|
-
export default function SignUpForm({
|
|
3188
|
-
onSwitchToSignIn,
|
|
3189
|
-
}: {
|
|
3190
|
-
onSwitchToSignIn: () => void;
|
|
3191
|
-
}) {
|
|
3192
|
-
const navigate = useNavigate({
|
|
3193
|
-
from: "/",
|
|
3194
|
-
});
|
|
3195
|
-
const { isPending } = authClient.useSession();
|
|
3196
|
-
const form = useForm({
|
|
3197
|
-
defaultValues: {
|
|
3198
|
-
email: "",
|
|
3199
|
-
password: "",
|
|
3200
|
-
name: "",
|
|
3201
|
-
},
|
|
3202
|
-
onSubmit: async ({ value }) => {
|
|
3203
|
-
await authClient.signUp.email(
|
|
3204
|
-
{
|
|
3205
|
-
email: value.email,
|
|
3206
|
-
password: value.password,
|
|
3207
|
-
name: value.name,
|
|
3208
|
-
},
|
|
3209
|
-
{
|
|
3210
|
-
onSuccess: () => {
|
|
3211
|
-
navigate({
|
|
3212
|
-
to: "/dashboard",
|
|
3213
|
-
});
|
|
3214
|
-
toast.success("Sign up successful");
|
|
3215
|
-
},
|
|
3216
|
-
onError: (error) => {
|
|
3217
|
-
toast.error(error.error.message);
|
|
3218
|
-
},
|
|
3219
|
-
},
|
|
3220
|
-
);
|
|
3221
|
-
},
|
|
3222
|
-
validators: {
|
|
3223
|
-
onSubmit: z.object({
|
|
3224
|
-
name: z.string().min(2, "Name must be at least 2 characters"),
|
|
3225
|
-
email: z.email("Invalid email address"),
|
|
3226
|
-
password: z.string().min(8, "Password must be at least 8 characters"),
|
|
3227
|
-
}),
|
|
3228
|
-
},
|
|
3229
|
-
});
|
|
3230
|
-
if (isPending) {
|
|
3231
|
-
return <Loader />;
|
|
3232
|
-
}
|
|
3233
|
-
return (
|
|
3234
|
-
<div className="mx-auto w-full mt-10 max-w-md p-6">
|
|
3235
|
-
<h1 className="mb-6 text-center text-3xl font-bold">Create Account</h1>
|
|
3236
|
-
<form
|
|
3237
|
-
onSubmit={(e) => {
|
|
3238
|
-
e.preventDefault();
|
|
3239
|
-
e.stopPropagation();
|
|
3240
|
-
void form.handleSubmit();
|
|
3241
|
-
}}
|
|
3242
|
-
className="space-y-4"
|
|
3243
|
-
>
|
|
3244
|
-
<div>
|
|
3245
|
-
<form.Field name="name">
|
|
3246
|
-
{(field) => (
|
|
3247
|
-
<div className="space-y-2">
|
|
3248
|
-
<Label htmlFor={field.name}>Name</Label>
|
|
3249
|
-
<Input
|
|
3250
|
-
id={field.name}
|
|
3251
|
-
name={field.name}
|
|
3252
|
-
value={field.state.value}
|
|
3253
|
-
onBlur={field.handleBlur}
|
|
3254
|
-
onChange={(e) => field.handleChange(e.target.value)}
|
|
3255
|
-
/>
|
|
3256
|
-
{field.state.meta.errors.map((error) => (
|
|
3257
|
-
<p key={error?.message} className="text-red-500">
|
|
3258
|
-
{error?.message}
|
|
3259
|
-
</p>
|
|
3260
|
-
))}
|
|
3261
|
-
</div>
|
|
3262
|
-
)}
|
|
3263
|
-
</form.Field>
|
|
3264
|
-
</div>
|
|
3265
|
-
<div>
|
|
3266
|
-
<form.Field name="email">
|
|
3267
|
-
{(field) => (
|
|
3268
|
-
<div className="space-y-2">
|
|
3269
|
-
<Label htmlFor={field.name}>Email</Label>
|
|
3270
|
-
<Input
|
|
3271
|
-
id={field.name}
|
|
3272
|
-
name={field.name}
|
|
3273
|
-
type="email"
|
|
3274
|
-
value={field.state.value}
|
|
3275
|
-
onBlur={field.handleBlur}
|
|
3276
|
-
onChange={(e) => field.handleChange(e.target.value)}
|
|
3277
|
-
/>
|
|
3278
|
-
{field.state.meta.errors.map((error) => (
|
|
3279
|
-
<p key={error?.message} className="text-red-500">
|
|
3280
|
-
{error?.message}
|
|
3281
|
-
</p>
|
|
3282
|
-
))}
|
|
3283
|
-
</div>
|
|
3284
|
-
)}
|
|
3285
|
-
</form.Field>
|
|
3286
|
-
</div>
|
|
3287
|
-
<div>
|
|
3288
|
-
<form.Field name="password">
|
|
3289
|
-
{(field) => (
|
|
3290
|
-
<div className="space-y-2">
|
|
3291
|
-
<Label htmlFor={field.name}>Password</Label>
|
|
3292
|
-
<Input
|
|
3293
|
-
id={field.name}
|
|
3294
|
-
name={field.name}
|
|
3295
|
-
type="password"
|
|
3296
|
-
value={field.state.value}
|
|
3297
|
-
onBlur={field.handleBlur}
|
|
3298
|
-
onChange={(e) => field.handleChange(e.target.value)}
|
|
3299
|
-
/>
|
|
3300
|
-
{field.state.meta.errors.map((error) => (
|
|
3301
|
-
<p key={error?.message} className="text-red-500">
|
|
3302
|
-
{error?.message}
|
|
3303
|
-
</p>
|
|
3304
|
-
))}
|
|
3305
|
-
</div>
|
|
3306
|
-
)}
|
|
3307
|
-
</form.Field>
|
|
3308
|
-
</div>
|
|
3309
|
-
<form.Subscribe>
|
|
3310
|
-
{(state) => (
|
|
3311
|
-
<Button
|
|
3312
|
-
type="submit"
|
|
3313
|
-
className="w-full"
|
|
3314
|
-
disabled={!state.canSubmit || state.isSubmitting}
|
|
3315
|
-
>
|
|
3316
|
-
{state.isSubmitting ? "Submitting..." : "Sign Up"}
|
|
3317
|
-
</Button>
|
|
3318
|
-
)}
|
|
3319
|
-
</form.Subscribe>
|
|
3320
|
-
</form>
|
|
3321
|
-
<div className="mt-4 text-center">
|
|
3322
|
-
<Button
|
|
3323
|
-
variant="link"
|
|
3324
|
-
onClick={onSwitchToSignIn}
|
|
3325
|
-
className="text-indigo-600 hover:text-indigo-800"
|
|
3326
|
-
>
|
|
3327
|
-
Already have an account? Sign In
|
|
3328
|
-
</Button>
|
|
3329
|
-
</div>
|
|
3330
|
-
</div>
|
|
3331
|
-
);
|
|
3332
|
-
}
|
|
3333
|
-
`,
|
|
3334
|
-
type: "text"
|
|
3335
|
-
},
|
|
3336
|
-
"auth/web/react/tanstack-start/src/components/user-menu.tsx": {
|
|
3337
|
-
metadata: {
|
|
3338
|
-
updatedAt: "2025-06-17T06:06:35.000Z",
|
|
3339
|
-
updatedHash: "663a5f6c2d"
|
|
3340
|
-
},
|
|
3341
|
-
content: `import {
|
|
3342
|
-
DropdownMenu,
|
|
3343
|
-
DropdownMenuContent,
|
|
3344
|
-
DropdownMenuItem,
|
|
3345
|
-
DropdownMenuLabel,
|
|
3346
|
-
DropdownMenuSeparator,
|
|
3347
|
-
DropdownMenuTrigger,
|
|
3348
|
-
} from "@/components/ui/dropdown-menu";
|
|
3349
|
-
import { authClient } from "@/lib/auth-client";
|
|
3350
|
-
import { useNavigate } from "@tanstack/react-router";
|
|
3351
|
-
import { Button } from "./ui/button";
|
|
3352
|
-
import { Skeleton } from "./ui/skeleton";
|
|
3353
|
-
import { Link } from "@tanstack/react-router";
|
|
3354
|
-
export default function UserMenu() {
|
|
3355
|
-
const navigate = useNavigate();
|
|
3356
|
-
const { data: session, isPending } = authClient.useSession();
|
|
3357
|
-
if (isPending) {
|
|
3358
|
-
return <Skeleton className="h-9 w-24" />;
|
|
3359
|
-
}
|
|
3360
|
-
if (!session) {
|
|
3361
|
-
return (
|
|
3362
|
-
<Button variant="outline" asChild>
|
|
3363
|
-
<Link to="/login">Sign In</Link>
|
|
3364
|
-
</Button>
|
|
3365
|
-
);
|
|
3366
|
-
}
|
|
3367
|
-
return (
|
|
3368
|
-
<DropdownMenu>
|
|
3369
|
-
<DropdownMenuTrigger asChild>
|
|
3370
|
-
<Button variant="outline">{session.user.name}</Button>
|
|
3371
|
-
</DropdownMenuTrigger>
|
|
3372
|
-
<DropdownMenuContent className="bg-card">
|
|
3373
|
-
<DropdownMenuLabel>My Account</DropdownMenuLabel>
|
|
3374
|
-
<DropdownMenuSeparator />
|
|
3375
|
-
<DropdownMenuItem>{session.user.email}</DropdownMenuItem>
|
|
3376
|
-
<DropdownMenuItem asChild>
|
|
3377
|
-
<Button
|
|
3378
|
-
variant="destructive"
|
|
3379
|
-
className="w-full"
|
|
3380
|
-
onClick={() => {
|
|
3381
|
-
authClient.signOut({
|
|
3382
|
-
fetchOptions: {
|
|
3383
|
-
onSuccess: () => {
|
|
3384
|
-
navigate({
|
|
3385
|
-
to: "/",
|
|
3386
|
-
});
|
|
3387
|
-
},
|
|
3388
|
-
},
|
|
3389
|
-
});
|
|
3390
|
-
}}
|
|
3391
|
-
>
|
|
3392
|
-
Sign Out
|
|
3393
|
-
</Button>
|
|
3394
|
-
</DropdownMenuItem>
|
|
3395
|
-
</DropdownMenuContent>
|
|
3396
|
-
</DropdownMenu>
|
|
3397
|
-
);
|
|
3398
|
-
}
|
|
3399
|
-
`,
|
|
3400
|
-
type: "text"
|
|
3401
|
-
},
|
|
3402
|
-
"auth/web/react/tanstack-start/src/routes/dashboard.tsx.hbs": {
|
|
3403
|
-
metadata: {
|
|
3404
|
-
updatedAt: "2025-06-17T06:06:35.000Z",
|
|
3405
|
-
updatedHash: "a6b26c2e3b"
|
|
3406
|
-
},
|
|
3407
|
-
content: `import { authClient } from "@/lib/auth-client";
|
|
3408
|
-
{{#if (eq api "trpc")}}
|
|
3409
|
-
import { useTRPC } from "@/utils/trpc";
|
|
3410
|
-
{{/if}}
|
|
3411
|
-
{{#if (eq api "orpc")}}
|
|
3412
|
-
import { orpc } from "@/utils/orpc";
|
|
3413
|
-
{{/if}}
|
|
3414
|
-
import { useQuery } from "@tanstack/react-query";
|
|
3415
|
-
import { createFileRoute } from "@tanstack/react-router";
|
|
3416
|
-
import { useEffect } from "react";
|
|
3417
|
-
export const Route = createFileRoute("/dashboard")({
|
|
3418
|
-
component: RouteComponent,
|
|
3419
|
-
});
|
|
3420
|
-
function RouteComponent() {
|
|
3421
|
-
const navigate = Route.useNavigate();
|
|
3422
|
-
{{#if (eq api "trpc")}}
|
|
3423
|
-
const trpc = useTRPC();
|
|
3424
|
-
{{/if}}
|
|
3425
|
-
{{#if (eq api "orpc")}}
|
|
3426
|
-
{{/if}}
|
|
3427
|
-
const { data: session, isPending } = authClient.useSession();
|
|
3428
|
-
{{#if (eq api "trpc")}}
|
|
3429
|
-
const privateData = useQuery(trpc.privateData.queryOptions());
|
|
3430
|
-
{{/if}}
|
|
3431
|
-
{{#if (eq api "orpc")}}
|
|
3432
|
-
const privateData = useQuery(orpc.privateData.queryOptions());
|
|
3433
|
-
{{/if}}
|
|
3434
|
-
useEffect(() => {
|
|
3435
|
-
if (!session && !isPending) {
|
|
3436
|
-
navigate({
|
|
3437
|
-
to: "/login",
|
|
3438
|
-
});
|
|
3439
|
-
}
|
|
3440
|
-
}, [session, isPending]);
|
|
3441
|
-
if (isPending) {
|
|
3442
|
-
return <div>Loading...</div>;
|
|
3443
|
-
}
|
|
3444
|
-
return (
|
|
3445
|
-
<div>
|
|
3446
|
-
<h1>Dashboard</h1>
|
|
3447
|
-
<p>Welcome {session?.user.name}</p>
|
|
3448
|
-
<p>privateData: {privateData.data?.message}</p>
|
|
3449
|
-
</div>
|
|
3450
|
-
);
|
|
3451
|
-
}
|
|
3452
|
-
`,
|
|
3453
|
-
type: "text"
|
|
3454
|
-
},
|
|
3455
|
-
"auth/web/react/tanstack-start/src/routes/login.tsx": {
|
|
3456
|
-
metadata: {
|
|
3457
|
-
updatedAt: "2025-06-17T06:06:35.000Z",
|
|
3458
|
-
updatedHash: "dd3dd58a52"
|
|
3459
|
-
},
|
|
3460
|
-
content: `import SignInForm from "@/components/sign-in-form";
|
|
3461
|
-
import SignUpForm from "@/components/sign-up-form";
|
|
3462
|
-
import { createFileRoute } from "@tanstack/react-router";
|
|
3463
|
-
import { useState } from "react";
|
|
3464
|
-
export const Route = createFileRoute("/login")({
|
|
3465
|
-
component: RouteComponent,
|
|
3466
|
-
});
|
|
3467
|
-
function RouteComponent() {
|
|
3468
|
-
const [showSignIn, setShowSignIn] = useState(false);
|
|
3469
|
-
return showSignIn ? (
|
|
3470
|
-
<SignInForm onSwitchToSignUp={() => setShowSignIn(false)} />
|
|
3471
|
-
) : (
|
|
3472
|
-
<SignUpForm onSwitchToSignIn={() => setShowSignIn(true)} />
|
|
3473
|
-
);
|
|
3474
|
-
}
|
|
3475
|
-
`,
|
|
3476
|
-
type: "text"
|
|
3477
|
-
},
|
|
3478
|
-
"auth/web/solid/src/components/sign-in-form.tsx": {
|
|
3479
|
-
metadata: {
|
|
3480
|
-
updatedAt: "2025-06-17T06:06:35.000Z",
|
|
3481
|
-
updatedHash: "d17ce7852d"
|
|
3482
|
-
},
|
|
3483
|
-
content: `import { authClient } from "@/lib/auth-client";
|
|
3484
|
-
import { createForm } from "@tanstack/solid-form";
|
|
3485
|
-
import { useNavigate } from "@tanstack/solid-router";
|
|
3486
|
-
import z from "zod/v4";
|
|
3487
|
-
import { For } from "solid-js";
|
|
3488
|
-
export default function SignInForm({
|
|
3489
|
-
onSwitchToSignUp,
|
|
3490
|
-
}: {
|
|
3491
|
-
onSwitchToSignUp: () => void;
|
|
3492
|
-
}) {
|
|
3493
|
-
const navigate = useNavigate({
|
|
3494
|
-
from: "/",
|
|
3495
|
-
});
|
|
3496
|
-
const form = createForm(() => ({
|
|
3497
|
-
defaultValues: {
|
|
3498
|
-
email: "",
|
|
3499
|
-
password: "",
|
|
3500
|
-
},
|
|
3501
|
-
onSubmit: async ({ value }) => {
|
|
3502
|
-
await authClient.signIn.email(
|
|
3503
|
-
{
|
|
3504
|
-
email: value.email,
|
|
3505
|
-
password: value.password,
|
|
3506
|
-
},
|
|
3507
|
-
{
|
|
3508
|
-
onSuccess: () => {
|
|
3509
|
-
navigate({
|
|
3510
|
-
to: "/dashboard",
|
|
3511
|
-
});
|
|
3512
|
-
console.log("Sign in successful");
|
|
3513
|
-
},
|
|
3514
|
-
onError: (error) => {
|
|
3515
|
-
console.error(error.error.message);
|
|
3516
|
-
},
|
|
3517
|
-
},
|
|
3518
|
-
);
|
|
3519
|
-
},
|
|
3520
|
-
validators: {
|
|
3521
|
-
onSubmit: z.object({
|
|
3522
|
-
email: z.email("Invalid email address"),
|
|
3523
|
-
password: z.string().min(8, "Password must be at least 8 characters"),
|
|
3524
|
-
}),
|
|
3525
|
-
},
|
|
3526
|
-
}));
|
|
3527
|
-
return (
|
|
3528
|
-
<div class="mx-auto w-full mt-10 max-w-md p-6">
|
|
3529
|
-
<h1 class="mb-6 text-center text-3xl font-bold">Welcome Back</h1>
|
|
3530
|
-
<form
|
|
3531
|
-
onSubmit={(e) => {
|
|
3532
|
-
e.preventDefault();
|
|
3533
|
-
e.stopPropagation();
|
|
3534
|
-
void form.handleSubmit();
|
|
3535
|
-
}}
|
|
3536
|
-
class="space-y-4"
|
|
3537
|
-
>
|
|
3538
|
-
<div>
|
|
3539
|
-
<form.Field name="email">
|
|
3540
|
-
{(field) => (
|
|
3541
|
-
<div class="space-y-2">
|
|
3542
|
-
<label for={field().name}>Email</label>
|
|
3543
|
-
<input
|
|
3544
|
-
id={field().name}
|
|
3545
|
-
name={field().name}
|
|
3546
|
-
type="email"
|
|
3547
|
-
value={field().state.value}
|
|
3548
|
-
onBlur={field().handleBlur}
|
|
3549
|
-
onInput={(e) => field().handleChange(e.currentTarget.value)}
|
|
3550
|
-
class="w-full rounded border p-2"
|
|
3551
|
-
/>
|
|
3552
|
-
<For each={field().state.meta.errors}>
|
|
3553
|
-
{(error) => (
|
|
3554
|
-
<p class="text-sm text-red-600">{error?.message}</p>
|
|
3555
|
-
)}
|
|
3556
|
-
</For>
|
|
3557
|
-
</div>
|
|
3558
|
-
)}
|
|
3559
|
-
</form.Field>
|
|
3560
|
-
</div>
|
|
3561
|
-
<div>
|
|
3562
|
-
<form.Field name="password">
|
|
3563
|
-
{(field) => (
|
|
3564
|
-
<div class="space-y-2">
|
|
3565
|
-
<label for={field().name}>Password</label>
|
|
3566
|
-
<input
|
|
3567
|
-
id={field().name}
|
|
3568
|
-
name={field().name}
|
|
3569
|
-
type="password"
|
|
3570
|
-
value={field().state.value}
|
|
3571
|
-
onBlur={field().handleBlur}
|
|
3572
|
-
onInput={(e) => field().handleChange(e.currentTarget.value)}
|
|
3573
|
-
class="w-full rounded border p-2"
|
|
3574
|
-
/>
|
|
3575
|
-
<For each={field().state.meta.errors}>
|
|
3576
|
-
{(error) => (
|
|
3577
|
-
<p class="text-sm text-red-600">{error?.message}</p>
|
|
3578
|
-
)}
|
|
3579
|
-
</For>
|
|
3580
|
-
</div>
|
|
3581
|
-
)}
|
|
3582
|
-
</form.Field>
|
|
3583
|
-
</div>
|
|
3584
|
-
<form.Subscribe>
|
|
3585
|
-
{(state) => (
|
|
3586
|
-
<button
|
|
3587
|
-
type="submit"
|
|
3588
|
-
class="w-full rounded bg-indigo-600 p-2 text-white hover:bg-indigo-700 disabled:opacity-50"
|
|
3589
|
-
disabled={!state().canSubmit || state().isSubmitting}
|
|
3590
|
-
>
|
|
3591
|
-
{state().isSubmitting ? "Submitting..." : "Sign In"}
|
|
3592
|
-
</button>
|
|
3593
|
-
)}
|
|
3594
|
-
</form.Subscribe>
|
|
3595
|
-
</form>
|
|
3596
|
-
<div class="mt-4 text-center">
|
|
3597
|
-
<button
|
|
3598
|
-
type="button"
|
|
3599
|
-
onClick={onSwitchToSignUp}
|
|
3600
|
-
class="text-sm text-indigo-600 hover:text-indigo-800 hover:underline"
|
|
3601
|
-
>
|
|
3602
|
-
Need an account? Sign Up
|
|
3603
|
-
</button>
|
|
3604
|
-
</div>
|
|
3605
|
-
</div>
|
|
3606
|
-
);
|
|
3607
|
-
}
|
|
3608
|
-
`,
|
|
3609
|
-
type: "text"
|
|
3610
|
-
},
|
|
3611
|
-
"auth/web/solid/src/components/sign-up-form.tsx": {
|
|
3612
|
-
metadata: {
|
|
3613
|
-
updatedAt: "2025-06-17T06:06:35.000Z",
|
|
3614
|
-
updatedHash: "4ecf34f9ef"
|
|
3615
|
-
},
|
|
3616
|
-
content: `import { authClient } from "@/lib/auth-client";
|
|
3617
|
-
import { createForm } from "@tanstack/solid-form";
|
|
3618
|
-
import { useNavigate } from "@tanstack/solid-router";
|
|
3619
|
-
import z from "zod/v4";
|
|
3620
|
-
import { For } from "solid-js";
|
|
3621
|
-
export default function SignUpForm({
|
|
3622
|
-
onSwitchToSignIn,
|
|
3623
|
-
}: {
|
|
3624
|
-
onSwitchToSignIn: () => void;
|
|
3625
|
-
}) {
|
|
3626
|
-
const navigate = useNavigate({
|
|
3627
|
-
from: "/",
|
|
3628
|
-
});
|
|
3629
|
-
const form = createForm(() => ({
|
|
3630
|
-
defaultValues: {
|
|
3631
|
-
email: "",
|
|
3632
|
-
password: "",
|
|
3633
|
-
name: "",
|
|
3634
|
-
},
|
|
3635
|
-
onSubmit: async ({ value }) => {
|
|
3636
|
-
await authClient.signUp.email(
|
|
3637
|
-
{
|
|
3638
|
-
email: value.email,
|
|
3639
|
-
password: value.password,
|
|
3640
|
-
name: value.name,
|
|
3641
|
-
},
|
|
3642
|
-
{
|
|
3643
|
-
onSuccess: () => {
|
|
3644
|
-
navigate({
|
|
3645
|
-
to: "/dashboard",
|
|
3646
|
-
});
|
|
3647
|
-
console.log("Sign up successful");
|
|
3648
|
-
},
|
|
3649
|
-
onError: (error) => {
|
|
3650
|
-
console.error(error.error.message);
|
|
3651
|
-
},
|
|
3652
|
-
},
|
|
3653
|
-
);
|
|
3654
|
-
},
|
|
3655
|
-
validators: {
|
|
3656
|
-
onSubmit: z.object({
|
|
3657
|
-
name: z.string().min(2, "Name must be at least 2 characters"),
|
|
3658
|
-
email: z.email("Invalid email address"),
|
|
3659
|
-
password: z.string().min(8, "Password must be at least 8 characters"),
|
|
3660
|
-
}),
|
|
3661
|
-
},
|
|
3662
|
-
}));
|
|
3663
|
-
return (
|
|
3664
|
-
<div class="mx-auto w-full mt-10 max-w-md p-6">
|
|
3665
|
-
<h1 class="mb-6 text-center text-3xl font-bold">Create Account</h1>
|
|
3666
|
-
<form
|
|
3667
|
-
onSubmit={(e) => {
|
|
3668
|
-
e.preventDefault();
|
|
3669
|
-
e.stopPropagation();
|
|
3670
|
-
void form.handleSubmit();
|
|
3671
|
-
}}
|
|
3672
|
-
class="space-y-4"
|
|
3673
|
-
>
|
|
3674
|
-
<div>
|
|
3675
|
-
<form.Field name="name">
|
|
3676
|
-
{(field) => (
|
|
3677
|
-
<div class="space-y-2">
|
|
3678
|
-
<label for={field().name}>Name</label>
|
|
3679
|
-
<input
|
|
3680
|
-
id={field().name}
|
|
3681
|
-
name={field().name}
|
|
3682
|
-
value={field().state.value}
|
|
3683
|
-
onBlur={field().handleBlur}
|
|
3684
|
-
onInput={(e) => field().handleChange(e.currentTarget.value)}
|
|
3685
|
-
class="w-full rounded border p-2"
|
|
3686
|
-
/>
|
|
3687
|
-
<For each={field().state.meta.errors}>
|
|
3688
|
-
{(error) => (
|
|
3689
|
-
<p class="text-sm text-red-600">{error?.message}</p>
|
|
3690
|
-
)}
|
|
3691
|
-
</For>
|
|
3692
|
-
</div>
|
|
3693
|
-
)}
|
|
3694
|
-
</form.Field>
|
|
3695
|
-
</div>
|
|
3696
|
-
<div>
|
|
3697
|
-
<form.Field name="email">
|
|
3698
|
-
{(field) => (
|
|
3699
|
-
<div class="space-y-2">
|
|
3700
|
-
<label for={field().name}>Email</label>
|
|
3701
|
-
<input
|
|
3702
|
-
id={field().name}
|
|
3703
|
-
name={field().name}
|
|
3704
|
-
type="email"
|
|
3705
|
-
value={field().state.value}
|
|
3706
|
-
onBlur={field().handleBlur}
|
|
3707
|
-
onInput={(e) => field().handleChange(e.currentTarget.value)}
|
|
3708
|
-
class="w-full rounded border p-2"
|
|
3709
|
-
/>
|
|
3710
|
-
<For each={field().state.meta.errors}>
|
|
3711
|
-
{(error) => (
|
|
3712
|
-
<p class="text-sm text-red-600">{error?.message}</p>
|
|
3713
|
-
)}
|
|
3714
|
-
</For>
|
|
3715
|
-
</div>
|
|
3716
|
-
)}
|
|
3717
|
-
</form.Field>
|
|
3718
|
-
</div>
|
|
3719
|
-
<div>
|
|
3720
|
-
<form.Field name="password">
|
|
3721
|
-
{(field) => (
|
|
3722
|
-
<div class="space-y-2">
|
|
3723
|
-
<label for={field().name}>Password</label>
|
|
3724
|
-
<input
|
|
3725
|
-
id={field().name}
|
|
3726
|
-
name={field().name}
|
|
3727
|
-
type="password"
|
|
3728
|
-
value={field().state.value}
|
|
3729
|
-
onBlur={field().handleBlur}
|
|
3730
|
-
onInput={(e) => field().handleChange(e.currentTarget.value)}
|
|
3731
|
-
class="w-full rounded border p-2"
|
|
3732
|
-
/>
|
|
3733
|
-
<For each={field().state.meta.errors}>
|
|
3734
|
-
{(error) => (
|
|
3735
|
-
<p class="text-sm text-red-600">{error?.message}</p>
|
|
3736
|
-
)}
|
|
3737
|
-
</For>
|
|
3738
|
-
</div>
|
|
3739
|
-
)}
|
|
3740
|
-
</form.Field>
|
|
3741
|
-
</div>
|
|
3742
|
-
<form.Subscribe>
|
|
3743
|
-
{(state) => (
|
|
3744
|
-
<button
|
|
3745
|
-
type="submit"
|
|
3746
|
-
class="w-full rounded bg-indigo-600 p-2 text-white hover:bg-indigo-700 disabled:opacity-50"
|
|
3747
|
-
disabled={!state().canSubmit || state().isSubmitting}
|
|
3748
|
-
>
|
|
3749
|
-
{state().isSubmitting ? "Submitting..." : "Sign Up"}
|
|
3750
|
-
</button>
|
|
3751
|
-
)}
|
|
3752
|
-
</form.Subscribe>
|
|
3753
|
-
</form>
|
|
3754
|
-
<div class="mt-4 text-center">
|
|
3755
|
-
<button
|
|
3756
|
-
type="button"
|
|
3757
|
-
onClick={onSwitchToSignIn}
|
|
3758
|
-
class="text-sm text-indigo-600 hover:text-indigo-800 hover:underline"
|
|
3759
|
-
>
|
|
3760
|
-
Already have an account? Sign In
|
|
3761
|
-
</button>
|
|
3762
|
-
</div>
|
|
3763
|
-
</div>
|
|
3764
|
-
);
|
|
3765
|
-
}
|
|
3766
|
-
`,
|
|
3767
|
-
type: "text"
|
|
3768
|
-
},
|
|
3769
|
-
"auth/web/solid/src/components/user-menu.tsx": {
|
|
3770
|
-
metadata: {
|
|
3771
|
-
updatedAt: "2025-06-17T06:06:35.000Z",
|
|
3772
|
-
updatedHash: "d2f89990d1"
|
|
3773
|
-
},
|
|
3774
|
-
content: `import { authClient } from "@/lib/auth-client";
|
|
3775
|
-
import { useNavigate, Link } from "@tanstack/solid-router";
|
|
3776
|
-
import { createSignal, Show } from "solid-js";
|
|
3777
|
-
export default function UserMenu() {
|
|
3778
|
-
const navigate = useNavigate();
|
|
3779
|
-
const session = authClient.useSession();
|
|
3780
|
-
const [isMenuOpen, setIsMenuOpen] = createSignal(false);
|
|
3781
|
-
return (
|
|
3782
|
-
<div class="relative inline-block text-left">
|
|
3783
|
-
<Show when={session().isPending}>
|
|
3784
|
-
<div class="h-9 w-24 animate-pulse rounded" />
|
|
3785
|
-
</Show>
|
|
3786
|
-
<Show when={!session().isPending && !session().data}>
|
|
3787
|
-
<Link to="/login" class="inline-block border rounded px-4 text-sm">
|
|
3788
|
-
Sign In
|
|
3789
|
-
</Link>
|
|
3790
|
-
</Show>
|
|
3791
|
-
<Show when={!session().isPending && session().data}>
|
|
3792
|
-
<button
|
|
3793
|
-
type="button"
|
|
3794
|
-
class="inline-block border rounded px-4 text-sm"
|
|
3795
|
-
onClick={() => setIsMenuOpen(!isMenuOpen())}
|
|
3796
|
-
>
|
|
3797
|
-
{session().data?.user.name}
|
|
3798
|
-
</button>
|
|
3799
|
-
<Show when={isMenuOpen()}>
|
|
3800
|
-
<div class="absolute right-0 mt-2 w-56 rounded p-1 shadow-sm">
|
|
3801
|
-
<div class="px-4 text-sm">{session().data?.user.email}</div>
|
|
3802
|
-
<button
|
|
3803
|
-
class="mt-1 w-full border rounded px-4 text-center text-sm"
|
|
3804
|
-
onClick={() => {
|
|
3805
|
-
setIsMenuOpen(false);
|
|
3806
|
-
authClient.signOut({
|
|
3807
|
-
fetchOptions: {
|
|
3808
|
-
onSuccess: () => {
|
|
3809
|
-
navigate({ to: "/" });
|
|
3810
|
-
},
|
|
3811
|
-
},
|
|
3812
|
-
});
|
|
3813
|
-
}}
|
|
3814
|
-
>
|
|
3815
|
-
Sign Out
|
|
3816
|
-
</button>
|
|
3817
|
-
</div>
|
|
3818
|
-
</Show>
|
|
3819
|
-
</Show>
|
|
3820
|
-
</div>
|
|
3821
|
-
);
|
|
3822
|
-
}
|
|
3823
|
-
`,
|
|
3824
|
-
type: "text"
|
|
3825
|
-
},
|
|
3826
|
-
"auth/web/solid/src/lib/auth-client.ts": {
|
|
3827
|
-
metadata: {
|
|
3828
|
-
updatedAt: "2025-06-17T06:06:35.000Z",
|
|
3829
|
-
updatedHash: "5e30f07c48"
|
|
3830
|
-
},
|
|
3831
|
-
content: `import { createAuthClient } from "better-auth/solid";
|
|
3832
|
-
export const authClient = createAuthClient({
|
|
3833
|
-
baseURL: import.meta.env.VITE_SERVER_URL,
|
|
3834
|
-
});
|
|
3835
|
-
`,
|
|
3836
|
-
type: "text"
|
|
3837
|
-
},
|
|
3838
|
-
"auth/web/solid/src/routes/dashboard.tsx": {
|
|
3839
|
-
metadata: {
|
|
3840
|
-
updatedAt: "2025-06-17T06:06:35.000Z",
|
|
3841
|
-
updatedHash: "1c1c83f823"
|
|
3842
|
-
},
|
|
3843
|
-
content: `import { authClient } from "@/lib/auth-client";
|
|
3844
|
-
import { orpc } from "@/utils/orpc";
|
|
3845
|
-
import { useQuery } from "@tanstack/solid-query";
|
|
3846
|
-
import { createFileRoute } from "@tanstack/solid-router";
|
|
3847
|
-
import { createEffect, Show } from "solid-js";
|
|
3848
|
-
export const Route = createFileRoute("/dashboard")({
|
|
3849
|
-
component: RouteComponent,
|
|
3850
|
-
});
|
|
3851
|
-
function RouteComponent() {
|
|
3852
|
-
const session = authClient.useSession();
|
|
3853
|
-
const navigate = Route.useNavigate();
|
|
3854
|
-
const privateData = useQuery(() => orpc.privateData.queryOptions());
|
|
3855
|
-
createEffect(() => {
|
|
3856
|
-
if (!session().data && !session().isPending) {
|
|
3857
|
-
navigate({
|
|
3858
|
-
to: "/login",
|
|
3859
|
-
});
|
|
3860
|
-
}
|
|
3861
|
-
});
|
|
3862
|
-
return (
|
|
3863
|
-
<div>
|
|
3864
|
-
<Show when={session().isPending}>
|
|
3865
|
-
<div>Loading...</div>
|
|
3866
|
-
</Show>
|
|
3867
|
-
<Show when={!session().isPending && session().data}>
|
|
3868
|
-
<h1>Dashboard</h1>
|
|
3869
|
-
<p>Welcome {session().data?.user.name}</p>
|
|
3870
|
-
<p>privateData: {privateData.data?.message}</p>
|
|
3871
|
-
</Show>
|
|
3872
|
-
</div>
|
|
3873
|
-
);
|
|
3874
|
-
}
|
|
3875
|
-
`,
|
|
3876
|
-
type: "text"
|
|
3877
|
-
},
|
|
3878
|
-
"auth/web/solid/src/routes/login.tsx": {
|
|
3879
|
-
metadata: {
|
|
3880
|
-
updatedAt: "2025-06-17T06:06:35.000Z",
|
|
3881
|
-
updatedHash: "519b617d37"
|
|
3882
|
-
},
|
|
3883
|
-
content: `import SignInForm from "@/components/sign-in-form";
|
|
3884
|
-
import SignUpForm from "@/components/sign-up-form";
|
|
3885
|
-
import { createFileRoute } from "@tanstack/solid-router";
|
|
3886
|
-
import { createSignal, Match, Switch } from "solid-js";
|
|
3887
|
-
export const Route = createFileRoute("/login")({
|
|
3888
|
-
component: RouteComponent,
|
|
3889
|
-
});
|
|
3890
|
-
function RouteComponent() {
|
|
3891
|
-
const [showSignIn, setShowSignIn] = createSignal(false);
|
|
3892
|
-
return (
|
|
3893
|
-
<Switch>
|
|
3894
|
-
<Match when={showSignIn()}>
|
|
3895
|
-
<SignInForm onSwitchToSignUp={() => setShowSignIn(false)} />
|
|
3896
|
-
</Match>
|
|
3897
|
-
<Match when={!showSignIn()}>
|
|
3898
|
-
<SignUpForm onSwitchToSignIn={() => setShowSignIn(true)} />
|
|
3899
|
-
</Match>
|
|
3900
|
-
</Switch>
|
|
3901
|
-
);
|
|
3902
|
-
}
|
|
3903
|
-
`,
|
|
3904
|
-
type: "text"
|
|
3905
|
-
},
|
|
3906
|
-
"auth/web/svelte/src/components/SignInForm.svelte": {
|
|
3907
|
-
metadata: {
|
|
3908
|
-
updatedAt: "2025-06-17T06:06:35.000Z",
|
|
3909
|
-
updatedHash: "fd1702a9d0"
|
|
3910
|
-
},
|
|
3911
|
-
content: `<script lang="ts">
|
|
3912
|
-
import { createForm } from '@tanstack/svelte-form';
|
|
3913
|
-
import z from 'zod/v4';
|
|
3914
|
-
import { authClient } from '$lib/auth-client';
|
|
3915
|
-
import { goto } from '$app/navigation';
|
|
3916
|
-
let { switchToSignUp } = $props<{ switchToSignUp: () => void }>();
|
|
3917
|
-
const validationSchema = z.object({
|
|
3918
|
-
email: z.email('Invalid email address'),
|
|
3919
|
-
password: z.string().min(1, 'Password is required'),
|
|
3920
|
-
});
|
|
3921
|
-
const form = createForm(() => ({
|
|
3922
|
-
defaultValues: { email: '', password: '' },
|
|
3923
|
-
onSubmit: async ({ value }) => {
|
|
3924
|
-
await authClient.signIn.email(
|
|
3925
|
-
{ email: value.email, password: value.password },
|
|
3926
|
-
{
|
|
3927
|
-
onSuccess: () => goto('/dashboard'),
|
|
3928
|
-
onError: (error) => {
|
|
3929
|
-
console.log(error.error.message || 'Sign in failed. Please try again.');
|
|
3930
|
-
},
|
|
3931
|
-
}
|
|
3932
|
-
);
|
|
3933
|
-
},
|
|
3934
|
-
validators: {
|
|
3935
|
-
onSubmit: validationSchema,
|
|
3936
|
-
},
|
|
3937
|
-
}));
|
|
3938
|
-
<\/script>
|
|
3939
|
-
<div class="mx-auto mt-10 w-full max-w-md p-6">
|
|
3940
|
-
<h1 class="mb-6 text-center font-bold text-3xl">Welcome Back</h1>
|
|
3941
|
-
<form
|
|
3942
|
-
class="space-y-4"
|
|
3943
|
-
onsubmit={(e) => {
|
|
3944
|
-
e.preventDefault();
|
|
3945
|
-
e.stopPropagation();
|
|
3946
|
-
form.handleSubmit();
|
|
3947
|
-
}}
|
|
3948
|
-
>
|
|
3949
|
-
<form.Field name="email">
|
|
3950
|
-
{#snippet children(field)}
|
|
3951
|
-
<div class="space-y-1">
|
|
3952
|
-
<label for={field.name}>Email</label>
|
|
3953
|
-
<input
|
|
3954
|
-
id={field.name}
|
|
3955
|
-
name={field.name}
|
|
3956
|
-
type="email"
|
|
3957
|
-
class="w-full border"
|
|
3958
|
-
onblur={field.handleBlur}
|
|
3959
|
-
value={field.state.value}
|
|
3960
|
-
oninput={(e: Event) => {
|
|
3961
|
-
const target = e.target as HTMLInputElement
|
|
3962
|
-
field.handleChange(target.value)
|
|
3963
|
-
}} />
|
|
3964
|
-
{#if field.state.meta.isTouched}
|
|
3965
|
-
{#each field.state.meta.errors as error}
|
|
3966
|
-
<p class="text-sm text-red-500" role="alert">{error}</p>
|
|
3967
|
-
{/each}
|
|
3968
|
-
{/if}
|
|
3969
|
-
</div>
|
|
3970
|
-
{/snippet}
|
|
3971
|
-
</form.Field>
|
|
3972
|
-
<form.Field name="password">
|
|
3973
|
-
{#snippet children(field)}
|
|
3974
|
-
<div class="space-y-1">
|
|
3975
|
-
<label for={field.name}>Password</label>
|
|
3976
|
-
<input
|
|
3977
|
-
id={field.name}
|
|
3978
|
-
name={field.name}
|
|
3979
|
-
type="password"
|
|
3980
|
-
class="w-full border"
|
|
3981
|
-
onblur={field.handleBlur}
|
|
3982
|
-
value={field.state.value}
|
|
3983
|
-
oninput={(e: Event) => {
|
|
3984
|
-
const target = e.target as HTMLInputElement
|
|
3985
|
-
field.handleChange(target.value)
|
|
3986
|
-
}}
|
|
3987
|
-
/>
|
|
3988
|
-
{#if field.state.meta.isTouched}
|
|
3989
|
-
{#each field.state.meta.errors as error}
|
|
3990
|
-
<p class="text-sm text-red-500" role="alert">{error}</p>
|
|
3991
|
-
{/each}
|
|
3992
|
-
{/if}
|
|
3993
|
-
</div>
|
|
3994
|
-
{/snippet}
|
|
3995
|
-
</form.Field>
|
|
3996
|
-
<form.Subscribe selector={(state) => ({ canSubmit: state.canSubmit, isSubmitting: state.isSubmitting })}>
|
|
3997
|
-
{#snippet children(state)}
|
|
3998
|
-
<button type="submit" class="w-full" disabled={!state.canSubmit || state.isSubmitting}>
|
|
3999
|
-
{state.isSubmitting ? 'Submitting...' : 'Sign In'}
|
|
4000
|
-
</button>
|
|
4001
|
-
{/snippet}
|
|
4002
|
-
</form.Subscribe>
|
|
4003
|
-
</form>
|
|
4004
|
-
<div class="mt-4 text-center">
|
|
4005
|
-
<button type="button" class="text-indigo-600 hover:text-indigo-800" onclick={switchToSignUp}>
|
|
4006
|
-
Need an account? Sign Up
|
|
4007
|
-
</button>
|
|
4008
|
-
</div>
|
|
4009
|
-
</div>
|
|
4010
|
-
`,
|
|
4011
|
-
type: "text"
|
|
4012
|
-
},
|
|
4013
|
-
"auth/web/svelte/src/components/SignUpForm.svelte": {
|
|
4014
|
-
metadata: {
|
|
4015
|
-
updatedAt: "2025-06-17T06:06:35.000Z",
|
|
4016
|
-
updatedHash: "e8283c1b3b"
|
|
4017
|
-
},
|
|
4018
|
-
content: `<script lang="ts">
|
|
4019
|
-
import { createForm } from '@tanstack/svelte-form';
|
|
4020
|
-
import z from 'zod/v4';
|
|
4021
|
-
import { authClient } from '$lib/auth-client';
|
|
4022
|
-
import { goto } from '$app/navigation';
|
|
4023
|
-
let { switchToSignIn } = $props<{ switchToSignIn: () => void }>();
|
|
4024
|
-
const validationSchema = z.object({
|
|
4025
|
-
name: z.string().min(2, 'Name must be at least 2 characters'),
|
|
4026
|
-
email: z.email('Invalid email address'),
|
|
4027
|
-
password: z.string().min(8, 'Password must be at least 8 characters'),
|
|
4028
|
-
});
|
|
4029
|
-
const form = createForm(() => ({
|
|
4030
|
-
defaultValues: { name: '', email: '', password: '' },
|
|
4031
|
-
onSubmit: async ({ value }) => {
|
|
4032
|
-
await authClient.signUp.email(
|
|
4033
|
-
{
|
|
4034
|
-
email: value.email,
|
|
4035
|
-
password: value.password,
|
|
4036
|
-
name: value.name,
|
|
4037
|
-
},
|
|
4038
|
-
{
|
|
4039
|
-
onSuccess: () => {
|
|
4040
|
-
goto('/dashboard');
|
|
4041
|
-
},
|
|
4042
|
-
onError: (error) => {
|
|
4043
|
-
console.log(error.error.message || 'Sign up failed. Please try again.');
|
|
4044
|
-
},
|
|
4045
|
-
}
|
|
4046
|
-
);
|
|
4047
|
-
},
|
|
4048
|
-
validators: {
|
|
4049
|
-
onSubmit: validationSchema,
|
|
4050
|
-
},
|
|
4051
|
-
}));
|
|
4052
|
-
<\/script>
|
|
4053
|
-
<div class="mx-auto mt-10 w-full max-w-md p-6">
|
|
4054
|
-
<h1 class="mb-6 text-center font-bold text-3xl">Create Account</h1>
|
|
4055
|
-
<form
|
|
4056
|
-
id="form"
|
|
4057
|
-
class="space-y-4"
|
|
4058
|
-
onsubmit={(e) => {
|
|
4059
|
-
e.preventDefault();
|
|
4060
|
-
e.stopPropagation();
|
|
4061
|
-
form.handleSubmit();
|
|
4062
|
-
}}
|
|
4063
|
-
>
|
|
4064
|
-
<form.Field name="name">
|
|
4065
|
-
{#snippet children(field)}
|
|
4066
|
-
<div class="space-y-1">
|
|
4067
|
-
<label for={field.name}>Name</label>
|
|
4068
|
-
<input
|
|
4069
|
-
id={field.name}
|
|
4070
|
-
name={field.name}
|
|
4071
|
-
class="w-full border"
|
|
4072
|
-
onblur={field.handleBlur}
|
|
4073
|
-
value={field.state.value}
|
|
4074
|
-
oninput={(e: Event) => {
|
|
4075
|
-
const target = e.target as HTMLInputElement
|
|
4076
|
-
field.handleChange(target.value)
|
|
4077
|
-
}}
|
|
4078
|
-
/>
|
|
4079
|
-
{#if field.state.meta.isTouched}
|
|
4080
|
-
{#each field.state.meta.errors as error}
|
|
4081
|
-
<p class="text-sm text-red-500" role="alert">{error}</p>
|
|
4082
|
-
{/each}
|
|
4083
|
-
{/if}
|
|
4084
|
-
</div>
|
|
4085
|
-
{/snippet}
|
|
4086
|
-
</form.Field>
|
|
4087
|
-
<form.Field name="email">
|
|
4088
|
-
{#snippet children(field)}
|
|
4089
|
-
<div class="space-y-1">
|
|
4090
|
-
<label for={field.name}>Email</label>
|
|
4091
|
-
<input
|
|
4092
|
-
id={field.name}
|
|
4093
|
-
name={field.name}
|
|
4094
|
-
type="email"
|
|
4095
|
-
class="w-full border"
|
|
4096
|
-
onblur={field.handleBlur}
|
|
4097
|
-
value={field.state.value}
|
|
4098
|
-
oninput={(e: Event) => {
|
|
4099
|
-
const target = e.target as HTMLInputElement
|
|
4100
|
-
field.handleChange(target.value)
|
|
4101
|
-
}}
|
|
4102
|
-
/>
|
|
4103
|
-
{#if field.state.meta.isTouched}
|
|
4104
|
-
{#each field.state.meta.errors as error}
|
|
4105
|
-
<p class="text-sm text-red-500" role="alert">{error}</p>
|
|
4106
|
-
{/each}
|
|
4107
|
-
{/if}
|
|
4108
|
-
</div>
|
|
4109
|
-
{/snippet}
|
|
4110
|
-
</form.Field>
|
|
4111
|
-
<form.Field name="password">
|
|
4112
|
-
{#snippet children(field)}
|
|
4113
|
-
<div class="space-y-1">
|
|
4114
|
-
<label for={field.name}>Password</label>
|
|
4115
|
-
<input
|
|
4116
|
-
id={field.name}
|
|
4117
|
-
name={field.name}
|
|
4118
|
-
type="password"
|
|
4119
|
-
class="w-full border"
|
|
4120
|
-
onblur={field.handleBlur}
|
|
4121
|
-
value={field.state.value}
|
|
4122
|
-
oninput={(e: Event) => {
|
|
4123
|
-
const target = e.target as HTMLInputElement
|
|
4124
|
-
field.handleChange(target.value)
|
|
4125
|
-
}}
|
|
4126
|
-
/>
|
|
4127
|
-
{#if field.state.meta.errors}
|
|
4128
|
-
{#each field.state.meta.errors as error}
|
|
4129
|
-
<p class="text-sm text-red-500" role="alert">{error}</p>
|
|
4130
|
-
{/each}
|
|
4131
|
-
{/if}
|
|
4132
|
-
</div>
|
|
4133
|
-
{/snippet}
|
|
4134
|
-
</form.Field>
|
|
4135
|
-
<form.Subscribe selector={(state) => ({ canSubmit: state.canSubmit, isSubmitting: state.isSubmitting })}>
|
|
4136
|
-
{#snippet children(state)}
|
|
4137
|
-
<button type="submit" class="w-full" disabled={!state.canSubmit || state.isSubmitting}>
|
|
4138
|
-
{state.isSubmitting ? 'Submitting...' : 'Sign Up'}
|
|
4139
|
-
</button>
|
|
4140
|
-
{/snippet}
|
|
4141
|
-
</form.Subscribe>
|
|
4142
|
-
</form>
|
|
4143
|
-
<div class="mt-4 text-center">
|
|
4144
|
-
<button type="button" class="text-indigo-600 hover:text-indigo-800" onclick={switchToSignIn}>
|
|
4145
|
-
Already have an account? Sign In
|
|
4146
|
-
</button>
|
|
4147
|
-
</div>
|
|
4148
|
-
</div>
|
|
4149
|
-
`,
|
|
4150
|
-
type: "text"
|
|
4151
|
-
},
|
|
4152
|
-
"auth/web/svelte/src/components/UserMenu.svelte": {
|
|
4153
|
-
metadata: {
|
|
4154
|
-
updatedAt: "2025-06-17T06:06:35.000Z",
|
|
4155
|
-
updatedHash: "32a1d6548d"
|
|
4156
|
-
},
|
|
4157
|
-
content: `<script lang="ts">
|
|
4158
|
-
import { authClient } from '$lib/auth-client';
|
|
4159
|
-
import { goto } from '$app/navigation';
|
|
4160
|
-
import { queryClient } from '$lib/orpc';
|
|
4161
|
-
const sessionQuery = authClient.useSession();
|
|
4162
|
-
async function handleSignOut() {
|
|
4163
|
-
await authClient.signOut({
|
|
4164
|
-
fetchOptions: {
|
|
4165
|
-
onSuccess: () => {
|
|
4166
|
-
queryClient.invalidateQueries();
|
|
4167
|
-
goto('/');
|
|
4168
|
-
},
|
|
4169
|
-
onError: (error) => {
|
|
4170
|
-
console.error('Sign out failed:', error);
|
|
4171
|
-
}
|
|
4172
|
-
}
|
|
4173
|
-
});
|
|
4174
|
-
}
|
|
4175
|
-
function goToLogin() {
|
|
4176
|
-
goto('/login');
|
|
4177
|
-
}
|
|
4178
|
-
<\/script>
|
|
4179
|
-
<div class="relative">
|
|
4180
|
-
{#if $sessionQuery.isPending}
|
|
4181
|
-
<div class="h-8 w-24 animate-pulse rounded bg-neutral-700"></div>
|
|
4182
|
-
{:else if $sessionQuery.data?.user}
|
|
4183
|
-
{@const user = $sessionQuery.data.user}
|
|
4184
|
-
<div class="flex items-center gap-3">
|
|
4185
|
-
<span class="text-sm text-neutral-300 hidden sm:inline" title={user.email}>
|
|
4186
|
-
{user.name || user.email?.split('@')[0] || 'User'}
|
|
4187
|
-
</span>
|
|
4188
|
-
<button
|
|
4189
|
-
onclick={handleSignOut}
|
|
4190
|
-
class="rounded px-3 py-1 text-sm bg-red-600 hover:bg-red-700 text-white transition-colors"
|
|
4191
|
-
>
|
|
4192
|
-
Sign Out
|
|
4193
|
-
</button>
|
|
4194
|
-
</div>
|
|
4195
|
-
{:else}
|
|
4196
|
-
<div class="flex items-center gap-2">
|
|
4197
|
-
<button
|
|
4198
|
-
onclick={goToLogin}
|
|
4199
|
-
class="rounded px-3 py-1 text-sm bg-indigo-600 hover:bg-indigo-700 text-white transition-colors"
|
|
4200
|
-
>
|
|
4201
|
-
Sign In
|
|
4202
|
-
</button>
|
|
4203
|
-
</div>
|
|
4204
|
-
{/if}
|
|
4205
|
-
</div>
|
|
4206
|
-
`,
|
|
4207
|
-
type: "text"
|
|
4208
|
-
},
|
|
4209
|
-
"auth/web/svelte/src/lib/auth-client.ts": {
|
|
4210
|
-
metadata: {
|
|
4211
|
-
updatedAt: "2025-06-17T06:06:35.000Z",
|
|
4212
|
-
updatedHash: "53a67137c9"
|
|
4213
|
-
},
|
|
4214
|
-
content: `import { PUBLIC_SERVER_URL } from "$env/static/public";
|
|
4215
|
-
import { createAuthClient } from "better-auth/svelte";
|
|
4216
|
-
export const authClient = createAuthClient({
|
|
4217
|
-
baseURL: PUBLIC_SERVER_URL,
|
|
4218
|
-
});
|
|
4219
|
-
`,
|
|
4220
|
-
type: "text"
|
|
4221
|
-
},
|
|
4222
|
-
"auth/web/svelte/src/routes/dashboard/+page.svelte": {
|
|
4223
|
-
metadata: {
|
|
4224
|
-
updatedAt: "2025-06-17T06:06:35.000Z",
|
|
4225
|
-
updatedHash: "6b3d81f7af"
|
|
4226
|
-
},
|
|
4227
|
-
content: `<script lang="ts">
|
|
4228
|
-
import { onMount } from 'svelte';
|
|
4229
|
-
import { goto } from '$app/navigation';
|
|
4230
|
-
import { authClient } from '$lib/auth-client';
|
|
4231
|
-
import { orpc } from '$lib/orpc';
|
|
4232
|
-
import { createQuery } from '@tanstack/svelte-query';
|
|
4233
|
-
import { get } from 'svelte/store';
|
|
4234
|
-
const sessionQuery = authClient.useSession();
|
|
4235
|
-
const privateDataQuery = createQuery(orpc.privateData.queryOptions());
|
|
4236
|
-
onMount(() => {
|
|
4237
|
-
const { data: session, isPending } = get(sessionQuery);
|
|
4238
|
-
if (!session && !isPending) {
|
|
4239
|
-
goto('/login');
|
|
4240
|
-
}
|
|
4241
|
-
});
|
|
4242
|
-
<\/script>
|
|
4243
|
-
{#if $sessionQuery.isPending}
|
|
4244
|
-
<div>Loading...</div>
|
|
4245
|
-
{:else if !$sessionQuery.data}
|
|
4246
|
-
<!-- Redirecting... -->
|
|
4247
|
-
{:else}
|
|
4248
|
-
<div>
|
|
4249
|
-
<h1>Dashboard</h1>
|
|
4250
|
-
<p>Welcome {$sessionQuery.data.user.name}</p>
|
|
4251
|
-
<p>privateData: {$privateDataQuery.data?.message}</p>
|
|
4252
|
-
</div>
|
|
4253
|
-
{/if}
|
|
4254
|
-
`,
|
|
4255
|
-
type: "text"
|
|
4256
|
-
},
|
|
4257
|
-
"auth/web/svelte/src/routes/login/+page.svelte": {
|
|
4258
|
-
metadata: {
|
|
4259
|
-
updatedAt: "2025-06-17T06:06:35.000Z",
|
|
4260
|
-
updatedHash: "30212236e8"
|
|
4261
|
-
},
|
|
4262
|
-
content: `<script lang="ts">
|
|
4263
|
-
import SignInForm from '../../components/SignInForm.svelte';
|
|
4264
|
-
import SignUpForm from '../../components/SignUpForm.svelte';
|
|
4265
|
-
let showSignIn = $state(true);
|
|
4266
|
-
<\/script>
|
|
4267
|
-
{#if showSignIn}
|
|
4268
|
-
<SignInForm switchToSignUp={() => showSignIn = false} />
|
|
4269
|
-
{:else}
|
|
4270
|
-
<SignUpForm switchToSignIn={() => showSignIn = true} />
|
|
4271
|
-
{/if}
|
|
4272
|
-
`,
|
|
4273
|
-
type: "text"
|
|
4274
|
-
}
|
|
4275
|
-
}
|
|
4276
|
-
}
|
|
4277
|
-
};
|