- Download wrangler (a tool used for managing Cloudflare Workers project).
$ npm i @cloudflare/wrangler -g
- Download the project and navigate to the generated directory.
$ wrangler generate inventory https://github.com/sbmthakur/inventory
$ cd inventory
- Set your account_id in the wrangler.toml file. You will need a Cloudflare account to do this. Subsequently, you must authorize wrangler to perform actions on your account.
Wrangler login: https://developers.cloudflare.com/workers/cli-wrangler/commands#login
- Setup a KV namespace for your application.
$ wrangler kv:namespace create "kv" --preview
The preview option indicates that the namespace is being used for local development.
This will generate a kv_namespaces array that must be added to the wrangler.toml file.
- Initialize the development environment:
$ wrangler dev
This should start a local backend server. Note the port. (8787 by default)