A React 18 single-page app starter in JavaScript, built with Vite 8 and React Router 6, for developers who want a clean project to add their own pages to. It includes a shared layout, Home, About and 404 pages, CSS Modules, ESLint and Vitest with Testing Library.
by Light CloudSingle-page apps


The starter keeps to plain React and Vite with JavaScript, so there is no framework layer between you and the build. Routes live in one file and the layout sits around them, which makes adding a page a two-line change. Most people first swap the home page copy, set VITE_APP_TITLE, and add their own pages and components. Deploying runs npm run build and serves dist/ from a CDN, with unknown paths falling back to index.html so React Router can handle them.
Create a component in src/pages/, add a Route for it inside the layout route in src/App.jsx, and add a NavLink in src/components/Layout.jsx.
The host is looking for a file at that path and finds none. Configure it to serve index.html for unknown paths; Light Cloud does this for you.
Add a line such as VITE_API_URL=https://api.example.com to .env.local and read it with import.meta.env.VITE_API_URL. Only VITE_ names reach the browser and their values are fixed at build time, so never put secrets in them.
Yes. Rename files to .tsx and add typescript and a tsconfig.json; Vite compiles TypeScript without extra plugins, and the @types/react packages are already installed.
Yes. Run npm run build and upload dist/ to any static host, such as Netlify, Cloudflare Pages, GitHub Pages or nginx, with a fallback to index.html for client-side routes.