Skip to content

Commit

Permalink
fix: add new nuxt configs (#6557)
Browse files Browse the repository at this point in the history
* fix: add new nuxt configs

* feat: clean up nuxt docs

* Update content/200-orm/800-more/600-help-and-troubleshooting/100-help-articles/900-prisma-nuxt-module.mdx

* Update content/200-orm/800-more/600-help-and-troubleshooting/100-help-articles/900-prisma-nuxt-module.mdx

* Update content/200-orm/800-more/600-help-and-troubleshooting/100-help-articles/900-prisma-nuxt-module.mdx
  • Loading branch information
ankur-arch authored Dec 27, 2024
1 parent e5d2dcb commit c3827cd
Showing 1 changed file with 10 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
---

title: 'Using the Nuxt Prisma Module'
metaTitle: 'Add Prisma ORM Easily to Your Nuxt Apps'
metaDescription: 'Learn how to easily add Prisma ORM to your Nuxt apps, use its features, and understand its limitations.'

---

The Nuxt Prisma module simplifies the integration of Prisma ORM into your Nuxt applications.
Expand Down Expand Up @@ -187,17 +185,6 @@ If you're using [Nuxt server components](https://nuxt.com/docs/guide/directory-s
</template>
```

#### Using the auto-imported Prisma Client instance in your API route

You can use the auto-imported Prisma Client instance, prisma, in your Nuxt API route as follows:
```typescript
export default defineEventHandler(async (event) => {
return {
user: await prisma.user.findFirst(),
};
});
```

### Option B: `lib/prisma.ts`

After running through the initial setup prompts, this module creates the `lib/prisma.ts` file which contains a global instance of Prisma Client.
Expand Down Expand Up @@ -299,6 +286,9 @@ export default defineNuxtConfig({
| **formatSchema** | `boolean` | true | Whether to [format](/orm/reference/prisma-cli-reference#format) the [Prisma Schema](/orm/prisma-schema) file. |
| **installStudio** | `boolean` | true | Whether to install and start [Prisma Studio](https://www.prisma.io/studio) in the Nuxt Devtools. |
| **autoSetupPrisma** | `boolean` | false | Whether to skip all prompts during setup. This option is useful for automating Prisma setup in scripts or CI/CD pipelines. |
| **skipPrompts** | `false` | false | Skips all prompts |
| **prismaRoot** | `string` | false | Required when using [Nuxt layers](https://nuxt.com/docs/getting-started/layers). For example, if you have a Nuxt layer called `database`, the `prismaRoot` would be `./database` in the base nuxt config. This refers to the folder where Prisma will be initialized or checked. |
| **prismaSchemaPath** | `string` | `undefined` | Required when using [Nuxt layers](https://nuxt.com/docs/getting-started/layers). For example, if you have a Nuxt layer called `database`, the `prismaSchemaPath` would be `./database/prisma/schema.prisma` in the base nuxt config. |

## Limitations

Expand Down Expand Up @@ -355,4 +345,10 @@ export default defineNuxtConfig({
})
```

This configuration ensures that the module specifier is correctly mapped to the appropriate file.
This configuration ensures that the module specifier is correctly mapped to the appropriate file.

### Limitations in package manager support

The module is designed to work with popular package managers, including npm, Yarn, and pnpm. However, as of `v0.2`, it is not fully compatible with Bun due to an issue causing an indefinite installation loop.

Additionally, this package has not been tested with Deno and is therefore not officially **supported.**

0 comments on commit c3827cd

Please sign in to comment.