feat(web-next): add Next.js 15 app shell with tRPC endpoint

This commit is contained in:
2026-04-06 14:49:43 +02:00
parent 8da107a446
commit 2b9a1adafd
7 changed files with 86 additions and 4 deletions

View File

@@ -0,0 +1,6 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
transpilePackages: ["@repo/api", "@repo/api-client", "@repo/core", "@repo/ui"],
};
export default nextConfig;

View File

@@ -4,17 +4,24 @@
"version": "0.0.0",
"type": "module",
"scripts": {
"build": "echo 'placeholder'",
"dev": "echo 'placeholder'",
"build": "next build",
"dev": "next dev --port 3000",
"lint": "eslint .",
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@repo/api": "workspace:*",
"@repo/api-client": "workspace:*",
"@repo/ui": "workspace:*"
"@repo/ui": "workspace:*",
"next": "^15.3.0",
"react": "^19.0.0",
"react-dom": "^19.0.0"
},
"devDependencies": {
"@repo/eslint-config": "workspace:*",
"@repo/typescript-config": "workspace:*"
"@repo/typescript-config": "workspace:*",
"@types/node": "^22.0.0",
"@types/react": "^19.0.0",
"@types/react-dom": "^19.0.0"
}
}

View File

@@ -0,0 +1,12 @@
import { fetchRequestHandler } from "@trpc/server/adapters/fetch";
import { appRouter } from "@repo/api";
const handler = (req: Request) =>
fetchRequestHandler({
endpoint: "/api/trpc",
req,
router: appRouter,
createContext: () => ({}),
});
export { handler as GET, handler as POST };

View File

@@ -0,0 +1,21 @@
import type { Metadata } from "next";
import { Providers } from "./providers";
export const metadata: Metadata = {
title: "Template — Next.js",
description: "Clean Architecture Monorepo Template",
};
export default function RootLayout({
children,
}: {
children: React.ReactNode;
}) {
return (
<html lang="en">
<body>
<Providers>{children}</Providers>
</body>
</html>
);
}

View File

@@ -0,0 +1,8 @@
export default function Home() {
return (
<main>
<h1>Template Next.js</h1>
<p>Clean Architecture Monorepo Template</p>
</main>
);
}

View File

@@ -0,0 +1,7 @@
"use client";
import { ApiProvider } from "@repo/api-client";
export function Providers({ children }: { children: React.ReactNode }) {
return <ApiProvider trpcUrl="/api/trpc">{children}</ApiProvider>;
}