Single logo
  • Courses
  • Blog
  • About
Join on SkoolJoin on Skool

In this topic

React
  • Backend vs Frontend: What Runs Where, and Why the Server Is the One You Trust
  • One Request, Two Answers: the Same Post as an HTML Page and as JSON
  • A Blog Design from a Prompt: Downloading Figma Make Code and Reading App.tsx and BlogCard.tsx
  • How a Web Page Works: HTML Tags, Elements and Attributes
  • Semantic HTML: header, nav, main, aside and footer as Page Landmarks
  • HTML Forms: Labels, Names, Input Types and Where the Data Goes (GET vs POST)
  • CSS Basics: Selectors, Which Rule Wins, and the Box Model
  • CSS Flexbox vs Grid: A Nav Bar, a Card Row and a Dashboard
  • Responsive CSS: Viewport, Mobile-First Media Queries, clamp() and Dark Mode with Tokens
  • JavaScript for People Who Already Code: Syntax, Modules and Five Surprises
  • JavaScript Arrays the Functional Way: map, filter, reduce, find, sort and Object.entries
  • Async JavaScript: Promises, async/await, fetch and Promise.all
  • JavaScript in the Page: the DOM, querySelector and Events
  • npm, package.json and Vite: What npm install Fetches and How Vite Serves and Builds Your Page
  • TypeScript Essentials: Types Checked, Then Erased (Interfaces, Unions, Generics)
  • Why React, JSX and Components: The Page as a Function of Data
  • React Props and Composition: Data Down, Calls Up, Children in the Slot
  • Routing With React Router: One Page, Many Addresses
  • React Component Tests With Vitest and Testing Library: Test What the User Sees
  • End-to-End Tests for a React App With Playwright: A Full Dress Rehearsal
  • Why AI-Built Websites All Look the Same, and Four Levels That Fix It
  • Visual Hierarchy, Spacing and the 8-Point Grid: Tell the Eye What to Read First
  • Colour, Contrast and Dark Palettes: 60-30-10, Semantic Tokens and Ratios You Can Compute
  • Typography That Sells: Type Scale, Line Length and Free Font Pairings
  • The UI Element Catalogue: Buttons to Toasts, Their Jobs, States and shadcn/ui Names
  • Design Tokens: Primitive and Semantic Tokens, from Figma to CSS to Tailwind
  • Tailwind CSS 4 in React: Utility Classes, Responsive Prefixes, Hover and Dark Mode
  • shadcn/ui in React: Components You Own, Edit and Commit
  • Design Tokens to a Tailwind Theme: Light and Dark Mode with @theme inline
  • Motion in React: Entrance, Hover, Exit and Layout Animations
  • A React Dashboard: Stat Cards, a Recharts Line Chart and a Sortable Table
  • Accessibility in Practice: Dialogs, Menus and the Keyboard in React
  • Reference-Driven Design: Extract a DESIGN.md From a Site You Admire and Build From It
  • Components, Variants and Variables: One Design System in Figma and in CSS
  • Figma MCP Server: Build a React Component From a Frame, Then Write It Back
  • Claude Design: From a Brief to a Clickable Prototype, Then Hand It Off to Claude Code
  • Critiquing AI-Generated UI: Six Checks for Every Screen
  • The AI Design Landscape: Prompt to UI, Prompt to App, and Design to Code
  • Your Brand Rules Folder: One Folder Every AI-Built Page Follows
  • The Best-Practice UI Prompt: Plain Sentences That Beat the Average AI Page
  • UI Ideas From Figma Make, Google Stitch and ChatGPT: One Prompt, Three Designs
  • Google Stitch From a Sketch or Screenshot: Show the Layout, Say What to Keep
  • Stitch to Figma to Code: Turn a Stitch Screen Into Code That Uses Your Tokens
  • Figma Make: Prompt to Prototype With a Four-Part Prompt
  • Upgrade a Dated UI From One Screenshot (or a Reference Image)
  • States and Feedback: Make Every Click Get an Answer
  • A Design-Loop Skill: Claude Screenshots, Scores and Fixes Its Own UI
  • Copy Without the AI Tells: A Copy Pass on a Landing Page
  • Running a Next.js Admin Starter Kit: Route Groups, Theme Tokens and npm run dev
  • Remotion Basics: A Video as One Composition Object, Frames, Sequences and the Player
  • Spline: Put a 3D Scene on a Landing Page Without Writing 3D Code
  • Framer: A Launch Page Without Code, From a Free Animated Template
  • Three.js: What It Can Do on Real Sites, and How to Let Your AI Agent Use It
  • Animated Component Libraries (Magic UI, Aceternity UI): Copy-In Motion and When It Becomes Noise
  • WebGPU and Three.js Shaders in TSL: A Living Gradient, 4,500 Particles and a Hover Ripple
  • Deploy Many Vite Demos as One Static Site: A Gallery Page, One Build Command and import.meta.env.BASE_URL
  • React State, Events, Lists and Conditional Rendering: Follow One Click
  • React useEffect: When It Runs, What Cleanup Is For, and When You Don't Need One
  • Lifting State Up, Refs and React DevTools: Put State Where It Is Needed
  • Forms and Actions in React 19: Controlled Inputs, Form Actions, useActionState and useFormStatus
  • React Context and Custom Hooks: Share One Value, Reuse the Logic
  • Finishing a Remotion Video Editor: Timeline Sync, Track Order, Trims and Fades, and the Server MP4 Render
  • A 3D Product Page in React and Three.js: Scroll Becomes a Number, One Camera Shot per Panel, One Choice Drives Everything
  • A Personal 3D Portfolio Room in React Three Fiber: Hover Glow, Click to Open, Pointer Drift and a Contact Form to FastAPI
  • Server State With TanStack Query: One Key, One Request, One Cache
  • Mutations and Optimistic Updates in TanStack Query: Change Data, Then Tell the Cache
  • Generate TypeScript Types, Query Hooks and Zod From an OpenAPI Spec With Orval
  • A Mock Backend in the Browser With Mock Service Worker, Generated From the Spec
  • A React Client for a FastAPI API: The CORS Wall, CORSMiddleware and the Vite Proxy
  • Forms With React Hook Form and Zod: The API's Rules in the Browser, the Server's Errors Under the Field
  • JWT Auth in a React Client With a FastAPI Backend: Log In, Carry the Token, Let the Server Decide
  • Supabase as a Backend: Postgres, Instant APIs, Row Level Security and the Two Keys
  • Email Login With Supabase in Next.js: Three Clients, Server Actions, the Callback Route and Middleware
  • Google Sign-In With Supabase in Next.js: Which Address Goes Where
  • hCaptcha on a Supabase Login Page: Site Key in the Browser, Secret in Supabase
  1. Blog
  2. /
  3. React
  4. /
  5. Fundamentals

