All Projects → AggressivelyMeows → cfw-easy-utils

AggressivelyMeows / cfw-easy-utils

Licence: MIT license
An in-depth library to assist with common tasks with CF Workers. Includes utils for responses, cookies, and more!

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to cfw-easy-utils

inkrss
Notify when rss feeds are updated | RSS 更新通知
Stars: ✭ 234 (+350%)
Mutual labels:  cloudflare, cloudflare-workers
workers-graphql-gateway-example
GraphQL running on Cloudflare Workers
Stars: ✭ 68 (+30.77%)
Mutual labels:  cloudflare, cloudflare-workers
wrangler2
🤠 wrangle your Cloudflare Workers
Stars: ✭ 349 (+571.15%)
Mutual labels:  cloudflare, cloudflare-workers
telegram-bot-api-worker
Take an alternate route to Telegram Bot API :)
Stars: ✭ 75 (+44.23%)
Mutual labels:  cloudflare, cloudflare-workers
DNS-over-Discord
A 1.1.1.1 DNS resolver built for Discord
Stars: ✭ 228 (+338.46%)
Mutual labels:  cloudflare, cloudflare-workers
relay-starter-kit
💥 Monorepo template (seed project) pre-configured with GraphQL API, PostgreSQL, React, Relay, Material UI.
Stars: ✭ 3,513 (+6655.77%)
Mutual labels:  cloudflare, cloudflare-workers
cloudflare-worker-graphql-ws-template
A template for WebSockets powered Cloudflare Worker project using graphql-ws
Stars: ✭ 21 (-59.62%)
Mutual labels:  cloudflare, cloudflare-workers
terraform-cloudflare-maintenance
Terraform module to create a responsive Maintenance Page using Cloudflare Workers.
Stars: ✭ 111 (+113.46%)
Mutual labels:  cloudflare, cloudflare-workers
cloudflare-worker-router
A super lightweight router (1.3K) with middleware support and ZERO dependencies for CloudFlare Workers.
Stars: ✭ 144 (+176.92%)
Mutual labels:  cloudflare, cloudflare-workers
Graphql Starter
💥 Monorepo template (seed project) pre-configured with GraphQL API, PostgreSQL, React, Relay, and Material UI.
Stars: ✭ 3,377 (+6394.23%)
Mutual labels:  cloudflare, cloudflare-workers
natural
Fastest Framework for NodeJS. Written in pure ES6+
Stars: ✭ 30 (-42.31%)
Mutual labels:  cloudflare, cloudflare-workers
IPFS PHOTO SHARE
💰用甚嚒服务器,ServerLess搭建一个图片分享站点!| 基于CloudFlareWorker无服务器函数和IPFS去中心化存储的图片分享网站
Stars: ✭ 76 (+46.15%)
Mutual labels:  cloudflare, cloudflare-workers
miniflare
🔥 Fully-local simulator for Cloudflare Workers
Stars: ✭ 2,811 (+5305.77%)
Mutual labels:  cloudflare, cloudflare-workers
supaflare
URL shortener / redirection service powered by Supabase, Cloudflare Workers, Workers KV and Cloudflare Pages.
Stars: ✭ 51 (-1.92%)
Mutual labels:  cloudflare, cloudflare-workers
workers-jwt
Generate JWTs on Cloudflare Workers using the WebCrypto API
Stars: ✭ 67 (+28.85%)
Mutual labels:  cloudflare, cloudflare-workers
cfworker-middware-telegraf
Make telegraf (a telegram bot framework) useable in Cloudflare Workers
Stars: ✭ 23 (-55.77%)
Mutual labels:  cloudflare, cloudflare-workers
worker-auth-providers
worker-auth-providers is an open-source providers to make authentication easy with workers. Very lightweight script which doesn't need a lot of dependencies. Plug it with any framework or template of workers.
Stars: ✭ 85 (+63.46%)
Mutual labels:  cloudflare, cloudflare-workers
faaskit
A lightweight middleware framework for functions as a service
Stars: ✭ 24 (-53.85%)
Mutual labels:  cloudflare, cloudflare-workers
workers-unsplash-api
Serverless API for requesting images from Unsplash's API, designed for use with a React frontend
Stars: ✭ 20 (-61.54%)
Mutual labels:  cloudflare, cloudflare-workers
slshx
⚔️ Strongly-typed Discord commands on Cloudflare Workers
Stars: ✭ 163 (+213.46%)
Mutual labels:  cloudflare, cloudflare-workers

🦄 CF Workers: easy-utils

A library designed to make writing workers so much cleaner and easier!

Welcome to easy-utils, this library is designed to make writing Workers easy as heck. Included in this package is a bunch of helpers for responses, profiling, handling cookies, and serving any static assets. Now with full Websocket support!

Turn your Worker code from spaghetti hell to majestic artwork today with easy-utils.

Documentation:

https://easy-utils.docs.ceru.dev/docs/

🔧 Install

npm i cfw-easy-utils

Note: this lib has tree-shaking enabled by default. Only import what you need and you will keep your package size low!

Examples

🔨 No more JSON.stringify!

Stuck having to copy paste the same 4 lines of code just to return a simple JSON object? Now you can easily return any JSON-compatible object/array without having to worry about your code getting complex.

return response.json({ 'hello': 'world!' })

🎨 Cache S3 buckets & more!

Want to save money on your bill? Cache your assets on the edge and speed up your images. All of Cloudflare's caching power in a single line of code.

return response.static(request, { baseUrl: 'https://yourbucket.net' })

🔌 Go realtime with Websockets!

Support Websockets at the edge with our util library. Get access to a full Websocket client and server for your every need.

import { response, Websocket, WebsocketResponse } from 'cfw-easy-utils'

var ws = new Websocket('ws://echo.websocket.org') // Client
var resp = new WebsocketResponse() // Server

ws.on('message', (msg) => {
    resp.send(msg)
})

resp.on('message', (msg) => {
    ws.send(msg)
})

return response.websocket(resp)

🍃 Handle CORS with a breeze!

CORS can be so cumbersome and annoying. Let easy-utils handle it for you so you can focus on your Worker's real purpose.

if (request.method == 'OPTIONS') {
    return response.cors()
}

// autoCors is true by default, but we want to show it off.
return response.json({ hello: 'World' }, { autoCors: true })

Time your I/O to reduce slowdowns.

Record your times to watch for any slow I/O events. Will only count I/O as Workers cannot count CPU time internally. All you need to do is mark some times, then set the Stopwatch option on any of easy-utils response handler and it will set the Server-Timing header for you. Look in the Timing header of your modern browser to view the timings.

import { Stopwatch } from 'cfw-easy-utils'

const watch = new Stopwatch()
const value = await KVNAMESPACE.get('somekey')
watch.mark('Got KV response')
return response.json({ kv: value }, { stopwatch: watch })

😄 Generate user accounts on the edge

Want to take your user experience to the next level? You can generate password hashes and UUID's direct in your Worker.

import { response, secrets } from 'cfw-easy-utils'

// Later, use secrets.verifyPassword to verify someone's identity.
return response.json({
    id: secrets.uuidv4(),
    passwordHash: await secrets.hashPassword('passw0rd01')
})

🦄 This is only some of the examples of what you can do with cfw-easy-utils.

Made by Connor Vince with the help and love from the Cloudflare Worker's community. Thank you everyone!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].