Skip to content

Commit f7e5f3b

Browse files
sayefdeenclaude
andcommitted
revert: remove Vercel demo and all related changes
Reverts commits 059b302, e0bf43c, 3a9e74d, 4f6cf9b. Restored original Next.js example, render.ts, and package.json. Homepage now points to GitHub README. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 4f6cf9b commit f7e5f3b

15 files changed

Lines changed: 56 additions & 875 deletions

File tree

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,4 @@ coverage
1111
*.log
1212
.next
1313
.trpc-studio.json
14-
packages/server/src/ui-assets.ts
1514
plan.md

examples/nextjs/.eslintrc.cjs

Lines changed: 0 additions & 8 deletions
This file was deleted.

examples/nextjs/next-env.d.ts

Lines changed: 0 additions & 5 deletions
This file was deleted.

examples/nextjs/next.config.js

Lines changed: 0 additions & 4 deletions
This file was deleted.

examples/nextjs/package.json

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,19 @@
44
"private": true,
55
"scripts": {
66
"dev": "next dev",
7-
"build": "next build",
8-
"start": "next start",
7+
"build": "echo 'skip'",
98
"lint": "echo 'skip'"
109
},
1110
"dependencies": {
12-
"@srawad/trpc-studio": "workspace:*",
1311
"@trpc/server": "^10.45.0",
1412
"next": "^14.0.0",
1513
"react": "^18.2.0",
1614
"react-dom": "^18.2.0",
15+
"@srawad/trpc-studio": "workspace:*",
1716
"zod": "^3.22.0"
1817
},
1918
"devDependencies": {
2019
"@types/react": "^18.2.0",
21-
"@types/react-dom": "^18.2.0",
22-
"eslint-config-next": "^14.0.0"
20+
"@types/react-dom": "^18.2.0"
2321
}
2422
}

examples/nextjs/src/app/demo/route.ts renamed to examples/nextjs/src/app/api/panel/route.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
import { NextResponse } from "next/server";
2-
import { renderTrpcStudio } from "@srawad/trpc-studio";
32

43
import { appRouter } from "~/server/router";
54

6-
export function GET() {
5+
export async function GET() {
6+
if (process.env.NODE_ENV !== "development") {
7+
return new NextResponse("Not Found", { status: 404 });
8+
}
9+
10+
const { renderTrpcStudio } = await import("@srawad/trpc-studio");
11+
712
return new NextResponse(
813
renderTrpcStudio(appRouter, {
914
url: "/api/trpc",
10-
meta: {
11-
title: "trpc-studio Demo",
12-
description: "A live demo of trpc-studio with an example tRPC API",
13-
version: "0.1.5",
14-
},
15+
meta: { title: "My API" },
1516
}),
1617
{ status: 200, headers: { "Content-Type": "text/html" } },
1718
);

examples/nextjs/src/app/api/trpc/[trpc]/route.ts

Lines changed: 0 additions & 13 deletions
This file was deleted.

examples/nextjs/src/app/layout.tsx

Lines changed: 0 additions & 15 deletions
This file was deleted.

examples/nextjs/src/app/page.tsx

Lines changed: 0 additions & 146 deletions
This file was deleted.

examples/nextjs/src/server/router.ts

Lines changed: 6 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -3,92 +3,16 @@ import { z } from "zod";
33

44
const t = initTRPC.create();
55

6-
const userRouter = t.router({
7-
getById: t.procedure.input(z.object({ id: z.string() })).query(({ input }) => {
8-
return {
9-
id: input.id,
10-
name: "Jane Smith",
11-
email: "jane@example.com",
12-
role: "admin" as const,
13-
createdAt: new Date().toISOString(),
14-
};
15-
}),
16-
17-
list: t.procedure
18-
.input(
19-
z
20-
.object({
21-
limit: z.number().min(1).max(100).default(10),
22-
offset: z.number().min(0).default(0),
23-
})
24-
.optional(),
25-
)
26-
.query(({ input }) => {
27-
return {
28-
users: [
29-
{ id: "1", name: "Jane Smith", email: "jane@example.com" },
30-
{ id: "2", name: "John Doe", email: "john@example.com" },
31-
],
32-
total: 2,
33-
limit: input?.limit ?? 10,
34-
offset: input?.offset ?? 0,
35-
};
36-
}),
37-
38-
create: t.procedure
39-
.input(
40-
z.object({
41-
name: z.string().min(1),
42-
email: z.string().email(),
43-
role: z.enum(["admin", "user", "moderator"]).default("user"),
44-
tags: z.array(z.string()).optional(),
45-
}),
46-
)
47-
.mutation(({ input }) => {
48-
return {
49-
id: Math.random().toString(36).slice(2),
50-
...input,
51-
createdAt: new Date().toISOString(),
52-
};
53-
}),
54-
});
55-
56-
const postRouter = t.router({
57-
getById: t.procedure.input(z.object({ id: z.string() })).query(({ input }) => {
58-
return {
59-
id: input.id,
60-
title: "Getting Started with tRPC",
61-
content: "tRPC allows you to build fully typesafe APIs...",
62-
author: { id: "1", name: "Jane Smith" },
63-
published: true,
64-
tags: ["trpc", "typescript", "tutorial"],
65-
};
6+
export const appRouter = t.router({
7+
hello: t.procedure.input(z.object({ name: z.string().optional() })).query(({ input }) => {
8+
return { greeting: `Hello ${input.name ?? "world"}!` };
669
}),
6710

68-
create: t.procedure
69-
.input(
70-
z.object({
71-
title: z.string().min(1),
72-
content: z.string(),
73-
published: z.boolean().default(false),
74-
tags: z.array(z.string()).optional(),
75-
}),
76-
)
77-
.mutation(({ input }) => {
78-
return {
79-
id: Math.random().toString(36).slice(2),
80-
...input,
81-
createdAt: new Date().toISOString(),
82-
};
11+
user: t.router({
12+
getById: t.procedure.input(z.object({ id: z.string() })).query(({ input }) => {
13+
return { id: input.id, name: "John Doe", email: "john@example.com" };
8314
}),
84-
});
85-
86-
export const appRouter = t.router({
87-
health: t.procedure.query(() => {
88-
return { status: "ok", timestamp: new Date().toISOString() };
8915
}),
90-
user: userRouter,
91-
post: postRouter,
9216
});
9317

9418
export type AppRouter = typeof appRouter;

0 commit comments

Comments
 (0)