Allow passing Next.js next.revalidate / next.tags fetch options through Eden treaty
What is the problem this feature would solve?
In Next.js, server components and server-side functions (like generateMetadata, generateStaticParams, and ISR pages) rely on the next option passed to fetch() for caching and revalidation:
fetch(url, { next: { revalidate: 3600 } })
Eden treaty's .get() / .post() methods wrap fetch internally and do not expose any way to pass these Next.js-specific fetch options. This means developers using Eden in a Next.js project are forced to either:
Use raw fetch alongside Eden, losing type safety and duplicating URLs. Skip ISR entirely and fetch on every request, hurting performance and SEO. This creates a gap where type-safe API calls and ISR caching cannot coexist.
What is the feature you are proposing to solve the problem?
Allow passing Next.js-specific fetch options through the Eden treaty method chain. For example:
const { data } = await backendAPI.videos({ id }).get({
fetch: { next: { revalidate: 3600 } }
})Or alternatively, allow setting default fetch options at the client level:
const api = treaty<App>(backendUrl, {
fetch: { next: { revalidate: 3600 } }
})The key idea is that any options passed under a fetch key (or merged directly) should be forwarded to the internal fetch() call, so that Next.js's patched global fetch can interpret next.revalidate, next.tags, cache, and other framework-specific options.
What alternatives have you considered?
No response
Source: elysiajs/elysia