https://github.com/prisma/prisma-accelerate-supabase-edge-functions
https://github.com/prisma/prisma-accelerate-supabase-edge-functions
Last synced: 9 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/prisma/prisma-accelerate-supabase-edge-functions
- Owner: prisma
- Created: 2024-03-14T08:37:19.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-03-14T08:40:43.000Z (over 2 years ago)
- Last Synced: 2025-10-09T13:32:35.439Z (9 months ago)
- Language: TypeScript
- Size: 6.84 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Supabase edge function with Prisma Accelerate
This project demonstrates the integration of Prisma ORM with
[Prisma Accelerate](https://www.prisma.io/data-platform/accelerate) within
[Supabase edge functions](https://supabase.com/docs/guides/functions).
## Prerequisites
- Have Deno installed
- Have Docker installed for testing Supabase edge functions
- Meet the
[requirements]((https://www.prisma.io/docs/accelerate/getting-started#prerequisites))
for using Prisma Accelerate
1. Fill in your `.env` file with the `DATABASE_URL` (Prisma Accelerate
connection string) and a `DIRECT_URL` (for database migrations):
```bash
DATABASE_URL="prisma://accelerate.prisma-data.net/?api_key="
DIRECT_URL="postgres://root:password@127.0.0.1:5432/postgres"
```
2. Generate a `PrismaClient`:
```bash
deno run -A --unstable npm:prisma generate --no-engine
```
## Test App Locally
1. Start the app:
```bash
npx supabase start
```
2. Watch logs and debug:
```bash
npx supabase functions serve --env-file ./supabase/.env --no-verify-jwt
```
3. Visit `http://127.0.0.1:54321/functions/v1/hello-accelerate`
## Deploy to Production
1. Add secrets to production:
```bash
npx supabase secrets set --env-file ./supabase/.env
```
2. Deploy to production:
```bash
npx supabase deploy --no-verify-jwt
```