-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat[SUPABASE & PRISMA]: Create db for the application
Using prisma ORM and Vercel / supabase for .env, added .env.example
- Loading branch information
1 parent
8bf9bdf
commit 17d1535
Showing
11 changed files
with
73 additions
and
5 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Get this from vercel supabase secrets | ||
|
||
POSTGRES_URL="postgres://<username>:<password>@<host>:<port>/<database>?sslmode=require&supa=base-pooler.x" | ||
POSTGRES_PRISMA_URL="postgres://<username>:<password>@<host>:<port>/<database>?sslmode=require&supa=base-pooler.x" | ||
SUPABASE_URL="https://<project>.supabase.co" | ||
NEXT_PUBLIC_SUPABASE_URL="https://<project>.supabase.co" | ||
POSTGRES_URL_NON_POOLING="postgres://<username>:<password>@<host>:<port>/<database>?sslmode=require" | ||
SUPABASE_JWT_SECRET="<your-jwt-secret>" | ||
POSTGRES_USER="<username>" | ||
NEXT_PUBLIC_SUPABASE_ANON_KEY="<your-anon-key>" | ||
POSTGRES_PASSWORD="<password>" | ||
POSTGRES_DATABASE="<database>" | ||
SUPABASE_SERVICE_ROLE_KEY="<your-service-role-key>" | ||
POSTGRES_HOST="<host>" | ||
SUPABASE_ANON_KEY="<your-anon-key>" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
node_modules | ||
# Keep environment variables out of version control | ||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { PrismaClient } from "@prisma/client"; | ||
|
||
const prismaClientSingleton = () => { | ||
return new PrismaClient(); | ||
}; | ||
|
||
declare global { | ||
var prismaGlobal: undefined | ReturnType<typeof prismaClientSingleton>; | ||
} | ||
|
||
const prisma = globalThis.prismaGlobal ?? prismaClientSingleton(); | ||
|
||
export default prisma; | ||
|
||
if (process.env.NODE_ENV !== "production") globalThis.prismaGlobal = prisma; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// This is your Prisma schema file, | ||
// learn more about it in the docs: https://pris.ly/d/prisma-schema | ||
|
||
// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions? | ||
// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init | ||
|
||
generator client { | ||
provider = "prisma-client-js" | ||
previewFeatures = ["fullTextSearch"] | ||
} | ||
|
||
datasource db { | ||
provider = "postgresql" | ||
url = env("POSTGRES_PRISMA_URL") // uses connection pooling | ||
directUrl = env("POSTGRES_URL_NON_POOLING") // uses a direct connection | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.