hi-zarina.io

Connecting Your Database for Enhanced Features:

This guide outlines the database options and setup steps for enabling features like Chat Link Sharing in your application.

Choose Your Database:

1. Serverless Postgres (default):

2. MongoDB Atlas (alternative):

Environment Variables:

Postgres:

Variable  
POSTGRES_PRISMA_URL postgres://USER:PASS@SOMEHOST.postgres.vercel-storage.com/SOMEDB?pgbouncer=true&connect_timeout=15
POSTGRES_URL_NON_POOLING (optional) URL for the Postgres database without pooling (specific use cases)

MongoDB:

Variable  
MDB_URI mongodb://USER:PASS@CLUSTER-NAME.mongodb.net/DATABASE-NAME?retryWrites=true&w=majority

MongoDB Atlas + Prisma

When using MongoDB Atlas, you’ll need to make the below changes to the file src/server/prisma/schema.prisma.

...
datasource db {
  provider  = "mongodb"
  url       = env("MDB_URI")
}

//
// Storage of Linked Data
//
model LinkStorage {
  id String @id @default(uuid()) @map("_id")

// ...rest of file

Initial Setup Steps:

  1. Run npx prisma db push: Create or update the database schema (run once after connecting).

Additional Resources: