From ad702ef0d8e1a3e5cf994d493cc5431b16e5722a Mon Sep 17 00:00:00 2001
From: ymc9 <104139426+ymc9@users.noreply.github.com>
Date: Tue, 20 May 2025 19:49:38 -0700
Subject: [PATCH 1/2] docs: for release 2.15.0
---
docs/faq.md | 4 ++
docs/reference/server-adapters/elysia.mdx | 67 +++++++++++++++++++++++
2 files changed, 71 insertions(+)
create mode 100644 docs/reference/server-adapters/elysia.mdx
diff --git a/docs/faq.md b/docs/faq.md
index 39d88c76..504fb69d 100644
--- a/docs/faq.md
+++ b/docs/faq.md
@@ -61,3 +61,7 @@ The short answer is it works in most cases. Please refer to [this guide](./guide
### Does the order in which access policies are defined matter?
No. See [here](./the-complete-guide/part1/4-access-policy/4.1-model-level.md#evaluation-of-model-level-policies) for how access polices are evaluated.
+
+### Is Prisma's new "prisma-client" generator supported?
+
+No. The feature was add in [Prisma 6.6](https://github.com/prisma/prisma/releases/tag/6.6.0) but it's still in early access. We plan to work on it when Prisma pushes it to GA.
diff --git a/docs/reference/server-adapters/elysia.mdx b/docs/reference/server-adapters/elysia.mdx
new file mode 100644
index 00000000..7e9953ae
--- /dev/null
+++ b/docs/reference/server-adapters/elysia.mdx
@@ -0,0 +1,67 @@
+---
+title: Elysia
+description: Adapter for integrating with Elysia
+sidebar_position: 7
+---
+
+import ErrorHandling from './_error-handling.md';
+import AdapterOptions from './_options.mdx';
+import UsingAPI from './_using-api.mdx'
+
+# Elysia Adapter
+
+The `@zenstackhq/server/elysia` module provides a quick way to install a CRUD middleware onto an [Elysia](https://elysiajs.com/) app. Combined with ZenStack's power of enhancing Prisma with access policies, you can achieve a secure data backend without manually coding it.
+
+### Installation
+
+```bash
+bun install @zenstackhq/server
+```
+
+### Mounting the API
+
+You can use the `createElysiaHandler` API to create an Elysia request handler that handles CRUD requests automatically:
+
+```ts
+import { PrismaClient } from '@prisma/client';
+import { Elysia, Context } from 'elysia';
+import { enhance } from '@zenstackhq/runtime';
+import { createElysiaHandler } from '@zenstackhq/server/elysia';
+
+const prisma = new PrismaClient();
+
+const app = new Elysia({ prefix: '/api' });
+
+// install the CRUD middleware under route "/api/crud"
+app.group('/crud', (app) =>
+ app.use(
+ createElysiaHandler({
+ getPrisma: () => enhance(prisma, { user:getCurrentUser() }),
+ basePath: '/api/crud',
+ })
+ )
+);
+
+function getCurrentUser(context: Context) {
+ // the implementation depends on your authentication mechanism
+ ...
+}
+
+app.listen(3000);
+```
+
+The middleware factory takes the following options to initialize:
+
+
string+ + Optional base path to strip from the request path before passing to the API handler. E.g., if your CRUD handler is mounted at `/api/crud`, set this field to `'/api/crud'`. + +### Using the API + +