nitrojs / nitrojs/nitro

on-demand cache revalidation/incremental static genration

Open
#889 14 comments 32 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

discussion enhancement v2
Dominant language
TypeScript
Stars
11.2k
Forks
899
Avg merge
2d 24m
Merged PRs (30d)
40

Description

Describe the feature

Hi!
The feature is to add a global function revalidate which can be called with path argument to revalidate the cache of a specific path. Ex: Initially route have {static:true} and in API route we can do revalidate('/blog'), revalidate('/blog/posts/1').

It will be useful for CMS and can be used with webhook to see instant changes.

This feature can further be extended in nuxt for on-demand incremental static generation.

This can be further simplified by providing a default route /__nuxt/revalidate/ or '__nitro/revalidate' with path='...' to revalidate the route. Of course, user can add middleware to secure the route to verify the request is coming from CMS.

Additional information
  • Would you be willing to help implement this feature?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the existing API route handling and static-generation cache behavior. Compare the proposed global revalidate(path) function with the optional /__nuxt/revalidate or /__nitro/revalidate route. Done means a specified path can be revalidated on demand, including from a secured CMS webhook.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api, backend, performance
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.