fastly-cli is a command-line interface (CLI) for the Fastly CDN written in node.js. It currently supports checking cache status by URL, clearing caches by URL/cache key, or clearing the entire cache, as well as supporting Fastly’s Soft Purge functionality by default, with an option to execute a more traditional purge.
We recently migrated chromatichq.com to Fastly’s CDN. After this migration was complete and we were serving content via Fastly’s network, we began exploring how to make the purging of caches fast and efficient via the command line. Fastly features a robust API and some searching uncovered a lightweight client written in node.js. This was enough to send us off to the races writing a simple command-line interface (CLI) for the Fastly API using node.js, hence: fastly-cli.
If you are a Fastly user, we hope this is useful to you and would love any feedback or contributions you may have. Enjoy!
To use fastly-cli, you’ll most likely want to install it as a global package so it is available to you from any location; both npm and yarn make this easy.
yarn global add fastly-cli
npm install -g fastly-cli