Setup Working Environment for Developing Cloudflare Workers Apps

Image for post
Image for post

I know most of us just want to dive into development when we see new tool or framework. But then there is so many comebacks for things that we need to do at the beginning. In this post I will describe my working environment for development of Workers.

IDE (Integrated Development Environment)

I usually use Visual Studio Code. It has great extension library but you don’t need anything special for now. You can download it here.

Cloudflare Wrangler

Wrangler is a CLI tool designed for development of workers. Here is its homepage. And you can find GitHub page here.

Quick Installation of Wrangler

npm i @cloudflare/wrangler -g

That is for installation but you need to configure your environment for publishing. The configuration file is created in a .wrangler directory in your computer's home directory. You need to add account email and global API Key to this file.

email = "email[at]"

You can get your API Key from CF Dashboard. Go to Dashboard>Profile>API Tokens and get ‘ Global API Key’.

Image for post
Image for post

Generate From Template

After these quick installations and configurations you can generate your first workers app. I recommend to use template for understand path structure and configurations.

wrangler generate

This command on terminal will create first basic workers app for you. It actually clones this GitHub repo. But it is enough for a start.

There are 3 main files in our folder now. index.js, wrangler.toml and package.json.

Image for post
Image for post

index.js is your main javascript file. CF will try to run this file first. You can change this file’s name or add more files to environment.
package.json is your main configuration file for workers app. You can add version, name of your app, depended packages or change main file name on this file.
wrangler.toml is configuration of environments and deployment. You can define type of your app, route configuration, zone info, KV info, etc. here.

All set

After these steps you are all set to start development of workers app. You may start with Playground if you like to start simple and don’t want to set up anything.

Originally published at on May 26, 2020.

Written by

MSc. Computer Engineer. Founder of @noteducom and @image4io, co-organizer in @serverlesstr, Community Builder of @awscloud

Sign up for Cloud Biweekly

By Cloud and Serverless Turkey

Cloud and Serverless Turkey topluluğu iki haftalık haber bülteni (Türkçe) Take a look

By signing up, you will create a Medium account if you don’t already have one. Review our Privacy Policy for more information about our privacy practices.

Check your inbox
Medium sent you an email at to complete your subscription.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store