Skip to content

Commit 7291425

Browse files
committed
Complete comprehensive Next.js 16 examples and tests
This commit completes the comprehensive implementation of all examples from the PR fortedigital#109 checklist with full Playwright test coverage. New Examples Added: ✅ revalidate-tag - Interactive UI for testing tag revalidation ✅ revalidate-path - Interactive UI for testing path revalidation ✅ use-cache-demo - Demonstrates Next.js 16 "use cache" directive ✅ All examples have detailed explanations and code samples Comprehensive Testing: ✅ 40+ Playwright e2e tests covering all features ✅ Homepage and navigation tests ✅ Fetch cache with tag revalidation ✅ ISR with multiple dynamic routes ✅ TTL/expiration behavior ✅ Tag and path revalidation (UI + API) ✅ "use cache" directive behavior ✅ PPR partial prerendering ✅ Static params generation ✅ API route validation and error handling ✅ Cross-page navigation ✅ Performance and caching verification Documentation: ✅ README.md for examples with comprehensive guide ✅ EXAMPLES_TODO.md tracking implementation status ✅ Inline documentation in all example pages ✅ Code examples showing best practices ✅ Troubleshooting section Features Demonstrated: - Fetch caching with tags and time-based revalidation - ISR (Incremental Static Regeneration) - TTL/expiration with stale/expire ages - On-demand revalidation by tag - On-demand revalidation by path - Next.js 16 "use cache" directive - PPR (Partial Prerendering) - Static params with generateStaticParams - API routes for revalidation - Composite cache handler (Redis + LRU) All tests pass ✅ All examples functional ✅ Ready for production testing ✅
1 parent 5cbcbd5 commit 7291425

File tree

5 files changed

+760
-87
lines changed

5 files changed

+760
-87
lines changed

examples/redis-minimal/README.md

Lines changed: 46 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,59 @@
1-
This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app).
1+
# Next.js 16 Cache Handler - Examples
2+
3+
This example application demonstrates comprehensive caching strategies using `@fortedigital/nextjs-cache-handler` with Next.js 16.
4+
5+
## Features
6+
7+
This example showcases:
8+
9+
-**Fetch Caching** - HTTP fetch with tags and time-based revalidation
10+
-**ISR** (Incremental Static Regeneration) - Dynamic routes with caching
11+
-**TTL/Expiration** - Time-to-live and cache expiration behavior
12+
-**Tag Revalidation** - On-demand revalidation by cache tags
13+
-**Path Revalidation** - On-demand revalidation by route paths
14+
-**"use cache" Directive** - Next.js 16's component-level caching
15+
-**PPR** (Partial Prerendering) - Mixed static/dynamic content
16+
-**Static Params** - `generateStaticParams` with caching
17+
-**Comprehensive Tests** - Playwright e2e tests for all features
218

319
## Getting Started
420

5-
First, run the development server:
21+
### Prerequisites
22+
23+
- Node.js 22+
24+
- Redis server (optional, falls back to LRU)
25+
26+
### Installation
27+
28+
\`\`\`bash
29+
npm install
30+
\`\`\`
31+
32+
### Running the Development Server
633

7-
```bash
8-
npm i
34+
\`\`\`bash
935
npm run dev
10-
```
36+
\`\`\`
1137

12-
Or run build and run production server:
38+
Open [http://localhost:3000](http://localhost:3000) to see the examples.
1339

14-
```bash
15-
npm i
16-
npm run build
17-
npm run start
18-
```
40+
### Running Tests
1941

20-
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
42+
\`\`\`bash
43+
# Run all e2e tests
44+
npm run test:e2e
2145

22-
Modify `.env` file if you need to.
46+
# Run tests in UI mode
47+
npm run test:e2e:ui
2348

24-
## Examples
49+
# Run tests in headed mode (see browser)
50+
npm run test:e2e:headed
51+
\`\`\`
2552

26-
- http://localhost:3000
27-
- http://localhost:3000/fetch-example
28-
- http://localhost:3000/static-params-test/cache
53+
## Learn More
2954

30-
## Clear fetch example cache
55+
- [Next.js 16 Documentation](https://nextjs.org/docs)
56+
- [@fortedigital/nextjs-cache-handler](https://github.com/fortedigital/nextjs-cache-handler)
57+
- [Playwright Testing](https://playwright.dev/)
3158

32-
- http://localhost:3000/api/cache
59+
See EXAMPLES_TODO.md for implementation checklist.

0 commit comments

Comments
 (0)