Cloudflare Worker (v1.1.5) with CORS headers, JSON-LD structured data generation, Speculation Rules API, and HTML transformation features.
- ✅ CORS Headers - Universal cross-origin resource sharing for all responses
- ✅ JSON-LD Generation - Automatic schema.org Article structured data from page metadata
- ✅ Speculation Rules API - Near-instant navigation with prerender/prefetch
- ✅ Picture Placeholder Replacement - Optimized image loading patterns
- ✅ HTML Cleanup - Comment removal and metadata sanitization
- ✅ Comprehensive Testing - 83 unit tests + 23 integration tests
# Install dependencies (in cloudflare/files/)
cd cloudflare/files && npm install
# Run unit tests
npm test
# Run integration tests
# Open cloudflare/test.html in a browser
# Local development server
npm run debug # Starts server on port 3000
# Deploy to Cloudflare
npx wrangler deploycloudflare/
├── files/
│ ├── cloudflare-worker.js # Main worker (v1.1.5)
│ ├── cloudflare-worker.test.js # 83 unit tests
│ ├── test-local-html.js # Integration test runner
│ ├── package.json # Dependencies & version sync
│ ├── README.md # Feature documentation
│ ├── TESTING.md # Testing guide
│ └── SETUP.md # Deployment guide
├── two-file-testing-tutorial.md # Testing pattern tutorial ⭐
├── blog-post.md # Blog post about the project
├── cloudflare-worker-code-review.md # Architecture review
├── test.html # 23 integration tests
└── test-coverage-report.md # Coverage summary
docs/
└── for-ai/ # Development documentation
├── index.md # Navigation hub
└── document-relationship-mapping.md # Cross-reference guide
Note: The root package.json and index.ts are minimal placeholders. The actual worker code and dependencies are in cloudflare/files/.
cd cloudflare/files
npm test- 83 tests covering all transformations
- Pure function testing for JSON-LD, CORS, speculation rules
- Located in cloudflare/files/cloudflare-worker.test.js
- 23 HTML transformation tests in cloudflare/test.html
- Tests run automatically when page loads
- Production test page: https://allabout.network/cloudflare/test.html
Version is synchronized across 4 locations (enforced by git hooks):
cloudflare-worker.js:20- WORKER_VERSION constantcloudflare-worker.js:15- @version JSDoc commentcloudflare/files/package.json:3- version fieldcloudflare/test.html:395- footer display
Current version: v1.1.5
- Blog post: cloudflare/blog-post.md - Why this repository exists and what makes it different
- Two-file testing tutorial: cloudflare/two-file-testing-tutorial.md ⭐ Start here to learn the pattern
- Feature details: cloudflare/files/README.md
- Testing guide: cloudflare/files/TESTING.md
- Setup & deployment: cloudflare/files/SETUP.md
- Architecture review: cloudflare/cloudflare-worker-code-review.md
- Documentation index: docs/for-ai/index.md
- Cross-reference guide: docs/for-ai/document-relationship-mapping.md
Adds universal CORS headers to all responses:
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS
Access-Control-Allow-Headers: Content-Type
Automatically generates schema.org Article structured data from page metadata:
- Extracts:
og:title,og:description,og:url,og:image, author, dates - Supports 3 trigger mechanisms: clean metadata, legacy json-ld, existing JSON-LD
- Automatic date formatting (2-digit/4-digit years, month names)
Injects prerender/prefetch rules for near-instant navigation:
<script type="speculationrules">
{
"prerender": [{"where": {"href_matches": "/*"}, "eagerness": "moderate"}],
"prefetch": [{"where": {"href_matches": "/*"}, "eagerness": "moderate"}]
}
</script>While this project can use Bun for development, it's primarily Node.js-based for Cloudflare Worker compatibility. For Bun-specific patterns and guidelines, see CLAUDE.md.
- AI assistant configuration: .claude/ directory
- Development guidelines: CLAUDE.md
- Skill system: .claude/skills/
- Slash commands: .claude/commands/
The worker is currently deployed at:
- Production: https://allabout.network
- Test page: https://allabout.network/cloudflare/test.html
See LICENSE for details.