Skip to content

Deploy your Thulite Site to Cloudflare Pages

You can deploy your Thulite project on Cloudflare Pages, a JAMstack platform for frontend developers to collaborate and deploy websites.

This guide includes:

Prerequisites

To get started, you will need:

  • A Cloudflare account. If you don’t already have one, you can create a free Cloudflare account during the process.
  • Your app code pushed to a GitHub or a GitLab repository.

How to deploy a site with Git

  1. Set up a new project on Cloudflare Pages.

  2. Push your code to your git repository (GitHub, GitLab).

  3. Log in to the Cloudflare dashboard and select your account in Account Home > Pages.

  4. Select Create a new Project and the Connect Git option.

  5. Select the git project you want to deploy and click Begin setup

  6. Use the following build settings:

    • Framework preset: exit 0
    • Build command: npm run build
    • Build output directory: public
  7. Click the Save and Deploy button.

How to deploy a site using Wrangler

  1. Install the Wrangler CLI in your project:

    Terminal window
    npm install wrangler --save-dev
  2. Authorize Wrangler with your Cloudflare account using OAuth:

    Terminal window
    wrangler login
  3. Run your build command:

    Terminal window
    npm run build
  4. Deploy the build output directory as a Pages deployment:

    Terminal window
    wrangler pages deploy public

After your assets are uploaded, Wrangler will give you a preview URL to inspect your site. When you log into the Cloudflare Pages dashboard, you will see your new project.

Enabling Preview locally with Wrangler

Update the preview script to run wrangler instead of Thulite’ built-in preview command:

package.json
"preview": "wrangler pages dev ./public"

Troubleshooting

If you’re encountering errors, check whether the node version you’re using locally (node -v) matches the NODE_VERSION environment variable under Settings.

More Deployment Guides