⭐ 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.
To learn more about this project:
📖 Read the written tutorial 📖 Written tutorial
Before running this application, you'll need to set up the following:
-
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
asDIRECT_DATABASE_URL
-
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
asDATABASE_URL
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"
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.
- Next.js - React framework
- Prisma - Database ORM
- MongoDB Atlas - Database
- Prisma Accelerate - Database caching and connection pooling
- TailwindCSS - Styling
- shadcn/ui - UI components
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.