npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@flightdev/adapter-cloudflare

v0.0.7

Published

Cloudflare adapter for Flight Framework - deploy to Workers/Pages

Readme

@flightdev/adapter-cloudflare

Cloudflare Workers and Pages deployment adapter for Flight Framework. Deploy to 300+ edge locations worldwide.

Table of Contents


Installation

npm install @flightdev/adapter-cloudflare

Quick Start

// flight.config.ts
import { defineConfig } from '@flightdev/core';
import cloudflare from '@flightdev/adapter-cloudflare';

export default defineConfig({
    adapter: cloudflare(),
});

Deploy:

npm run build
wrangler pages deploy .cloudflare

Configuration

cloudflare({
    // 'pages' or 'workers'
    mode: 'pages',
    
    // Routes configuration
    routes: {
        include: ['/*'],
        exclude: ['/static/*', '/assets/*'],
    },
    
    // Compatibility settings
    compatibility_date: '2024-01-01',
    compatibility_flags: ['nodejs_compat'],
    
    // Workers-specific
    minify: true,
});

Cloudflare Pages

Pages is recommended for most apps. It provides:

  • Automatic static asset hosting
  • Git-connected deployments
  • Preview deployments for PRs
cloudflare({
    mode: 'pages',
});

Build Output

.cloudflare/
├── _worker.js           # Edge worker
├── _routes.json         # Route configuration
└── static/              # Static assets
    ├── assets/
    └── index.html

Deploy

wrangler pages deploy .cloudflare

Cloudflare Workers

For more control or specific Workers features:

cloudflare({
    mode: 'workers',
});

wrangler.toml

name = "my-flight-app"
main = ".cloudflare/worker.js"
compatibility_date = "2024-01-01"
compatibility_flags = ["nodejs_compat"]

[site]
bucket = ".cloudflare/static"

Deploy

wrangler deploy

Bindings

Access Cloudflare bindings (KV, D1, R2, etc.) in your routes:

KV Namespace

// src/routes/api/cache.get.ts
export async function GET({ platform }) {
    const kv = platform.env.MY_KV;
    
    const value = await kv.get('key');
    return Response.json({ value });
}

export async function PUT({ platform, request }) {
    const kv = platform.env.MY_KV;
    const { key, value } = await request.json();
    
    await kv.put(key, value);
    return Response.json({ success: true });
}

D1 Database

// src/routes/api/users.get.ts
export async function GET({ platform }) {
    const db = platform.env.MY_D1;
    
    const { results } = await db.prepare(
        'SELECT * FROM users LIMIT 10'
    ).all();
    
    return Response.json(results);
}

R2 Storage

// src/routes/api/files/[key].get.ts
export async function GET({ platform, params }) {
    const bucket = platform.env.MY_R2;
    
    const object = await bucket.get(params.key);
    if (!object) {
        return new Response('Not found', { status: 404 });
    }
    
    return new Response(object.body, {
        headers: { 'Content-Type': object.httpMetadata.contentType },
    });
}

Durable Objects

// src/routes/api/counter.ts
export async function GET({ platform, request }) {
    const id = platform.env.COUNTER.idFromName('global');
    const stub = platform.env.COUNTER.get(id);
    
    return stub.fetch(request);
}

Configure Bindings

In wrangler.toml:

[[kv_namespaces]]
binding = "MY_KV"
id = "abc123"

[[d1_databases]]
binding = "MY_D1"
database_name = "my-database"
database_id = "def456"

[[r2_buckets]]
binding = "MY_R2"
bucket_name = "my-bucket"

Build Output

Pages Mode

.cloudflare/
├── _worker.js           # Edge worker
├── _routes.json         # Route config
└── static/

Workers Mode

.cloudflare/
├── worker.js            # Bundled worker
└── static/              # Static assets

Deployment

Wrangler CLI

# Install Wrangler
npm install -g wrangler

# Login
wrangler login

# Deploy Pages
wrangler pages deploy .cloudflare

# Deploy Workers
wrangler deploy

Git Integration

Connect your repository in the Cloudflare dashboard for automatic deployments.


API Reference

Adapter Options

| Option | Type | Default | Description | |--------|------|---------|-------------| | mode | string | 'pages' | Deployment mode | | routes.include | string[] | ['/*'] | Included routes | | routes.exclude | string[] | [] | Excluded routes | | compatibility_date | string | latest | Compat date | | compatibility_flags | string[] | [] | Compat flags | | minify | boolean | true | Minify output |


License

MIT