Skip to content

Docusaurus on Fastly with Compute

In this post I’m going to walk you through getting a Docusaurus site stood-up on Fastly’s Compute platform for free in less than 2 minutes 💨

What is Docusaurus?

Docusaurus is an open-source static site generator designed for building efficient and easy-to-maintain documentation websites. It offers features like versioning, localization, and document search, making it ideal for technical documentation, blogs, and community-driven projects. Docusaurus simplifies content creation by supporting Markdown and provides customizable templates to get your site up and running quickly. Sounds pretty sweet.

Why Choose Fastly's Compute?

Fastly’s Compute platform takes your web applications closer to your users by running them on servers distributed worldwide. This reduces latency, improves load times, and enhances the overall user experience. It's an excellent platform for hosting static sites like those generated by Docusaurus due to its high-performance capabilities and global reach.


Some quick prerequisites

1. Setting Up Your Docusaurus Project

First, create a new Docusaurus project if you haven't already:

npx create-docusaurus@latest docs-on-compute classic

Navigate into your project directory:

cd docs-on-compute

2. Building Your Docusaurus Site

Build your Docusaurus site locally:

npm run build

This step generates a static build of your site in the build directory.

3. Using the compute-js-static-publish Package

We're going to be using the Compute JS Static Publish package via NPX:

npx @fastly/compute-js-static-publish --preset=docusarus

This package greatly simplifies the deployment of static sites to Compute via the Fastly CLI. You’ll notice it created a new directory ./compute-js for you. Go ahead and change to that directory:

cd ./compute-js/

4. Using the Fastly CLI locally

Assuming you have the Fastly CLI installed and setup with a valid auth token, you can serve your new Docusaurus site on Compute locally by running:

fastly compute serve

If you head to in your browser you’ll see it running!

5. Deploying to Compute

Deploy your site to Compute using the CLI:

fastly compute publish

Follow the prompts to complete the deployment and boom – you’ve got yourself a Docusaurus site running on the Fastly’s highly performant edge! You can go manage the configuration in your Fastly account or continue iterating on your docs.


By leveraging Fastly's Compute platform for your Docusaurus site, you can significantly improve performance, ensure scalability and reliability, enhance security, and be cost-effective (free), all while offering a developer-friendly environment. The compute-js-static-publish package makes the process straightforward, allowing you to focus on writing the best documentation for your users – which is really the end goal. Happy coding!