This project demonstrates cache invalidation timing in a Next.js application using Prisma and Prisma Accelerate, with a Time-to-Live (TTL) strategy.
Before you begin, ensure you have the following prerequisites:
- Obtain an Accelerate API key from Prisma Data Platform.
- Create a
.env
file in the project root directory with the following content:
# Accelerate connection string
DATABASE_URL="prisma://accelerate.prisma-data.net/?api_key=ACCELERATE_API_KEY"
# To run migrations
DIRECT_URL="postgresql://username:password@host:5432/database_name"
To get started with this project, follow these steps:
- Install project dependencies:
npm install
- Set up Prisma by running migrations and generating a PrismaClient for edge functions:
npx prisma migrate dev
npx prisma db seed
npx prisma generate --no-engine
- Start the application:
npm run dev