Base React app (Vite + TypeScript) with routing, env plumbing, ESLint, Prettier, and absolute imports.
npm run dev: Start the dev server onhttp://localhost:5173npm run build: Type-check and build for productionnpm run preview: Preview the production build locallynpm run lint: Run ESLintnpm run lint:fix: Run ESLint with auto-fixnpm run format: Format with Prettier
Create a .env from .env.example and set public flags (must be prefixed with VITE_).
Example: .env
VITE_APP_NAME=Chess Coach
Access in code via import.meta.env or the typed helper in src/shared/env.ts.
/Home page/healthHealth page showing a simple JSON payload
Use @/ to import from src/, e.g. import { env } from '@/shared/env'.
- Install Node.js 18+ (LTS recommended)
- Install dependencies:
npm install - Start dev server:
npm run dev
Then open http://localhost:5173.
- Public env vars must be prefixed with
VITE_to be exposed to the client. - Linting and formatting are configured with ESLint + Prettier.
-
Vite base path:
- Custom domain or root hosting: leave
baseas/(default). - Project page (https://.github.io/chess-coach/): use
/chess-coach/. - This repo reads
BASE_PATHat build time. The provided workflow setsBASE_PATH=/chess-coach/.
- Custom domain or root hosting: leave
-
Workflow:
- See
.github/workflows/deploy.yml. - Push to
mainto build and deploy to Pages. - For a custom domain, remove the
BASE_PATHenv in the build step or set it to/. - Ensure Settings → Pages → Source is set to "GitHub Actions". If it's set to a branch (e.g.,
main), GitHub will serve the developmentindex.html(which points to/src/main.tsx) and you'll see MIME-type errors. - If you use a custom domain (e.g.,
chess-coach.me), either set it in Settings → Pages (GitHub will add CNAME), or keep the "Add CNAME" step in the workflow so the artifact containsdist/CNAME. - Enable "Enforce HTTPS" so the certificate is provisioned for your domain.
- See