Author types in JSDoc comments. jsconfig.json keeps checkJs: true so the editor's bundled TS server still validates them; CI can validate with npx -p typescript tsc --noEmit on demand. Renames (history preserved via git mv): - next.config.ts -> next.config.mjs - app/layout.tsx -> app/layout.jsx - app/page.tsx -> app/page.jsx - app/master/page.tsx -> app/master/page.jsx - components/player-board.tsx -> components/player-board.jsx - lib/game-logic.ts -> lib/game-logic.js - tsconfig.json -> jsconfig.json (same @/* alias) Drops typescript and @types/node, @types/react, @types/react-dom from devDependencies. Removes vendored next-env.d.ts. eslint config no longer pulls in eslint-config-next/typescript. Behavior unchanged. Build, lint, and dev profiles verified.
4.1 KiB
Deployment Guide
Production Deployment (GitHub Pages)
Automatic Deploy
The app auto-deploys from the master branch via .github/workflows/deploy.yml.
Workflow:
- Push to
master - GitHub Actions runs
npm run build - Static export written to
out/directory - Pages deployed to
https://{user}.github.io/loto
Note: basePath is set to /loto in production (next.config.mjs:23).
Manual Deploy (if needed)
npm run build
# out/ directory ready for upload
Then deploy out/ folder to GitHub Pages or any static host.
Development Environment
Local Dev
npm install
npm run dev
Access at http://localhost:3000 (no basePath).
HMR works automatically.
Code-Server Dev
For browser-based development (VS Code in browser):
1. Start code-server with Node.js environment:
code-server --no-auth
2. Create .env.local in project root:
CODESERVER_HOST=your-machine.example.com
CODESERVER_PORT=3000
Replace your-machine.example.com with your actual hostname/IP (must match the proxy URL you'll access).
3. Run dev server:
npm run dev:codeserver
This sets NEXT_DEV_PROFILE=codeserver, triggering the code-server config path in next.config.mjs.
4. Access via browser: Navigate to:
https://your-codeserver-host/absproxy/3000/
Key Points:
/absproxy/{port}(NOT/proxy/{port}) preserves basePath through the proxy.- HMR socket connects to
CODESERVER_HOSTfor live reload. - If HMR fails, manually refresh the page (CSS/JS changes still apply server-side).
Manual Refresh Workaround
If HMR over proxy is unreliable:
- Make code changes
- Manually refresh browser (F5)
- Dev server has already compiled the changes
This is normal in proxy environments.
Build & Output
Build Command
npm run build
Generates:
out/— Complete static HTML export.next/— Build cache (not needed for deployment)
Export Settings
output: "export"innext.config.mjs- No server-side rendering
- All pages pre-rendered to HTML + JS bundles
Asset Hosting
assetPrefixmatchesbasePath(prod:/loto, dev/codeserver: empty or/absproxy/{port})- CSS, JS, fonts all prefixed correctly
- GitHub Pages serves from repository root, so
/lotopaths resolve correctly
Environment Variables
Required (code-server only)
CODESERVER_HOST— hostname for HMR proxyCODESERVER_PORT— port (default 3000)
Optional
NEXT_DEV_PROFILE— set to "codeserver" to enable proxy mode (usually set bynpm run dev:codeserver)
Not Used at Runtime
- No database URL, API keys, or secrets (all client-side, localStorage)
.env.localis.gitignored and safe for local config
Troubleshooting
| Issue | Cause | Fix |
|---|---|---|
| 404 on subpages after deploy | basePath mismatch | Verify basePath="/loto" in prod; local dev should be empty |
| HMR not connecting (code-server) | CODESERVER_HOST not set | Add CODESERVER_HOST=... to .env.local |
| Assets 404 (code-server) | Wrong proxy URL | Use /absproxy/{port}, not /proxy/{port} |
| Page blank after refresh | State not persisted | Check browser localStorage is enabled |
| Stale CSS (code-server) | HMR failed | Manually refresh page (F5) |
CI/CD Pipeline
.github/workflows/deploy.yml:
- Triggers on
pushtomaster - Installs dependencies (
npm install) - Builds app (
npm run build) - Deploys
out/folder to GitHub Pages
No manual steps required; push to master and GitHub Pages updates automatically.
Performance Checklist
- Static export (no server overhead)
- Tailwind purged for production size
- localStorage reduces bundle—no API calls
- Images minimal (mostly CSS gradients)
- Fonts: Geist via Google Fonts CDN
Bundle analysis: Run npm run build && ls -lh out/ to inspect file sizes.
Security Considerations
- No sensitive data in code (no API keys, secrets)
.env.localis local-only, not committed- localStorage scoped to origin
- No external API calls (offline-capable)
- GitHub Pages HTTPS by default
Last reviewed: 2026-04-26