miniflare
workers-chat-demo
Our great sponsors
miniflare | workers-chat-demo | |
---|---|---|
19 | 6 | |
3,667 | 791 | |
0.7% | 3.5% | |
7.2 | 4.2 | |
about 1 month ago | about 1 month ago | |
TypeScript | JavaScript | |
MIT License | BSD 3-clause "New" or "Revised" License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
miniflare
- [AskJS] Has anybody implemented and compiled ServiceWorker specification to a standalone executable?
-
A better way to set up a Cloudflare worker project locally with Miniflare
Recently Cloudflare introduces Miniflare. As its name suggests, Miniflare is a feature-rich but miniature version of Cloudflare worker. Miniflare is a simulator that provides an environment for developing and testing Cloudflare worker scripts locally. Miniflare is written in typescript and supports most of the Cloudflare worker features like the KV database, durable objects, WebSockets, etc.
-
[AskJS] Is there an JavaScript engine agnostic server module that can be imported into Bun, QuickJS, Deno, and Node.js?
Another implementation of the above is Cloudfare workers you might be capable of grasp some ideas from here https://miniflare.dev
- Ask HN: What cloud provider are you using for new projects?
-
Workerd: The Open Source Cloudflare Workers Runtime
Is there an ETA on Miniflare v3? Ran into a problem recently using overlapping keys with forward slashes as they were not sanitized properly: https://github.com/cloudflare/miniflare/issues/167
-
Part 2: KV store
The KV API is only available on Cloudflare Workers. But, during development, Rakkas runs our app on Node.js. Fortunately, the Miniflare project has a KV implementation for Node. The other two packages that we've installed (@miniflare/kv and @miniflare/storage-memory) are what we need to be able to use the KV API during development. Let's create a src/kv-mock.ts file and create a local KV store to store our ublog posts ("twits") while testing:
-
Web Workers are the Future! 🏗
I used hono (a wrapper around miniflare) to handle some of the boilerplate around request and routing logic. It's also refreshingly fast! 🔥
-
Deploy a GitHub Application to Cloudflare Workers
The simple explanation is that I'm proposing use of the Service Worker API. Cloudflare offers a flat, free, 100k requests a day if you can keep it cutting edge, has local development and testing options with miniflare and a key/value (KV) store.
-
Serverless Remix Sessions with Cloudflare Pages
When we run the dev script, this will ensure that the local runtime environment Miniflare will bind a KV with the name sessionStorage to our Pages function.
-
Show HN: Slshx – React-Inspired Discord Commands on Cloudflare Workers
Slshx is a library for building strongly-typed Discord commands (https://discord.com/developers/docs/interactions/application...) that run on Cloudflare Workers (https://workers.cloudflare.com/), using a React-inspired syntax (hooks and JSX). It supports all Discord command types/options, autocomplete and interactive message components. During development, it automatically deploys your commands whenever you change your code.
I created this because I think Cloudflare Workers are a great fit for hosting Discord commands, but there wasn't an easy way to get started that had a fun development experience. I also wanted to see what a Miniflare-first (https://github.com/cloudflare/miniflare) library could look like.
workers-chat-demo
-
asyncio + multiprocessing. Issues with pickling complex python objects.
This idea was also sparked from cloudflares chat room example using something on their platform the call durable objects. But instead of offloading each chat room to a durable object I wanted to try to offload it to a process.
-
When Serverless really shines (and when to avoid it)
If you want to see a code example of a stateful serverless worker, this durable object chat demo is kinda neat: https://github.com/cloudflare/workers-chat-demo
-
Ask HN: What's a global, low throughput, low latency message bus
If you wanted something where you could get pretty far without spending any money, Cloudflare Workers + Durable Objects would be an interesting path. You would have to implement some of the functionality yourself, but there are some examples.
Like this example chat app: https://github.com/cloudflare/workers-chat-demo/blob/master/... It supports private chat rooms, which is somewhat analogous to a pub sub topic.
- OAuth with Cloudflare Workers on a Statically Generated Site
-
Cloudflare’s Pace of Innovation
Durable Objects[0] let you store data on the edge and provide a lot more than a key/value store. This is a primitive you could build arbitrary databases on top of.
The edge chat demo[1] is a working, scalable real-time chat service hosted entirely on the edge using Workers + Durable Objects, even featuring per-user cross-room rate limiting. As written, it can support millions of chat rooms and users, and it's about 500 lines of code.[2]
The benefit here is that it's much easier to build scalable distributed systems on Workers and Durable Objects than on other platforms. The fact that they run on the edge as close to end users as possible is just a bonus.
[0] https://blog.cloudflare.com/introducing-workers-durable-obje...
[1] https://edge-chat-demo.cloudflareworkers.com/
[2] https://github.com/cloudflare/workers-chat-demo/blob/master/...
(Disclosure: I'm the tech lead for Cloudflare Workers.)
-
DoS Attacks against my Online Game
Have you looked into using a serverless pub/sub model, like Cloudflare's Workers KV? The example they give is a simple IRC-like distributed chatroom (https://github.com/cloudflare/workers-chat-demo), but theoretically it may work for games too.
Player state can be stored in a decentralized key-value store that Cloudflare manages. They absorb all the DDoS and handle replication between edge nodes. You don't see any of that. https://www.cloudflare.com/products/workers-kv/
Or maybe it was their Durable Objects product... I forget how that's different from Workers KV: https://developers.cloudflare.com/workers/learning/using-dur...
Then each game client uses a worker to access that KV, and Cloudflare will route that worker to its nearest edge node and retrieve the state from there (which was previously replicated a moment ago, internal to Cloudflare's infrastructure).
https://workers.cloudflare.com/
I don't know if this would result in acceptable latency, but it could help with DDOS at least.
What are some alternatives?
wrangler-legacy - 🤠 Home to Wrangler v1 (deprecated)
quilkin - Quilkin is a non-transparent UDP proxy specifically designed for use with large scale multiplayer dedicated game server deployments, to ensure security, access control, telemetry data, metrics and more.
krustlet - Kubernetes Rust Kubelet
hono - Fast, Lightweight, Web-standards
e2core - Server for sandboxed third-party plugins, powered by WebAssembly
cloudflare-worker-github-app-example - A Cloudflare Worker + GitHub App Example
Sprocket
relay-starter-kit - 💥 Monorepo template (seed project) pre-configured with GraphQL API, PostgreSQL, React, and Joy UI. [Moved to: https://github.com/kriasoft/graphql-starter-kit]
awesome-paas - A curated list of PaaS, developer platforms, Self hosted PaaS, Cloud IDEs and ADNs.
examples - Serverless Examples – A collection of boilerplates and examples of serverless architectures built with the Serverless Framework on AWS Lambda, Microsoft Azure, Google Cloud Functions, and more.