Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/garrettpeake/pioche
A fully typed framework turning less work into better Cloudflare Workers
https://github.com/garrettpeake/pioche
cloudflare cloudflare-workers framework serverless workers workers-kv
Last synced: 3 months ago
JSON representation
A fully typed framework turning less work into better Cloudflare Workers
- Host: GitHub
- URL: https://github.com/garrettpeake/pioche
- Owner: GarrettPeake
- License: mit
- Created: 2022-03-16T19:10:13.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2022-06-05T21:57:40.000Z (over 2 years ago)
- Last Synced: 2024-11-06T04:40:43.198Z (3 months ago)
- Topics: cloudflare, cloudflare-workers, framework, serverless, workers, workers-kv
- Language: TypeScript
- Homepage:
- Size: 388 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
**PIOCHE IS IN ALPHA AND SHOULD NOT BE USED IN PRODUCTION**
TypeScript first framework for Cloudflare Workers enabling β‘lightningβ‘ fast development and execution
Note: To use Durable Objects and Websockets features of Pioche, you need a Cloudflare account with [Durable Objects access](https://developers.cloudflare.com/workers/learning/using-durable-objects/#using-durable-objects-1)
## β Features
- [x] Short development time
- [x] Decorator-based path-to-regexp router
- [x] Middleware support
- [x] Simplified, more powerful API for D/O Storage and KV
- [x] Simplified Worker -> D/O interaction
- [x] WebSocket handling
- [x] Minimized invokations and compute time
## π Tree Shakeable Batteries Available in [pioche-extras](https://github.com/GarrettPeake/pioche-extras)See the installation section of [pioche-extras](https://github.com/GarrettPeake/pioche-extras) for prebuilt OAuth, log streaming, and middleware to use in your project
## πΎ Installation
To get started use [pioche-scripts](https://github.com/GarrettPeake/pioche-scripts)
```
npx pioche-scripts create
```
This will setup an minimal project with a single TypeScript file: helloworld.ts
We can then make changes to functionality and run
```js
npm run build // Generate wrangler.toml and program entry point
npm run dev // Deploy to Cloudflare with remote debugging session
npm run serve // Run locally, debug locally
npm run deploy // Deploy to Cloudflare
```
After `npm run deploy` you should see `.workers.dev` gives `Hello, World!`## π Background and why Pioche Exists
Cloudflare (CF) workers platform has 3 major offerings:
1. **Workers**: A serverless javascript environment for short lived code. There can be many of the same worker script executing globally at the same time
2. **Durable Objects (D/O)**: A serverless javascript environment for long lived code or code which requires transactional storage. There can only be one of a D/O script globally at the same time.
3. **Workers KV (KV)**: A non-transactional distributed key-value store
Workers are web-facing, D/Os are Workers-facing, KV Workers and D/O-facing.
**Problem**: There is a cumbersome dispatch process to call a D/O from a worker.D/Os have an in-memory key value store (D/O storage)
**Problem**: This store has very similar capabilities but use a separate API from KV.CPU time is charged per GB-sec, storage operations are charged per kB transferred, and Workers and D/Os are charged per invokation.
**Problem**: We want to only use D/Os when necessary and minimize CPU time and invokations.**Problem**: There is no routing functionality
These 4 issues alone greatly increase upstart development time and complexity because orchestrating routing between services and resource management while minimizing cost is a huge task that developers shouldn't need to handle.
## People
Pioche was created by [Garrett Peake](https://github.com/GarrettPeake)
## License
[MIT](https://github.com/GarrettPeake/pioche/blob/master/LICENSE)