Skip to content

Session 01

Node.js Setup & Cloudflare Deployment

Install Node.js and deploy your first project to Cloudflare Pages.


Node.js Setup & Cloudflare Deployment

Install Node.js and deploy your first project to Cloudflare Pages.


01 Install Node.js

Node.js is a JavaScript runtime that lets you run JS outside the browser. You need it for npm, build tools, and more.

  1. Go to nodejs.org
  2. Download the LTS version (the green button)
  3. Run the installer — accept all defaults, no changes needed
  4. Restart your terminal after installation

Verify it worked:

$ node --version
v22.x.x
$ npm --version
10.x.x

If you see version numbers, Node.js is installed correctly.


02 Deploy to Cloudflare Pages

Once your project works locally, deploy it for free on Cloudflare Pages. You get a live URL, HTTPS, and a global CDN — all on the free tier.

Method A — Direct Upload (quickest)

No GitHub needed. Just build your project and drag the folder to Cloudflare.

  1. Build your project: npm run build
  2. Find the output folder — usually called dist or build
  3. Go to dash.cloudflare.com
  4. Navigate to Workers & Pages → Create application → Pages
  5. Click Upload assets
  6. Name your project and click Create project
  7. Drag your dist folder into the upload area
  8. Click Deploy — done! You get a your-project.pages.dev URL

Every time you make changes, just run npm run build again and re-upload the dist folder.

Method B — Git Integration (auto-deploy)

Push to GitHub and Cloudflare auto-deploys on every commit. More setup, but better long-term.

Push to GitHub first:

$ git init
$ git add .
$ git commit -m "first commit"
$ git remote add origin https://github.com/YOU/repo.git
$ git push -u origin main

Then on Cloudflare:

  1. Go to dash.cloudflare.com
  2. Navigate to Workers & Pages → Create application → Pages → Connect to Git
  3. Select your GitHub repo
  4. Set build command: npm run build, output directory: dist
  5. Click Save and Deploy

Now every git push automatically redeploys your site.


Summary

  1. 01 Installed Node.js — the JavaScript runtime
  2. 02 Deployed a project to Cloudflare Pages