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.
1. Serverless Postgres (default):
- Available on Vercel, Neon, and other platforms.
- Less feature-rich but a suitable option depending on your needs.
- Connection String: Replace placeholders with your Postgres credentials.
postgres://USER:[email protected]/SOMEDB?pgbouncer=true&connect_timeout=15
2. MongoDB Atlas (alternative):
- Highly Recommended: More than a database, it's a data platform. MongoDB Atlas is a robust cloud-based platform that offers scalability, security, and a suite of developer tools. No need for a separate vector database, you can query your vector embeddings right within your operational database!
- Additional Features: MongoDB Atlas is packed with unique features designed to streamline the development process such as: Atlas App Services, Atlas search (with vector search), Atlas charts, Data Federation, and more.
- Connection String: Replace placeholders with your Atlas credentials.
mongodb://USER:[email protected]/DATABASE-NAME?retryWrites=true&w=majority
Variable | |
---|---|
POSTGRES_PRISMA_URL |
postgres://USER:[email protected]/SOMEDB?pgbouncer=true&connect_timeout=15 |
POSTGRES_URL_NON_POOLING (optional) |
URL for the Postgres database without pooling (specific use cases) |
Variable | |
---|---|
MDB_URI |
mongodb://USER:[email protected]/DATABASE-NAME?retryWrites=true&w=majority |
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
- Run
npx prisma db push
: Create or update the database schema (run once after connecting).
- Prisma documentation: https://www.prisma.io/docs/
- MongoDB Atlas: https://www.mongodb.com/atlas/database
- Atlas App Services: https://www.mongodb.com/docs/atlas/app-services/
- Atlas vector search: https://www.mongodb.com/products/platform/atlas-vector-search/
- Atlas Data Federation: https://www.mongodb.com/products/platform/atlas-data-federation