Cloudflare Functions Plugin
Integrate serverless Cloudflare Workers/Functions with your 11ty website powered by Standard Framework.
What’s Included
The Cloudflare Functions plugin provides basic integration for serverless functions with your 11ty project:
- Plugin – Seamless 11ty integration
- Configuration Template – Basic
wrangler.tomlgeneration - Simplified API Endpoints – Basic
comments.jsandcontact.jsexamples
Quick Start
1. Install
npm install @zefish/standard
2. Add to eleventy.config.js
import CloudflarePlugin from "@zefish/standard/cloudflare";
export default function (eleventyConfig) {
eleventyConfig.addPlugin(CloudflarePlugin, {
outputDir: "functions",
environment: "production",
});
}
3. Create Your First Function
// functions/hello.js
export default {
async fetch(request) {
return new Response("Hello from Cloudflare Function!");
},
};
4. Deploy
npm run build
wrangler publish
Systems & Plugins
Core Plugin
- Cloudflare Functions Plugin – Main serverless integration
Simplified API Endpoints
- Comments API – A simplified example of a comments API endpoint.
- Contact API – A simplified example of a contact form API endpoint.
Documentation
- Getting Started – Installation and setup
- Usage Patterns – Common use cases
- Examples – Real-world examples
- Deployment – How to deploy
Features
✅ Automatic function copying to build output
✅ Environment variables support
✅ Global data available in templates
✅ Cloudflare configuration template
Integration with Standard Framework
Works seamlessly with the full Standard Framework:
import Standard from "@zefish/standard";
import CloudflarePlugin from "@zefish/standard/cloudflare";
export default function (eleventyConfig) {
// Typography & styling framework
eleventyConfig.addPlugin(Standard);
// Serverless functions
eleventyConfig.addPlugin(CloudflarePlugin);
}
Next Steps
Version
Cloudflare Functions Plugin v0.10.52
Part of Standard Framework
Ready to add serverless to your 11ty site? Get started now