add nextjs frontend and backend

This commit is contained in:
Aman Varshney
2025-04-12 21:19:06 +05:30
parent cff1a8202b
commit 33158a2ddf
48 changed files with 1213 additions and 198 deletions

View File

@@ -16,6 +16,11 @@ export async function getBackendFrameworkChoice(
label: "Hono",
hint: "Lightweight, ultrafast web framework",
},
{
value: "next",
label: "Next.js",
hint: "Full-stack framework with API routes",
},
{
value: "express",
label: "Express",

View File

@@ -52,7 +52,8 @@ export async function gatherConfig(
},
frontend: () => getFrontendChoice(flags.frontend),
backend: () => getBackendFrameworkChoice(flags.backend),
runtime: () => getRuntimeChoice(flags.runtime),
runtime: ({ results }) =>
getRuntimeChoice(flags.runtime, results.backend),
database: () => getDatabaseChoice(flags.database),
orm: ({ results }) =>
getORMChoice(flags.orm, results.database !== "none", results.database),

View File

@@ -27,7 +27,8 @@ export async function getFrontendChoice(
(f) =>
f === "tanstack-router" ||
f === "react-router" ||
f === "tanstack-start",
f === "tanstack-start" ||
f === "next",
)
? ["web"]
: [],
@@ -54,6 +55,11 @@ export async function getFrontendChoice(
label: "React Router",
hint: "A userobsessed, standardsfocused, multistrategy router",
},
{
value: "next",
label: "Next.js",
hint: "The React Framework for the Web",
},
{
value: "tanstack-start",
label: "TanStack Start (beta)",
@@ -65,7 +71,8 @@ export async function getFrontendChoice(
(f) =>
f === "tanstack-router" ||
f === "react-router" ||
f === "tanstack-start",
f === "tanstack-start" ||
f === "next",
) || "tanstack-router",
});

View File

@@ -1,13 +1,18 @@
import { cancel, isCancel, select } from "@clack/prompts";
import pc from "picocolors";
import { DEFAULT_CONFIG } from "../constants";
import type { ProjectRuntime } from "../types";
import type { ProjectBackend, ProjectRuntime } from "../types";
export async function getRuntimeChoice(
runtime?: ProjectRuntime,
backend?: ProjectBackend,
): Promise<ProjectRuntime> {
if (runtime !== undefined) return runtime;
if (backend === "next") {
return "node";
}
const response = await select<ProjectRuntime>({
message: "Select runtime",
options: [