Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/prisma/netlify-prisma-accelerate
https://github.com/prisma/netlify-prisma-accelerate
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/prisma/netlify-prisma-accelerate
- Owner: prisma
- Created: 2024-03-15T12:40:00.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2024-03-18T12:42:48.000Z (10 months ago)
- Last Synced: 2024-03-18T14:03:16.807Z (10 months ago)
- Language: TypeScript
- Size: 5.86 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Netlify Edge Functions with Prisma Accelerate
This guide outlines how to utilize Prisma Accelerate's connection pooling with
Netlify Edge functions.## Prerequisites
Before you begin, ensure you have the following tools installed:
- Netlify CLI:
```bash
npm install netlify-cli -g
```- Latest version of Deno in your project
## Getting Started
1. **Set Up Environment Variables**: Create an `.env` file in your project
directory and define the required environment variables:```bash
DATABASE_URL="prisma://accelerate.prisma-data.net/?api_key=__API_KEY__"
DIRECT_URL="postgresql://user:password@host:port/db_name?schema=public"
```2. **Run Migrations and Generate Prisma Client**:
Execute the following commands in your terminal:
```bash
deno run -A npm:prisma migrate dev --name init
```Generate your Prisma Client:
```bash
deno run -A --unstable npm:prisma generate --no-engine
```3. **Start Your Project**:
Launch your project locally using Netlify Dev:
```bash
netlify dev
```## Deploy to Production
Make sure you're logged in to Netlify using the CLI:
```bash
netlify login
```### Deploy to Netlify
1. **Set Environment Variables**:
Update your project's environment variables on Netlify using the CLI:
```bash
netlify env:set DATABASE_URL "prisma://accelerate.prisma-data.net/?api_key=__API_KEY__"
``````bash
netlify env:set DIRECT_URL "postgresql://user:password@host:port/db_name?schema=public"
```2. **Deploy to Netlify**:
Trigger the deployment process to Netlify:
```bash
netlify deploy --prod
```- **Output**:
Upon successful deployment, you'll receive deployment details including
logs and URLs to access your deployed application.3. **Test Your API**:
Navigate to the `/hello` endpoint of your deployed application to verify that
your API is functioning correctly.