Skip to the content.

Lesson 12: Deploy and Share

Course home Previous: Lesson 11

Time: about 60 minutes.

Hosting plans change. Free-tier details below were checked against official pages in December 2026; follow the links for current terms.

Goals

By the end of this lesson you will be able to:

Concepts

What “deploy” means for a static site

Your app is just files: index.html, styles.css, app.js, habits.js, storage.js. Deploying means copying them to a server that hands them to anyone who visits a URL. There is no server code to run, no database to set up. That is why it can be free.

Your tests/ folder and package.json can be uploaded too; they do no harm, but they are not needed by visitors.

Where to host

Host Free option How you deploy Good to know
GitHub Pages Yes, for public repositories Settings, Pages, pick a branch and folder Published sites up to 1 GB; soft bandwidth limit of 100 GB a month; not for running an online business (limits)
Cloudflare Workers static assets Yes, Workers Free plan npx wrangler deploy with an assets directory configured Cloudflare now points new static sites here; static asset requests are free and unlimited (pricing)
Cloudflare Pages Yes, on all plans Connect Git or upload a folder Still supported; 500 deploys a month on Free
Netlify Yes, credit-based Free plan Drag a folder onto Netlify Drop, connect Git, or CLI Deploys and bandwidth use credits from a monthly allowance
Vercel Yes, Hobby plan Connect Git or npx vercel Hobby has usage caps; Pro is positioned for professional and business use

This lesson uses GitHub Pages as the main path because your code is already on GitHub from Lesson 8.

Deploys are public

Once deployed, anyone with the URL can see your files, including every comment and any secret you forgot. That is why Lesson 11 came first.

Walkthrough

Step 1: Pre-launch checklist

Ask a fresh session for help, then verify each item yourself:

Help me run a pre-launch check on this static site. Check and report (do
not change anything):
- all file references in index.html are relative and match real files
  (case-sensitive, because web servers are)
- no console.log debugging left behind
- no secrets, API keys or personal data in any file
- the page has a <title>, a meta description, lang and viewport
- no external scripts, and the CSP matches what the page loads
- node --test passes

Then by hand:

Case sensitivity trap: your Mac or Windows PC may treat App.js and app.js as the same file; most web servers do not. Make sure the names in <script src> and <link href> match exactly.

Step 2: Choose what to publish

GitHub Pages can publish from the repository root or from a /docs folder on a branch. If your index.html is at the root of your repository (as in your tiny-habits repo), publish from the root. If it is in a subfolder like project/, either move it or use a GitHub Actions workflow. For this course, the root is simplest.

Step 3: Turn on GitHub Pages

Follow GitHub’s guide to creating a GitHub Pages site. In short:

  1. Open your tiny-habits repository on GitHub.
  2. Go to Settings, then Pages.
  3. Under “Build and deployment”, choose Deploy from a branch.
  4. Pick branch main and folder / (root). Save.
  5. Wait a minute or two. The Pages settings show your URL, usually https://YOUR-USERNAME.github.io/tiny-habits/.

Your repository must be public for Pages on a free GitHub account.

Step 4: Check the live site

Open the URL.

If you see a 404 page, wait another minute, then check that index.html is at the root of the branch you selected and the filename is lowercase.

Step 5: Ship an update

The deploy loop is now: change, test, commit, push.

Add a small footer: "Made while learning web development with AI." Change
only index.html and styles.css. Run node --test afterwards.

Review the diff, then:

git commit -am "Add footer"
git push

Within a minute or two the live site updates. If an update breaks the live site, use git revert <commit> and push: the site goes back to the previous version.

Step 6 (optional): Deploy to Cloudflare or Netlify instead

Netlify Drop, no command line: open app.netlify.com/drop, sign in, and drag your project folder onto the page. You get a URL in seconds. Good for a quick demo; connect Git later for automatic updates.

Cloudflare Workers static assets: create a wrangler.jsonc file in your project root (see the static assets docs):

{
  "name": "tiny-habits",
  "compatibility_date": "2026-12-01",
  "assets": {
    "directory": "./"
  }
}

Then:

npx wrangler deploy

Because the assets directory here is the whole project folder, add a .assetsignore file next to index.html so only the site files are uploaded. It uses the same format as .gitignore:

.git
.wrangler
node_modules
tests
wrangler.jsonc
package.json
AGENTS.md
CLAUDE.md
SPEC.md
.env*

Wrangler asks you to log in the first time. Read each prompt. For larger projects, a cleaner layout is a dedicated public/ folder containing only the site files; ask your agent to set that up if you like. Check the Wrangler install docs if npx wrangler gives errors.

Remember from Lesson 11: deploy commands publish to the internet. Read them before approving, whether you or the agent runs them.

Step 7: Share it

Step 8: Plan your next project

Take the idea you wrote down in Lesson 1’s assignment. Write a SPEC.md using the template in the course README. Then plan it in steps that map to this course:

Course lesson Your next project step
3 HTML structure
5 Styles and accessibility
6 Core interaction, logic in a pure module
7 Saving data
9 Tests for the logic
11 Security pass
12 Deploy

Start a fresh session with:

Read SPEC.md. We'll build this in small steps with a plan before each one.
Create AGENTS.md first with rules similar to my last project: plain HTML,
CSS and JS, pure logic separate from DOM code, textContent only, tests with
node --test, ask before installs or deletes. Show me AGENTS.md before
writing any app code.

What good output looks like

Checklist

Mini-quiz

  1. What makes Tiny Habits a static site?
  2. Your site works locally but the live site shows the page without styles. What is a likely cause?
  3. Do habits you added on localhost appear on the live site? Why?
  4. How do you roll back a bad update on GitHub Pages?
  5. Why does Lesson 11 come before Lesson 12?
Answers 1. It is made only of files (HTML, CSS, JS) served as they are, with no server-side code or database. 2. A path or case mismatch: for example `href="Styles.css"` when the file is `styles.css`, or an absolute path like `/styles.css` that points to the wrong place under a `/tiny-habits/` URL. Check the Console and the Network tab for a 404. 3. No. localStorage is separate for each origin (`http://localhost:8000` versus `https://you.github.io`), so the live site starts empty. 4. `git revert ` then `git push`. Pages republishes the previous working state. 5. Deploying makes everything public. Secrets, XSS holes and unsafe code must be dealt with before the world can see them. </details> ## Assignment: your capstone Ship a variation of the tracker that is yours: a water counter, a reading log, a mood journal, a practice log for an instrument. Requirements: 1. A `SPEC.md` with a "Not now" list. 2. An `AGENTS.md` with tech, code, process and safety rules. 3. At least ten small, clear commits. 4. Pure logic in its own module with at least ten tests passing under `node --test`. 5. No `innerHTML` with user text, and a CSP. 6. Works with keyboard only and on a phone. 7. Live at a public URL, linked from the README. When you finish, you have done the whole loop by yourself: plan, prompt, review, test, debug, secure and deploy. That is the skill this course set out to teach. --- Back to the [course home](/web-dev-for-beginners-ai/).