Deploy Many Vite Demos as One Static Site: A Gallery Page, One Build Command and import.meta.env.BASE_URL

Nine front-end demos, one link: a card per demo from demos.ts, a build:all script that runs vite build --base /<slug>/ for each into dist (about 20 MB in total), image paths from import.meta.env.BASE_URL, a vite preview click-through, any static host, and a recruiter pitch in three sentences.

Chaand Sheikh

·27 November 2026·Updated 29 November 2026Fundamentals

What you will learn

  • Drive a gallery page from one typed list of demos
  • Build every Vite demo into its own sub-folder with --base in a single build:all script
  • Build public-file addresses from import.meta.env.BASE_URL so images survive deployment under a sub-path
  • Check the build with vite preview, deploy dist to any static host, and present it with a 30-second capture and a three-sentence pitch

Before you start

  • A React project built with Vite
  • npm scripts

Imagine you cooked nine really good dishes, but they're in nine different kitchens and nobody can find them. That's a set of demos sitting in separate folders. In this lesson we put everything from this part in one place: one gallery page, one build, one static host, and one link you can send to a recruiter. Work that nobody can open is work that doesn't exist.

A card for every demo

Each card has a desktop screenshot, with the phone screenshot tucked in the corner. The cards come from a simple list in src/demos.ts:

