Reusable Functions for Pages Apps
When Cloudflare Pages added Functions in open beta last November, it became a full-stack platform. Developers dropped /functions folders into projects to add dynamic behavior next to static assets, using file-based routing instead of hand-written routers. But as usage patterns emerged from the beta period, a recurring theme appeared: many apps share the same functionalities—authorization checks, API setup, error reporting, third-party integrations for performance tracking. Rather than making every developer wire these up from scratch, the platform can ship the ready-made logic and let developers mount it onto their existing projects.
That is the idea behind Pages Plugins: a reusable, customizable chunk of runtime code that can be inserted anywhere in a Pages application. In effect, a Plugin is a composable Pages Function. That means mounting a Plugin gives it the full scope of Functions (and by extension Workers) — middleware, parameterized routes, static assets included.
How Plugins Are Mounted
Continuing the file-based routing approach of Functions, installing a Plugin is similar to adding any npm module. A Plugin is installed, imported, and invoked like a standard package. The configuration is passed in as arguments, and the Plugin is attached as an onRequest export at the route where it belongs — commonly the top-level middleware so every incoming request gets handled. One example of this pattern with a hypothetical package:
With Plugins, the setup to add (hypothetically) an @acme/pages-plugin-logger boils down to importing the module, invoking it with your required configuration, and mounting it where it applies. The code sample below shows the full wiring:
// file: /functions/_middleware.ts
import MyLogger from "@acme/pages-plugin-logger";
// Setup logging for all URL routes & methods
export const onRequest = MyLogger({
endpoint: "https://logs.acme.com/new",
secret: "password",
});
Launch Partners
Three official partners are launching alongside the Plugin mechanism, each covering a distinct need across application monitoring and authentication.
Sentry offers an application monitoring Plugin that automatically captures exceptions raised in your Pages Functions and forwards them to Sentry. There, developers can aggregate, analyze, and triage errors with context — the code path, commit, or API call associated with the failure.
// ./functions/_middleware.ts
import sentryPlugin from "@cloudflare/pages-plugin-sentry";
export const onRequest = sentryPlugin({
dsn: "YOUR_SENTRY_DSN",
});
Honeycomb takes an observability approach, creating a trace for every request your Pages application receives and sending the data to Honeycomb for visualization and analysis of application quality and performance patterns.
// ./functions/_middleware.ts
import honeycombPlugin from "@cloudflare/pages-plugin-honeycomb";
export const onRequest = honeycombPlugin({
apiKey: "YOUR_HONEYCOMB_API_KEY",
dataset: "YOUR_HONEYCOMB_DATASET_NAME",
});
Stytch covers passwordless authentication. Its Plugin validates user sessions transparently so developers can protect sections of their application behind a Stytch login without writing session logic by hand.
// ./functions/_middleware.ts
import stytchPlugin from "@cloudflare/pages-plugin-stytch";
import { envs } from "@cloudflare/pages-plugin-stytch/api";
export const onRequest = stytchPlugin({
project_id: "YOUR_STYTCH_PROJECT_ID",
secret: "YOUR_STYTCH_PROJECT_SECRET",
env: envs.live
});
The ecosystem isn't limited to official partners. Developers can publish custom Plugins to npm or register them on the Community Plugins page through a pull request, making integrations available to any Pages user.
Additional Plugins From Cloudflare
Beyond third-party partners, Cloudflare is shipping a set of first-party Plugins to cover common needs:
- Google Chat — creates a Google Chat bot that responds to messages. It includes an API for non-interactive calls, such as alerting, without user input.
- Cloudflare Access — validates Cloudflare Access JWT assertions as middleware and exposes an API for looking up additional details from a user's JSON Web Token.
- Static forms — intercepts static HTML form submissions, so data can be stored to KV or further processed rather than lost on a static POST.
- GraphQL — generates a GraphQL API from a given schema and ships with GraphQL Playground for development and testing.
Authoring and Sharing
The design intent for Plugins is authoring simplicity; anyone can create one, package it, and distribute it on npm. The official documentation walks through creating and sharing Plugins. Developers are invited to contribute to the Community Plugins page by opening a PR, so other Pages users can discover new Plugins for their own deployments.
What Follows for Functions
Functions is still in open beta, and several features are in the near-term path. Analytics and logging are planned to arrive as Functions heads toward general availability, giving developers visibility into site performance and troubleshooting. Bindings for R2 — now in open beta — and D1 are expected for full-stack Pages projects. Until GA, Pages remains at 100k requests per day for free, with the future paid model expected to mirror the Workers Paid pricing structure.
Feedback and discussion take place in the Cloudflare Developers Discord in the #pages-plugins channel.



