Repository navigation
feat: add fullstack nuxt - #819
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Caution Review failedThe pull request is closed. WalkthroughEnables Nuxt as a supported fullstack frontend for backend="self", updates CLI prompts/validation and tests, and adds Nuxt-specific templates and generator changes (ORPC, auth, examples, env, package handling, deps, and UI stack utilities) to produce fullstack Nuxt projects. Changes
Possibly related PRs
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 📜 Recent review detailsConfiguration used: Organization UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (3)
✏️ Tip: You can disable this entire section by setting Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (5)
packages/template-generator/templates/examples/ai/fullstack/nuxt/server/api/ai.post.ts.hbs (1)
5-19: Consider adding error handling for the streaming operation.The AI SDK operations (
convertToModelMessages,streamText) can throw errors (e.g., invalid API key, network failures, malformed messages). Without error handling, failures will propagate as unhandled exceptions.💡 Suggested improvement
export default defineEventHandler(async (event) => { - const body = await readBody(event); - const uiMessages = body.messages || []; + try { + const body = await readBody(event); + const uiMessages = body.messages || []; - const model = wrapLanguageModel({ - model: google("gemini-2.5-flash"), - middleware: devToolsMiddleware(), - }); + const model = wrapLanguageModel({ + model: google("gemini-2.5-flash"), + middleware: devToolsMiddleware(), + }); - const result = streamText({ - model, - messages: await convertToModelMessages(uiMessages), - }); + const result = streamText({ + model, + messages: await convertToModelMessages(uiMessages), + }); - return result.toUIMessageStreamResponse(); + return result.toUIMessageStreamResponse(); + } catch (error) { + throw createError({ + statusCode: 500, + statusMessage: "AI request failed", + }); + } });apps/cli/src/prompts/backend.ts (1)
7-13: Consider consolidating theFULLSTACK_FRONTENDSconstant.This constant is duplicated in
apps/cli/src/utils/compatibility-rules.ts(lines 47-53). While both definitions are currently in sync, duplicating this list increases the risk of future divergence.♻️ Suggested approach
Export
FULLSTACK_FRONTENDSfromcompatibility-rules.tsand import it here:-// Frontends that support backend="self" (fullstack mode with built-in server routes) -const FULLSTACK_FRONTENDS: readonly Frontend[] = [ - "next", - "tanstack-start", - "nuxt", - // "svelte", // TODO: Add support in future update -] as const; +import { FULLSTACK_FRONTENDS } from "../utils/compatibility-rules";packages/template-generator/src/processors/api-deps.ts (1)
109-134: Consider removing unusedfrontendTypeparameter.The
frontendTypeparameter is no longer used withinaddSelfBackendWebDepsafter the guard condition was simplified. This is dead code that can be cleaned up.♻️ Suggested refactor
function addSelfBackendWebDeps( vfs: VirtualFileSystem, api: API, backend: Backend, - frontendType: FrontendType, ): void { if (backend !== "self") return; const webPath = "apps/web/package.json"; if (!vfs.exists(webPath)) return;And update the call site at line 42:
- addSelfBackendWebDeps(vfs, api, backend, frontendType); + addSelfBackendWebDeps(vfs, api, backend);packages/template-generator/templates/api/orpc/fullstack/nuxt/app/plugins/orpc.server.ts.hbs (1)
3-4: Escape{{in Handlebars templates.Per coding guidelines, the
{{in Handlebars templates should be escaped like\{{. This applies to the@{{projectName}}placeholders.Suggested fix
-import { appRouter } from "@{{projectName}}/api/routers/index"; -import { createContext } from "@{{projectName}}/api/context"; +import { appRouter } from "@\{{projectName}}/api/routers/index"; +import { createContext } from "@\{{projectName}}/api/context";Please verify whether the current template syntax works correctly with your Handlebars processor, as the escaping requirement may depend on your specific configuration.
packages/template-generator/templates/api/orpc/fullstack/nuxt/server/routes/rpc/[...].ts.hbs (1)
7-8: Escape{{in Handlebars templates.Same as the other template file - per coding guidelines, the
{{should be escaped.Suggested fix
-import { appRouter } from "@{{projectName}}/api/routers/index"; -import { createContext } from "@{{projectName}}/api/context"; +import { appRouter } from "@\{{projectName}}/api/routers/index"; +import { createContext } from "@\{{projectName}}/api/context";Please verify whether the current template syntax works correctly with your Handlebars processor.
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (20)
apps/cli/src/prompts/backend.tsapps/cli/src/utils/compatibility-rules.tsapps/cli/test/backend-runtime.test.tsapps/cli/test/frontend.test.tspackages/template-generator/src/processors/api-deps.tspackages/template-generator/src/processors/env-vars.tspackages/template-generator/src/template-handlers/api.tspackages/template-generator/src/template-handlers/auth.tspackages/template-generator/src/template-handlers/examples.tspackages/template-generator/src/template-handlers/packages.tspackages/template-generator/src/templates.generated.tspackages/template-generator/templates/api/orpc/fullstack/nuxt/app/plugins/orpc.client.ts.hbspackages/template-generator/templates/api/orpc/fullstack/nuxt/app/plugins/orpc.server.ts.hbspackages/template-generator/templates/api/orpc/fullstack/nuxt/server/routes/rpc/[...].ts.hbspackages/template-generator/templates/api/orpc/fullstack/nuxt/server/routes/rpc/index.ts.hbspackages/template-generator/templates/api/orpc/server/src/context.ts.hbspackages/template-generator/templates/auth/better-auth/fullstack/nuxt/server/api/auth/[...all].ts.hbspackages/template-generator/templates/examples/ai/fullstack/nuxt/server/api/ai.post.ts.hbspackages/template-generator/templates/frontend/nuxt/package.json.hbspackages/template-generator/templates/packages/env/src/web.ts.hbs
🧰 Additional context used
📓 Path-based instructions (7)
**/*.{js,jsx,ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/better-t-stack-repo.mdc)
Define functions using the standard function declaration syntax, not arrow functions
Files:
packages/template-generator/src/template-handlers/auth.tsapps/cli/test/frontend.test.tsapps/cli/src/utils/compatibility-rules.tspackages/template-generator/src/processors/api-deps.tsapps/cli/src/prompts/backend.tspackages/template-generator/src/template-handlers/api.tspackages/template-generator/src/template-handlers/examples.tsapps/cli/test/backend-runtime.test.tspackages/template-generator/src/template-handlers/packages.tspackages/template-generator/src/processors/env-vars.ts
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/better-t-stack-repo.mdc)
**/*.{ts,tsx}: Use TypeScript type aliases instead of interface declarations
Do not use explicit return types
Files:
packages/template-generator/src/template-handlers/auth.tsapps/cli/test/frontend.test.tsapps/cli/src/utils/compatibility-rules.tspackages/template-generator/src/processors/api-deps.tsapps/cli/src/prompts/backend.tspackages/template-generator/src/template-handlers/api.tspackages/template-generator/src/template-handlers/examples.tsapps/cli/test/backend-runtime.test.tspackages/template-generator/src/template-handlers/packages.tspackages/template-generator/src/processors/env-vars.ts
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc)
**/*.{ts,tsx,js,jsx}: Usebun <file>instead ofnode <file>orts-node <file>for running TypeScript/JavaScript files
Bun automatically loads .env files, so don't use the dotenv package
UseBun.serve()which supports WebSockets, HTTPS, and routes instead ofexpress
Usebun:sqlitemodule for SQLite instead ofbetter-sqlite3
UseBun.redisfor Redis instead ofioredis
UseBun.sqlfor Postgres instead ofpgorpostgres.js
Use built-inWebSocketinstead of thewspackage
PreferBun.fileovernode:fsreadFile/writeFile methods
UseBun.$template literal syntax instead ofexecafor shell command execution
Import .css files directly in TypeScript/JavaScript files; Bun's CSS bundler will handle bundling
Run server withbun --hot <file>to enable hot reloading during development
Files:
packages/template-generator/src/template-handlers/auth.tsapps/cli/test/frontend.test.tsapps/cli/src/utils/compatibility-rules.tspackages/template-generator/src/processors/api-deps.tsapps/cli/src/prompts/backend.tspackages/template-generator/src/template-handlers/api.tspackages/template-generator/src/template-handlers/examples.tsapps/cli/test/backend-runtime.test.tspackages/template-generator/src/template-handlers/packages.tspackages/template-generator/src/processors/env-vars.ts
**/*.{ts,tsx,js,jsx,css}
📄 CodeRabbit inference engine (.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc)
Use
bun build <file>instead ofwebpackoresbuildfor bundling TypeScript, JavaScript, and CSS files
Files:
packages/template-generator/src/template-handlers/auth.tsapps/cli/test/frontend.test.tsapps/cli/src/utils/compatibility-rules.tspackages/template-generator/src/processors/api-deps.tsapps/cli/src/prompts/backend.tspackages/template-generator/src/template-handlers/api.tspackages/template-generator/src/template-handlers/examples.tsapps/cli/test/backend-runtime.test.tspackages/template-generator/src/template-handlers/packages.tspackages/template-generator/src/processors/env-vars.ts
**/*.{html,tsx,ts,jsx,js}
📄 CodeRabbit inference engine (.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc)
Use HTML imports with
Bun.serve()for frontend instead of Vite
Files:
packages/template-generator/src/template-handlers/auth.tsapps/cli/test/frontend.test.tsapps/cli/src/utils/compatibility-rules.tspackages/template-generator/src/processors/api-deps.tsapps/cli/src/prompts/backend.tspackages/template-generator/src/template-handlers/api.tspackages/template-generator/src/template-handlers/examples.tsapps/cli/test/backend-runtime.test.tspackages/template-generator/src/template-handlers/packages.tspackages/template-generator/src/processors/env-vars.ts
**/*.hbs
📄 CodeRabbit inference engine (.cursor/rules/better-t-stack-repo.mdc)
**/*.hbs: In Handlebars templates, avoid generic if/else blocks. Write explicit conditions, such as: use if (eq orm "prisma") for Prisma, and else if (eq orm "drizzle") for Drizzle
Escape the '{{' in Handlebars templates like '{{'
Files:
packages/template-generator/templates/packages/env/src/web.ts.hbspackages/template-generator/templates/api/orpc/fullstack/nuxt/app/plugins/orpc.server.ts.hbspackages/template-generator/templates/frontend/nuxt/package.json.hbspackages/template-generator/templates/api/orpc/fullstack/nuxt/server/routes/rpc/[...].ts.hbspackages/template-generator/templates/api/orpc/fullstack/nuxt/app/plugins/orpc.client.ts.hbspackages/template-generator/templates/examples/ai/fullstack/nuxt/server/api/ai.post.ts.hbspackages/template-generator/templates/auth/better-auth/fullstack/nuxt/server/api/auth/[...all].ts.hbspackages/template-generator/templates/api/orpc/fullstack/nuxt/server/routes/rpc/index.ts.hbspackages/template-generator/templates/api/orpc/server/src/context.ts.hbs
**/*.test.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc)
**/*.test.{ts,tsx,js,jsx}: Usebun testinstead ofjestorvitestfor running tests
Usebun:testmodule withtestandexpectfunctions for writing tests
Files:
apps/cli/test/frontend.test.tsapps/cli/test/backend-runtime.test.ts
🧠 Learnings (4)
📚 Learning: 2025-12-03T07:48:26.419Z
Learnt from: CR
Repo: AmanVarshney01/create-better-t-stack PR: 0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-12-03T07:48:26.419Z
Learning: Applies to **/*.{html,tsx,ts,jsx,js} : Use HTML imports with `Bun.serve()` for frontend instead of Vite
Applied to files:
packages/template-generator/src/template-handlers/auth.tspackages/template-generator/templates/packages/env/src/web.ts.hbsapps/cli/src/utils/compatibility-rules.tspackages/template-generator/src/processors/api-deps.tsapps/cli/src/prompts/backend.tspackages/template-generator/src/template-handlers/api.tspackages/template-generator/src/template-handlers/examples.ts
📚 Learning: 2025-12-03T07:48:14.714Z
Learnt from: CR
Repo: AmanVarshney01/create-better-t-stack PR: 0
File: .cursor/rules/convex_rules.mdc:0-0
Timestamp: 2025-12-03T07:48:14.714Z
Learning: Applies to convex/crons.ts : Define crons by declaring the top-level crons object, calling methods on it, and then exporting it as default
Applied to files:
packages/template-generator/templates/api/orpc/fullstack/nuxt/server/routes/rpc/index.ts.hbs
📚 Learning: 2025-12-03T07:48:26.419Z
Learnt from: CR
Repo: AmanVarshney01/create-better-t-stack PR: 0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-12-03T07:48:26.419Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Bun automatically loads .env files, so don't use the dotenv package
Applied to files:
packages/template-generator/src/template-handlers/packages.ts
📚 Learning: 2025-12-03T07:48:26.419Z
Learnt from: CR
Repo: AmanVarshney01/create-better-t-stack PR: 0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-12-03T07:48:26.419Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Use `Bun.serve()` which supports WebSockets, HTTPS, and routes instead of `express`
Applied to files:
packages/template-generator/src/processors/env-vars.ts
🧬 Code graph analysis (7)
packages/template-generator/src/template-handlers/auth.ts (1)
packages/template-generator/src/template-handlers/utils.ts (1)
processTemplatesFromPrefix(43-72)
apps/cli/test/frontend.test.ts (1)
apps/cli/test/test-utils.ts (2)
runTRPCTest(62-141)expectSuccess(143-153)
apps/cli/src/utils/compatibility-rules.ts (1)
packages/types/src/types.ts (1)
Frontend(34-34)
apps/cli/src/prompts/backend.ts (1)
apps/cli/src/index.ts (1)
Frontend(312-312)
packages/template-generator/src/template-handlers/api.ts (1)
packages/template-generator/src/template-handlers/utils.ts (2)
processTemplatesFromPrefix(43-72)processSingleTemplate(17-41)
packages/template-generator/src/template-handlers/examples.ts (1)
packages/template-generator/src/template-handlers/utils.ts (1)
processTemplatesFromPrefix(43-72)
packages/template-generator/src/template-handlers/packages.ts (1)
packages/template-generator/src/template-handlers/utils.ts (1)
processSingleTemplate(17-41)
🔇 Additional comments (22)
packages/template-generator/templates/examples/ai/fullstack/nuxt/server/api/ai.post.ts.hbs (2)
1-3: LGTM!Import statements are clean and correctly import the required AI SDK utilities.
9-12: No changes needed. The model identifiergemini-2.5-flashis a valid, stable Google Gemini model released June 17, 2025. This is the current standard naming convention for the latest Gemini models (the 2.5 family replaced 2.0 models in 2025).packages/template-generator/templates/frontend/nuxt/package.json.hbs (1)
18-19: LGTM!The addition of
vue-routerand@vue/devtools-apidependencies is appropriate for a Nuxt frontend template. JSON formatting is correct.packages/template-generator/src/processors/env-vars.ts (1)
198-201: LGTM!The comment accurately reflects the expanded fullstack frontend support. Nuxt is already properly handled throughout the rest of this file for env variable naming and frontend detection.
packages/template-generator/templates/auth/better-auth/fullstack/nuxt/server/api/auth/[...all].ts.hbs (1)
1-5: LGTM!The Nuxt 3 catch-all auth route template correctly delegates to the better-auth handler.
defineEventHandlerandtoWebRequestare auto-imported by Nuxt/H3, so explicit imports are not needed.apps/cli/test/backend-runtime.test.ts (1)
448-451: LGTM!The test assertion correctly reflects the updated error message that now includes Nuxt as a supported frontend for the self backend.
apps/cli/test/frontend.test.ts (1)
463-505: LGTM!The new test cases for Nuxt with self backend follow the established patterns and correctly use
orpc(since tRPC is not supported with Nuxt). Both fullstack and traditional backend configurations are properly tested.apps/cli/src/utils/compatibility-rules.ts (2)
47-53: LGTM!The
FULLSTACK_FRONTENDSconstant is correctly updated to include"nuxt", and the comment accurately describes the purpose of this array.
69-69: Error messages are consistent and helpful.Both error messages correctly reference Nuxt alongside Next.js and TanStack Start, providing clear guidance for users attempting to use the self backend.
Also applies to: 83-83
packages/template-generator/src/template-handlers/auth.ts (1)
192-201: LGTM, but note the same ordering pattern as examples.ts.The fullstack templates are processed before web templates for Nuxt, which is the inverse of the React pattern (lines 169-189 where web is processed first, then fullstack). This is consistent with how
examples.tshandles Nuxt, so the behavior is at least internally coherent.If the ordering in
examples.tsis confirmed as intentional, this follows the same pattern correctly.packages/template-generator/templates/packages/env/src/web.ts.hbs (1)
66-67: No action needed — runtimeEnv omission for Nuxt is intentional.
@t3-oss/env-nuxtautomatically fills theruntimeEnvoption, so it does not need to be explicitly declared in the configuration. Unlike@t3-oss/env-nextjs(which requires explicitruntimeEnv), Nuxt handles this internally. This pattern is consistent across all Nuxt branches in the template.packages/template-generator/src/template-handlers/examples.ts (1)
83-98: The template processing order concern is not applicable here. Thefullstack/nuxtandweb/nuxtdirectories contain non-overlapping files: fullstack provides server API endpoints (e.g.,server/api/ai.post.ts.hbs) while web provides page components (e.g.,app/pages/ai.vue.hbs). Since there are no file conflicts between these directories, the processing order has no effect on the final output, regardless of whether fullstack is processed before or after web.Likely an incorrect or invalid review comment.
packages/template-generator/templates/api/orpc/fullstack/nuxt/server/routes/rpc/index.ts.hbs (1)
1-1: LGTM!The re-export correctly delegates to the catch-all route handler, following Nuxt server route conventions.
packages/template-generator/templates/api/orpc/fullstack/nuxt/app/plugins/orpc.client.ts.hbs (1)
7-28: LGTM!The Nuxt plugin correctly sets up the ORPC client with RPC link and provides tanstack-query utilities via Nuxt's provide/inject mechanism. The conditional credentials handling for better-auth is properly implemented.
packages/template-generator/src/template-handlers/packages.ts (2)
5-5: LGTM!The import addition for
processSingleTemplateenables the more granular template processing approach.
37-84: LGTM!The refactor from bulk prefix-based processing to individual
processSingleTemplatecalls provides better control over which env templates are generated based on the project configuration. The conditional logic correctly handles:
- Base files (package.json, tsconfig.json) always included
- web.ts only for web frontends (including Nuxt)
- native.ts only for native frontends
- server.ts only for non-Convex backends
packages/template-generator/templates/api/orpc/server/src/context.ts.hbs (1)
38-57: LGTM!The Nuxt context creation branch correctly follows the established patterns in this template:
- Uses type alias (per coding guidelines)
- Accepts headers via
CreateContextOptionsfor session retrieval- Properly integrates with better-auth when enabled
- Returns empty object when no auth is configured
The implementation is consistent with how other fullstack backends (Next, TanStack Start) handle context creation.
packages/template-generator/templates/api/orpc/fullstack/nuxt/app/plugins/orpc.server.ts.hbs (1)
6-24: LGTM!The plugin correctly handles the server-side ORPC setup with proper null handling for
useRequestEvent()and follows Nuxt's provide/inject pattern for exposing the ORPC utilities.packages/template-generator/src/template-handlers/api.ts (2)
5-5: LGTM!The import of
processSingleTemplateis correctly added to support the selective template inclusion for Nuxt fullstack.
48-67: LGTM!The Nuxt fullstack handling logic correctly mirrors the pattern used for React frameworks (Next, TanStack Start). The separation of fullstack templates with selective inclusion of
vue-query.tsis a clean approach that avoids conflicts with the fullstack-specific ORPC plugins.packages/template-generator/templates/api/orpc/fullstack/nuxt/server/routes/rpc/[...].ts.hbs (2)
10-30: LGTM!The handler setup correctly instantiates both RPC and OpenAPI handlers at module level for reuse. The
BatchHandlerPluginenables request batching, andOpenAPIReferencePluginwithZodToJsonSchemaConverterprovides API documentation capabilities.
32-49: LGTM!The event handler correctly implements a fallback chain: RPC handler → OpenAPI handler → 404 response. The use of H3's
toWebRequestandsetResponseStatusutilities is appropriate for Nuxt server routes.
✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.
Summary by CodeRabbit
New Features
Dependencies
Tests
✏️ Tip: You can customize this high-level summary in your review settings.