// One entry per demo. `slug` is the folder name and the sub-path in the deployed site.
export type Demo = { slug: string; title: string; blurb: string; tags: string[]; lecture: string }

export const demos: Demo[] = [
  // ...
  { slug: 'product-3d', title: 'Aurel One', lecture: 'S04L01',
    blurb: 'A headphone product page: the 3D model turns with scroll, swatches repaint it, the buy box follows.',
    tags: ['R3F', 'scroll-linked 3D', 'e-commerce'] },
  // ...
]

The page loops over the list and draws one card per entry. Each card links to ./${demo.slug}/, the sub-folder of that demo. To add a demo, you add one entry to the list.

One command builds the whole site

scripts/build-all.mjs, called by npm run build:all:

// Builds the gallery, then every demo into dist/<slug>/ so the whole folder deploys as one static site.
const slugs = ['scroll-story', 'glass-fluid', 'animated-components', 'r3f-basics', 'shader-effects',
  'scroll-flythrough', 'product-3d', 'portfolio-room', 'orbit-launch']
const root = resolve(import.meta.dirname, '..')
const run = (cmd, cwd) => execSync(cmd, { cwd, stdio: 'inherit' })

run('npx vite build', root) // gallery first: it empties dist/
for (const slug of slugs) {
  const dir = resolve(root, '..', slug)
  if (!existsSync(resolve(dir, 'node_modules'))) { console.warn(`skip ${slug}: run npm install there first`); continue }
  // --base makes every asset URL start with /<slug>/ ; the demos use import.meta.env.BASE_URL for public files
  run(`npx vite build --base /${slug}/ --outDir "${resolve(root, 'dist', slug)}" --emptyOutDir`, dir)
}

The gallery builds first (it empties dist), then each demo builds with its own base path into its own folder. The result is the gallery at the top and one folder per demo. The biggest is the scroll fly-through at nearly 7 MB; the whole site is about 20 MB of plain files.

One dist folder, one sub-path per demo dist/ (gallery at /) npx vite build dist/product-3d/ (--base /product-3d/) dist/portfolio-room/ (--base /portfolio-room/) dist/orbit-launch/ ... nine demos in all about 20 MB of plain files: build command npm run build:all, output folder dist
Gallery at the root, each demo under its own path.

Each demo lives under its own path

Here's a small detail that breaks many deployments. The gallery sits at the root, the product page under /product-3d/, and Orbit (the sample team project app) under /orbit-launch/. A plain src="/fallback.png" looks in the site root, not inside the demo folder, so the image goes missing after deploy. The product page builds its fallback images from the base instead:

<img key={f.id} src={`${import.meta.env.BASE_URL}fallback-${f.id}.png`} ... />

The base is just / while you develop, and /product-3d/ after the build. One line works in both places. The gallery does the same for its thumbnails:

const thumb = (slug: string, w: 1440 | 390) => `${import.meta.env.BASE_URL}thumbs/${slug}-${w}.webp`

Always build file addresses from the base.

Click through before you ship

npm run build:all
npx vite preview

Open localhost:4173. This serves the built files, exactly what a host will serve. Click every card: does each one open with no missing image? Does the back button return to the gallery? Look at a narrow screen too. One thing to know: the portfolio room's contact form needs its back-end server, so on a static host it shows an error. Preview shows you the truth before anyone else sees it.

It's only files, so any static host works

HostHow
GitHub PagesPublish from your repository
NetlifyConnect the repository or drop the folder
VercelImport the repository; it builds for you
Cloudflare PagesConnect the repository and pick the folder

Whichever you choose, it asks the same two things. The build command is npm run build:all, and the output folder is dist. The buttons differ; the two answers don't.

Show it moving

