Tilda supports 100% of Next.js features without any additional changes to your Next.js projects, including advanced caching and revalidation capabilities.
You'll need to create a "Project" and a "Site" in Tilda dashboard before you can deploy your Next.js project. Use "slugs" for those values in the deployment command as shown in the Deployment section below.
Please follow the getting started with Tilda guide to understand how to begin.
Tilda provides edge-accelerated Partial Prerendering support for Next.js 15 canary and newer versions. This feature allows you to:
To enable edge-accelerated PPR for your Next.js application, add the --ppr
flag to your build command:
tilda build nextjs --ppr=15-canary-v1
After building with PPR enabled, deploy normally:
tilda deploy --project myproject --site mysite
To use PPR on Tilda, you need:
npm install -g @tildacloud/cli@latest
)Unlike standard PPR implementations that run entirely on the origin server, Tilda's edge-accelerated PPR:
This provides the same performance benefits as Next.js PPR on Vercel. For comprehensive information about PPR support, including architecture details and business benefits, see our Edge-Accelerated Next.js PPR blog post.
Next.js PPR is powered by Tilda's Progressive Rendering Format, which is an open specification that can be implemented by any web framework to achieve similar edge-accelerated rendering capabilities.
Deploying a Next.js project on Tilda is as simple as running the following commands:
tilda build nextjs
tilda deploy --project myproject --site mysite
Tilda fully supports Next.js's cache tags and revalidation features in the App Router and path-based revalidation in the Pages Router.
You can use cache tags with fetch requests:
export default async function ProductsPage() {
const products = await fetch('https://api.example.com/products', {
next: { tags: ['products'] } // Add cache tags to fetch request
})
const data = await products.json()
return <ProductList products={data} />
}
For more granular control, use the cacheTag
function:
import { unstable_cacheTag as cacheTag } from 'next/cache'
export async function getProducts() {
'use cache' // Enable caching for this function
cacheTag('products') // Tag this data for later invalidation
const products = await db.query('SELECT * FROM products')
products.forEach(product => {
cacheTag(`product-${product.id}`)
})
return products
}
Next.js provides several methods for cache invalidation, all fully supported by Tilda:
Use revalidateTag()
to invalidate content with specific cache tags:
import { revalidateTag } from 'next/cache'
export async function invalidateProducts() {
revalidateTag('products') // Invalidate all content tagged with 'products'
revalidateTag(`product-123`) // Invalidate a specific product
}
Use revalidatePath()
to invalidate cached content under specific paths:
import { revalidatePath } from 'next/cache'
export async function invalidateProductPages() {
revalidatePath('/products/123') // Invalidate a specific product page
revalidatePath('/products/[id]', 'layout') // Or invalidate all product pages
}
For Pages Router applications, use res.revalidate()
in API routes:
import type { NextApiRequest, NextApiResponse } from 'next'
export default async function handler(
req: NextApiRequest,
res: NextApiResponse
) {
try {
await res.revalidate('/products/123')
return res.json({ revalidated: true })
} catch (err) {
return res.status(500).send('Error revalidating')
}
}
You can also manage cache invalidation through the Tilda Dashboard, where you can monitor application performance and manually invalidate cache when needed.