🚀 Vercel Postgres + Prisma Next.js Starter - Simple Next.js template that uses Vercel Postgres as the database and Prisma as the ORM. 🚀
https://github.com/coding-to-music/vercel-postgres-prisma-serverless-cloud-database
From / By https://github.com/vercel/examples/tree/main/storage/postgres-prisma
https://github.com/coding-to-music/grafana-cloud-docker-postgres-integration
- APP
- Prisma Studio
git init
git add .
git remote remove origin
git commit -m "first commit"
git branch -M main
git remote add origin git@github.com:coding-to-music/vercel-postgres-prisma-serverless-cloud-database.git
git push -u origin main
yarn install
yarn build
yarn start
yarn seed:pets
yarn seed:simulation
yarn seed:streets
yarn seed:ev_locations
-
name: Vercel Postgres + Prisma Next.js Starter
-
slug: postgres-prisma
-
description: Simple Next.js template that uses Vercel Postgres as the database and Prisma as the ORM.
-
framework: Next.js
-
useCase: Starter
-
css: Tailwind
-
database: Vercel Postgres
-
demoUrl: https://postgres-prisma.vercel.app/
-
relatedTemplates:
-
postgres-starter
-
postgres-kysely
-
postgres-sveltekit
Simple Next.js template that uses Vercel Postgres as the database and Prisma as the ORM.
https://postgres-prisma.vercel.app/
You can choose from one of the following two methods to use this repository:
Deploy the example using Vercel:
Execute create-next-app
with pnpm to bootstrap the example:
pnpm create next-app --example https://github.com/vercel/examples/tree/main/storage/postgres-prisma
Once that's done, copy the .env.example file in this directory to .env.local (which will be ignored by Git):
cp .env.example .env.local
Then open .env.local
and set the environment variables to match the ones in your Vercel Storage Dashboard.
Next, run Next.js in development mode:
pnpm dev
Deploy it to the cloud with Vercel (Documentation).
sudo apt install postgresql
Console-generated psql connection example in postgres-prisma-postgres does not work, possible solution is provided here
The Suggested psql connection example in postgres-prisma-postgres does not work:
# Format:
psql "postgresql://username:password@host:port/database"
# Example provided by the console:
psql "postgres://default:************@<endpoint>.us-east-1.postgres.vercel-storage.com:5432/verceldb"
It gives this error:
psql: error: ERROR: Endpoint ID is not specified. Either please upgrade the postgres client library (libpq) for SNI support or pass the endpoint ID (first part of the domain name) as a parameter: '?options=project%3D<endpoint-id>'. See more at https://neon.tech/sni
ERROR: connection is insecure (try using `sslmode=require`)
However, this connection string does work, by appending the ?options=project%3endpoint
:
# Format:
psql "postgresql://username:password@host:port/database?options=project%3D<endpoint>"
# Example:
psql "postgres://default:************@<endpoint>.us-east-1.postgres.vercel-storage.com:5432/verceldb?options=project%3D<endpoint>"
Output:
psql (12.14 (Ubuntu 12.14-0ubuntu0.20.04.1), server 15.2)
WARNING: psql major version 12, server major version 15.
Some psql features might not work.
SSL connection (protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384, bits: 256, compression: off)
Type "help" for help.
verceldb=> \dt
List of relations
Schema | Name | Type | Owner
--------+-------+-------+---------
public | users | table | default
(1 row)