Being online isn't enough; you also need to present it. Make a 30-second capture of each demo:

  1. Start fresh. Reload, so the first thing a person sees is the opening.
  2. Do one thing. Scroll the story, spin the product, or click an object.
  3. Stop at 30 seconds. Short enough that a busy person watches all of it.

A before and after tells the story without a word: Orbit hand-built, then Orbit reimagined.

The recruiter pitch: three sentences, one link

  1. What it is: nine small front ends, one link, each with a 30-second capture.
  2. What you did: built with React, three.js and Tailwind, with AI as your assistant and you reviewing every line.
  3. What it shows: that you can ship. Built, deployed and running, not just a screenshot.

Send the link, and offer to walk them through any one demo.

Common mistakes

  • Root-relative paths to public files. They break under a sub-path. Use import.meta.env.BASE_URL.
  • Skipping vite preview. The dev server hides base-path bugs.
  • Expecting a back end on a static host. Forms that need a server will error.
  • Long screen recordings. Thirty seconds, one action.

Try it yourself

Add a tenth card with one entry in demos.ts and a screenshot. Run build:all and preview it. Then deploy dist to a static host and record your 30-second capture.

Tried the exercise? Share your answer or ask a question.

The StudyEasy AI Community is free to join, with the lesson files, notebooks and code.

Join free on Skool

Keep going in React · 56 of 75

Previous
WebGPU and Three.js Shaders in TSL: A Living Gradient, 4,500 Particles and a Hover Ripple
Next post
React State, Events, Lists and Conditional Rendering: Follow One Click

Related course on Udemy

The Python Architect Masterclass: Full Stack to AI Engineer

Python, Django, FastAPI, React, Docker, AWS, LLMs, RAG, agents and MCP, from first steps to AI engineer.View on Udemy ↗: The Python Architect Masterclass: Full Stack to AI Engineer (paid course, opens in a new tab)

Related posts

Backend vs Frontend: What Runs Where, and Why the Server Is the One You Trust

Every web app has two halves. The front end runs on the user's device and is trusted with nothing; the back end holds the data, the secrets and the rules. Checked with real requests to a Django blog.

One Request, Two Answers: the Same Post as an HTML Page and as JSON

Ask a Django blog for the same post twice: once as a 12,731-byte HTML page built by a template, once as 2,976 bytes of JSON built by a serializer. Compare the headers, see who builds the page, and why the server still owns every write.

A Blog Design from a Prompt: Downloading Figma Make Code and Reading App.tsx and BlogCard.tsx

Make a blog design from a prompt in Figma Make, download src.zip, unzip it with Python's zipfile module, and read the two files that matter: App.tsx with its selectedPost state and BlogCard.tsx with its props.

How a Web Page Works: HTML Tags, Elements and Attributes

A web page is a text file full of labelled pieces. Learn tags, attributes and nesting with three tiny pages, and see what breaks when an attribute or a closing tag is wrong.

On this page

  • A card for every demo
  • One command builds the whole site
  • Each demo lives under its own path
  • Click through before you ship
  • It's only files, so any static host works
  • Show it moving
  • The recruiter pitch: three sentences, one link
  • Common mistakes
  • Try it yourself
Community · Free to join
Single logo

StudyEasy AI Community

Hosted onSkool

Learn AI engineering, share what you build, and connect with other learners.

  • Free resources: lesson files, notebooks and code

  • Ask questions and join engineering discussions

  • Meet real people learning and building with AI

Join free on Skool

Related course on Udemy

The Python Architect Masterclass: Full Stack to AI Engineer

Python, Django, FastAPI, React, Docker, AWS, LLMs, RAG, agents and MCP, from first steps to AI engineer.View on Udemy ↗: The Python Architect Masterclass: Full Stack to AI Engineer (paid course, opens in a new tab)

Single logo

Empowering Education, One Course at a Time

About
About usContact us
Legal
Terms of UsePrivacy Policy

© 2026 StudyEasy Organization. All rights reserved.