Huzi Blogs
BlogCategories
BlogCategories
Disclaimer & Data Privacy Policy
Project by huzi.pk

© 2026 blogs.huzi.pk. All Rights Reserved.

    Back to all posts
    Programming

    The Ultimate Beginner's Guide to Building a Website with Cloudflare Pages (2026)

    By Huzi

    Cloudflare Pages turned deployment into a single git push. Connect a repository and every commit builds on their edge network, served from hundreds of cities with automatic SSL and unlimited free bandwidth on static requests. Here is the shortest honest path from an empty folder to a live site.

    Push, connect, deploy

    Start with a plain repository:

    git init
    git add .
    git commit -m "first commit"
    git branch -M main
    git remote add origin https://github.com/you/your-repo.git
    git push -u origin main
    

    In the Cloudflare dashboard, open Workers and Pages, create a Pages project, and connect that repository. The framework preset auto-detects most stacks; the one setting worth adding yourself is a NODE_VERSION environment variable so the build container matches your local Node. Each push then runs install and build and hands you a production URL at project.pages.dev plus a preview URL for every branch — which makes pull requests reviewable in a browser instead of imagination. If a build fails, the dashboard streams the full log, so a broken dependency install is a scroll, not a mystery.

    Run the edge locally

    Wrangler is the CLI, and npx wrangler pages dev gives you a local server that mirrors the production edge runtime, bindings included. Scaffold with whatever you already use — Astro and Hugo work just as well, and Next.js is one preset away:

    npm create vite@latest my-site -- --template react-ts
    cd my-site && npm install && npm run dev
    

    If it works against Wrangler locally, the deploy behaves the same way. Same runtime, same result.

    Functions and bindings

    Add a functions directory and file-based routing turns it into an API — the file path is the route. Bind D1 (SQLite at the edge), KV or R2 through wrangler.toml, then read them from env, no servers to rent:

    // functions/api/items.ts — answers GET /api/items
    export const onRequestGet: PagesFunction = async ({ request, env }) => {
      const rows = await env.DB.prepare("SELECT * FROM items").all();
      return Response.json(rows.results);
    };
    

    The two fixes everyone needs

    When a single-page app 404s on refresh, that is routing, not bad luck: add a public/_redirects file containing /* /index.html 200 and Pages serves your index for every path. For a custom domain, point a CNAME at project.pages.dev, let Universal SSL cover the certificate, and switch on Always Use HTTPS. That is genuinely the whole ceremony.

    Uptime is a dashboard metric to me; in Gaza it is a lifeline. Volunteer teams there keep shelter maps, medical supply lists and family-locator pages online through blackouts, on eSIMs and whatever charge remains. Resilient infrastructure is not an abstraction there — it is survival, and I think of them every time a deploy goes green.

    Pages ships one quietly kind feature: instant rollback, one click back to the last good build. We run the same safety net at HTG Travels — when an airline cancels or a schedule collapses, we rebook and reroute until your plan is whole again. Deploy your site yourself; let us handle the departures.

    Advertisements


    You Might Also Like

    Navy-Blue Embroidered Chiffon Unstitched Formal Dress – Zari & Sequins

    Navy-Blue Embroidered Chiffon Unstitched Formal Dress – Zari & Sequins

    PKR 7900

    Heavy Embroidered Lawn Suit 3-Pc | Digital Print Diamond Zari Dupatta (2025)

    Heavy Embroidered Lawn Suit 3-Pc | Digital Print Diamond Zari Dupatta (2025)

    PKR 4750

    Luxury Handwork Heavy Embroidered Velvet Suit | Organza Dupatta & Jamawar Trouser

    Luxury Handwork Heavy Embroidered Velvet Suit | Organza Dupatta & Jamawar Trouser

    PKR 8900

    Schiffli Embroidered Lawn Suit 3-Pc | 4-Side Border Chiffon Dupatta (2025)

    Schiffli Embroidered Lawn Suit 3-Pc | 4-Side Border Chiffon Dupatta (2025)

    PKR 4900

    Luxury Heavy Embroidered Navy Blue Velvet Suit | 5000 Micro Velvet

    Luxury Heavy Embroidered Navy Blue Velvet Suit | 5000 Micro Velvet

    PKR 8800

    Advertisements


    Related Posts

    Programming
    The Beginner's Guide to React: Building the Modern Web (2026)
    The component mental model, one-way props, the server/client split that defines modern React, and the scaffolding commands to start a real project today.

    By Huzi

    Read More
    Programming
    Demystifying REST APIs: A Beginner's Guide (2026)
    Resources with URLs, HTTP verbs as actions, status codes as the contract, and where REST sits next to GraphQL and gRPC in a 2026 backend.

    By Huzi

    Read More
    Programming
    Real-Time Revolution: Building Interactive Apps with WebSockets (2026)
    The 101 Switching Protocols handshake, choosing between polling, SSE and WebSockets, a working Yjs editor server, and the scaling and security rules that keep the bridge standing.

    By Huzi

    Read More
    Programming
    Building a REST API with Node.js and Express 5 (2026)
    A hands-on walkthrough: scaffold a TypeScript project, build an Express 5 router with Zod-validated CRUD routes, and wire up one error handler.

    By Huzi

    Read More
    Programming
    The Architecture of Scale: Building REST APIs with Node.js (2026)
    The design layer of a professional API: resource naming, honest status codes, layered architecture, Zod boundaries, argon2 hashing, and correlation-ID error handling.

    By Huzi

    Read More
    Programming
    A Beginner's Guide to React Hooks: Mastering Modern React (2026)
    useState, useEffect, the React 19 form hooks, and the two rules that keep hooks from breaking — each with a runnable snippet.

    By Huzi

    Read More