On demand revalidation for next.JS

Hello,

I have a project i’m working on with a friend that’s hosted on netlify. This is the first web project we’ve ever worked on so if i seem to be asking pretty dumb questions, please bear through it. I think i’m really out of my depth here.

Now onto my issue.To start, I believe we are using the nextJS framework since the build runtime says “nextjs”. I am trying to implement on-demand revalidation. I saw that netlify updated their nextJS adapter thus allowing this functionality. However, i cannot seem to find the documentation regarding how to actually implement it. Before this, i was able to just follow the nextJS docs to implement things like getStaticProps but since the project layout specified by the nextJS documentation for how to implement on-demand revalidation differs from my current project’s layout, i’m at a lost as to what to do.

  1. The Next.js documentation assumes API routes are located in either /pages/api or /app/api
  2. Our project structure places APIs in /netlify/functions
  3. Some solutions mention using cache tags, but their relationship to our setup isn’t immediately clear and i’m struggling ot understand how it all fits together

The following image is just a picture of the layout of my project. I believe the use of the “pages” directory suggests that my frontent makes use of the nextJS page router but evidently we do not have a /api directory in it.

If anyone could point me in the right direction, i’d be really greatful. Been stuck on this for the last 2 days now and it’s becoming very apparent to me that i don’t actually understand how the structure of the netlify project relates to what is and isn’t allowed (ie, does my serverless functions have access to the nextJS framework?).

This is more of a Next.js question than Netlify. Did you try asking on Next.js forums? The docs for on demand ISR are here: Data Fetching: Incremental Static Regeneration (ISR) | Next.js, make sure you’re seeing the docs for Pages Router: