Skip to content

Repository files navigation

EdgeKit.js

EdgeKit.js is a toolkit to helps you build on top of Cloudflare Development Platform with ease.

Features

  • Global environment access
  • Key-Value Store
  • Server-side Cache with TTL
  • File Storage
  • Database
  • Background Jobs
  • Scheduled Tasks
  • Browser Rendering
  • Rate Limiting
  • And more things!

Usage

Create a new Edge-first app using EdgeKit.js with the following command:

npx degit edgefirst-dev/starter my-app

This will give you a new Cloudflare Worker project with EdgeKit.js already setup and React Router v7.

Manual Setup

Install the toolkit:

bun add edgekitjs

In your Cloudflare Worker, call the bootstrap function and export it.

importschemafrom"db:schema";// Import your Drizzle schemaimport{bootstrap}from"edgekitjs/worker";exportdefaultbootstrap({orm: { schema },rateLimit: {limit: 1000,period: 60},jobs(){// Register your jobs herereturn[];},tasks(){// Schedule your tasks herereturn[];}asynconRequest(request){// Inside this function you can use all the functions provided by EdgeKit.jsreturnnewResponse("Hello, World!",{status: 200});},});declare module "edgekitjs"{exportinterfaceEnvironment{// Add your custom env variables or bindings here}// Override the default DatabaseSchema with your owntypeSchema=typeofschema;exportinterfaceDatabaseSchemaextendsSchema{}}

Now you can import the functions from edgekitjs and use it in any part of your Edge-first app.

Author

About

EdgeKit.js is a toolkit to helps you build on top of Cloudflare Development Platform with ease

Resources

Contributing

Stars

71 stars

Watchers

1 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages

Generated from sergiodxa/package