Skip to content

Commit c2be4fd

Browse files
ankur-archclaude
andcommitted
docs(guides): assume fixed scaffold templates; keep a fallback note
With the upstream template fix (namespace-qualified model access in generated seed.ts/users.ts) treated as merged, the guides drop the "update the starter query helpers" step and the bun gotcha. The post-fix flow is the one already verified end to end: scaffold, db:init, db:seed, serve (the earlier runs applied exactly the change the upstream fix makes). A short note under the seed step covers readers on an older scaffold: the exact error they would see and the one-line fix. Steps renumbered; the Elysia cross-link anchor follows. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 47e18d9 commit c2be4fd

3 files changed

Lines changed: 18 additions & 48 deletions

File tree

apps/docs/content/docs/guides/next/frameworks/elysia.mdx

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -30,24 +30,7 @@ Pick your database at the prompt. The template generates an Elysia server in `sr
3030
cd my-elysia-api
3131
```
3232

33-
## 2. Update the starter query helpers
34-
35-
Model access is namespace-qualified on PostgreSQL (`db.orm.public.User`), and the current template's helper files still use the older flat form, which fails at runtime. Open `src/prisma/users.ts` and `src/prisma/seed.ts` and change every `db.orm.User` to `db.orm.public.User`:
36-
37-
```ts title="src/prisma/users.ts"
38-
const users = await db.orm.public.User
39-
.select("id", "email", "username", "name", "createdAt")
40-
.take(limit)
41-
.all();
42-
```
43-
44-
:::note
45-
46-
This is a known template issue and will disappear from this guide once the template is updated.
47-
48-
:::
49-
50-
## 3. Initialize and seed the database
33+
## 2. Initialize and seed the database
5134

5235
```bash
5336
bun run db:init
@@ -59,7 +42,13 @@ bun run db:seed
5942
Seeded 3 users.
6043
```
6144

62-
## 4. Run the server
45+
:::note
46+
47+
Scaffolded with an older `create-prisma` and seeing `Cannot read properties of undefined (reading 'where')`? Update `db.orm.User` to `db.orm.public.User` in `src/prisma/seed.ts` and `src/prisma/users.ts`. Current templates generate the qualified form.
48+
49+
:::
50+
51+
## 3. Run the server
6352

6453
```bash
6554
bun run dev
@@ -79,7 +68,7 @@ curl http://localhost:3000/users
7968
]
8069
```
8170

82-
The route handler is ordinary Elysia code calling an ordinary Prisma Next query; there is no framework adapter in between. To add write routes, follow the same pattern as the [Hono guide's POST route](/guides/next/frameworks/hono#5-add-a-post-route); the query code is identical.
71+
The route handler is ordinary Elysia code calling an ordinary Prisma Next query; there is no framework adapter in between. To add write routes, follow the same pattern as the [Hono guide's POST route](/guides/next/frameworks/hono#4-add-a-post-route); the query code is identical.
8372

8473
## Common gotchas
8574

apps/docs/content/docs/guides/next/frameworks/hono.mdx

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -30,24 +30,7 @@ Pick your package manager and database at the prompts. The template generates a
3030
cd my-hono-api
3131
```
3232

33-
## 2. Update the starter query helpers
34-
35-
Model access is namespace-qualified on PostgreSQL (`db.orm.public.User`), and the current template's helper files still use the older flat form, which fails at runtime. Open `src/prisma/users.ts` and `src/prisma/seed.ts` and change every `db.orm.User` to `db.orm.public.User`:
36-
37-
```ts title="src/prisma/users.ts"
38-
const users = await db.orm.public.User
39-
.select("id", "email", "username", "name", "createdAt")
40-
.take(limit)
41-
.all();
42-
```
43-
44-
:::note
45-
46-
This is a known template issue and will disappear from this guide once the template is updated.
47-
48-
:::
49-
50-
## 3. Initialize and seed the database
33+
## 2. Initialize and seed the database
5134

5235
```bash
5336
bun run db:init
@@ -59,7 +42,13 @@ bun run db:seed
5942
Seeded 3 users.
6043
```
6144

62-
## 4. Run the server
45+
:::note
46+
47+
Scaffolded with an older `create-prisma` and seeing `Cannot read properties of undefined (reading 'where')`? Update `db.orm.User` to `db.orm.public.User` in `src/prisma/seed.ts` and `src/prisma/users.ts`. Current templates generate the qualified form.
48+
49+
:::
50+
51+
## 3. Run the server
6352

6453
```bash
6554
bun run dev
@@ -81,7 +70,7 @@ curl http://localhost:3000/users
8170

8271
The route handler is ordinary Hono code calling an ordinary Prisma Next query; there is no framework adapter in between.
8372

84-
## 5. Add a POST route
73+
## 4. Add a POST route
8574

8675
Add a route that creates a user from the request body. Add this to `src/index.ts` above the `serve(...)` call:
8776

apps/docs/content/docs/guides/next/runtimes/bun.mdx

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,6 @@ there are now 2 users
8484

8585
That is the whole loop: schema to contract, contract to database, typed queries against both.
8686

87-
## Common gotchas
88-
89-
:::warning
90-
91-
The starter `seed.ts` and `users.ts` files in some templates still address models with the older flat form (`db.orm.User`), which fails at runtime with `Cannot read properties of undefined`. If you use them, change the model access to `db.orm.public.User`.
92-
93-
:::
94-
9587
## Prompt your coding agent
9688

9789
The scaffold installs Prisma Next skills for your coding agent. Prompts that map to this guide:

0 commit comments

Comments
 (0)