Deploy
On this page, you'll learn how to deploy your Next.js app and rebuild your site when you update your content.
To deploy your app, follow the instructions for deploying Next.js with your chosen hosting provider:
- How to Deploy a Next.js Site - Vercel
This guide will show you how to deploy a Next.js site and get your domain set up.
- Add new site - Netlify
There are many ways to create a new site or app on Netlify.
- Hosting - Next.js - AWS Amplify
In this guide you'll learn how to deploy a Next.js app using Amplify Hosting.
Handle content changes
Your app needs to be notified or rebuilt when your content changes in Prismic. How you set up your app to handle content changes depends on which router your app uses.
Create a webhook
Add a Prismic webhook to clear the Next.js
fetch()
cache when your content changes in Prismic.Follow the Create a webhook instructions in our webhooks documentation using these values:
Field Value Name ”Display published content” URL Your app’s deployed URL + /api/revalidate
(e.ghttps://example.com/api/revalidate
).Triggers Only check “A document is published” and “A document is unpublished”. You do not need to set up a webhook with your hosting provider.
Create a
/api/revalidate
Route HandlerAdd the following
/api/revalidate
Route Handler to your Next.js app:app/api/revalidate/route.tsimport { NextResponse } from "next/server"; import { revalidateTag } from "next/cache"; export async function POST() { revalidateTag("prismic"); return NextResponse.json({ revalidated: true, now: Date.now(), }); }