Skip to content

codeSTACKr/prisma-mongodb-demo

Repository files navigation

Prisma & MongoDB Demo App with Accelerate

⭐ Star this repo if you find it useful!

This is a Next.js project demonstrating how to build a full-stack application using Prisma, MongoDB Atlas, and Prisma Accelerate. The application allows you to manage users and their posts. It also includes caching and connection pooling with Prisma Accelerate.

Learn More

To learn more about this project:

📺 Watch the video tutorial 📺 Watch the video

📖 Read the written tutorial 📖 Written tutorial

Prerequisites

Before running this application, you'll need to set up the following:

  1. MongoDB Atlas Database

    • Create a free account at MongoDB Atlas
    • Set up a new cluster and get your connection string
    • Add your connection string to .env as DIRECT_DATABASE_URL
  2. Prisma Accelerateclou

    • Sign up for Prisma Cloud
    • Create a new project and enable Prisma Accelerate
    • Get your MongoDB Atlas connection string
    • Add it to .env as DATABASE_URL

Environment Setup

Create a .env file in the root directory with the following variables:

# Your MongoDB Atlas connection string
DATABASE_URL="prisma://accelerate.prisma-data.net/?api_key=your_api_key"


# Your Prisma Accelerate connection string
DIRECT_DATABASE_URL="mongodb+srv://username:password@cluster.mongodb.net/database_name"

Getting Started

First, install the dependencies:

npm install
# or
yarn install
# or
pnpm install
# or
bun install

Then, run the development server:

npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev

Open http://localhost:3000 with your browser to see the result.

Tech Stack

Deploy on Vercel

The easiest way to deploy your Next.js app is to use the Vercel Platform.

Check out the Next.js deployment documentation for more details.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published