A progressive web application for digital design education, built with React 18, TypeScript, Vite, and Express.
- 🎯 Course Management: 12-week curriculum with progressive lessons
- 📚 Knowledge Cards: Flashcards for design concepts and theory
- 📖 Case Library: Filterable gallery of design exemplars
- 🤖 Prompt Studio: AI prompt editor for generative design
- 📝 Assignments: Project submission and feedback system
- React 18 with TypeScript
- Vite for blazing-fast development
- Tailwind CSS 4 for styling
- shadcn/ui component library
- Wouter for lightweight routing
- TanStack Query for data fetching
- Framer Motion for animations
- Express server
- esbuild for server bundling
- TypeScript with ESM
- Vitest for unit/integration tests
- Testing Library for component testing
- Supertest for API testing
- Axe for accessibility auditing (dev only)
- Web Vitals for performance monitoring
- Node.js 18+
- pnpm 8+
```bash
pnpm install
cp .env.example .env ```
Note: The project includes a `.npmrc` file that disables strict peer dependency checking (`strict-peer-dependencies=false`) to handle Vite 7 peer dependency conflicts with development plugins.
```bash
pnpm dev
pnpm check
pnpm format ```
The dev server includes:
- Hot module replacement (HMR)
- Automatic accessibility auditing with axe-core
- React Query DevTools
```bash
pnpm test
pnpm test:watch
pnpm test:coverage ```
Coverage targets: ≥80% statements, ≥75% branches, ≥80% functions, ≥80% lines
```bash
pnpm install pnpm build
pnpm start ```
Build output:
- Client bundle: `dist/client/`
- Server bundle: `dist/index.js`
Important: This project uses pnpm with `.npmrc` configuration (`strict-peer-dependencies=false`) to handle peer dependency conflicts between Vite 7 and some development plugins (@builder.io/vite-plugin-jsx-loc).
``` . ├── client/ │ ├── index.html │ └── src/ │ ├── components/ # Reusable UI components │ ├── pages/ # Route-level components (lazy-loaded) │ ├── hooks/ # Custom React hooks │ ├── lib/ # Utilities (analytics, utils) │ ├── test/ # Test setup files │ ├── App.tsx # Root component with routing │ ├── main.tsx # Entry point │ └── styles.css # Global styles ├── server/ │ └── index.ts # Express server with API routes ├── shared/ │ ├── types.ts # Shared TypeScript types │ └── data.ts # Mock/seed data ├── tests/ │ ├── components/ # Component tests │ └── server.test.ts # API tests └── ...config files ```
- ✅ Route-level code splitting with `React.lazy`
- ✅ Suspense boundaries for async components
- ✅ Skeleton loaders for perceived performance
- ✅ Image lazy-loading via `loading="lazy"`
- ✅ Data prefetching on hover/focus (TanStack Query)
- ✅ Web Vitals monitoring (CLS, FCP, FID, INP, LCP, TTFB)
```bash
pnpm build --stats npx vite-bundle-visualizer ```
Target: Lighthouse score ≥90 on desktop/mobile for key pages
- WCAG 2.1 AA compliance
- Semantic HTML5 landmarks
- ARIA roles and labels
- Keyboard navigation (Tab, Enter, Escape)
- Skip links for main content
- Focus indicators (3px solid outline)
```bash
pnpm dev
npm i -g @lhci/cli lhci autorun ```
Critical issues: Must be resolved before production
- Skeleton loaders (rendering, accessibility)
- Navigation (routing, active states)
- Error boundaries (error handling)
- Course detail flow (data fetching, display)
- Prompt editor interactions
- Assignment form validation
- Course outline endpoint
- Course detail endpoint
- Analytics endpoints
- Playwright for smoke tests
- Responsive breakpoints (mobile, tablet, desktop)
| Script | Description |
|---|---|
| `pnpm dev` | Start Vite dev server |
| `pnpm build` | Build client + server for production |
| `pnpm start` | Run production server |
| `pnpm preview` | Preview production build locally |
| `pnpm check` | Type-check all TypeScript files |
| `pnpm format` | Format code with Prettier |
| `pnpm test` | Run all tests |
| `pnpm test:watch` | Run tests in watch mode |
| `pnpm test:coverage` | Generate coverage report |
```bash
PORT=3001 # Server port NODE_ENV=development # Environment (development|production|test) VITE_API_BASE_URL=/api # API base URL for client ```
- Authentication: No user login/session management yet
- Database: Mock data only; no persistence layer
- File Uploads: Assignment submissions are URL-based
- Internationalization: Chinese/English content mixed; no i18n framework
- Analytics: Web Vitals logged but not aggregated/visualized
- Offline Support: No service worker or PWA manifest
This project is configured for deployment on Vercel with proper SPA routing support:
-
Automatic Configuration: The project includes a `vercel.json` file that configures:
- Package manager: pnpm (specified in `package.json`)
- Build command: `pnpm install && pnpm build`
- Output directory: `dist/client`
- SPA Rewrites: All routes redirect to `index.html` for client-side routing
- API Routes: Preserved for backend endpoints at `/api/*`
- Cache headers for optimal performance
- Peer dependency handling: via `.npmrc` with `strict-peer-dependencies=false`
-
Deploy Steps: ```bash
npm i -g vercel
vercel
vercel --prod ```
-
Environment Variables: Set these in Vercel dashboard (if needed):
- `NODE_ENV=production`
- `PORT` (handled automatically by Vercel)
📘 For detailed deployment instructions, troubleshooting, and verification checklist, see DEPLOYMENT.md.
Blank Page After Deployment:
- Verify `vercel.json` includes SPA rewrite rules (see DEPLOYMENT.md)
- Check browser console for errors
- Ensure `outputDirectory` is set to `dist/client`
404 on Route Refresh:
- The `rewrites` configuration in `vercel.json` handles this automatically
- Verify the catch-all rule: `{ "source": "/(.*)", "destination": "/index.html" }`
Peer Dependency Errors: If you encounter peer dependency conflicts during deployment:
- Ensure `.npmrc` file exists with `strict-peer-dependencies=false`
- Verify `vercel.json` uses `pnpm install`
- The project requires pnpm (specified in `package.json` `packageManager` field)
- The `.npmrc` file is automatically used by pnpm to handle Vite 7 peer dependency conflicts
Build Failures:
- Check build logs for TypeScript errors: `pnpm check`
- Verify all environment variables are set in Vercel dashboard
- Ensure `dist/client` directory is generated after build
- Test build locally: `pnpm install && pnpm build`
Redeploy After Fix: ```bash
vercel --prod --force ```
Create `.github/workflows/ci.yml`:
```yaml name: CI
on: push: branches: [main, develop] pull_request: branches: [main]
jobs: test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - uses: pnpm/action-setup@v2 with: version: 10 - uses: actions/setup-node@v3 with: node-version: 18 cache: 'pnpm' - run: pnpm install - run: pnpm check - run: pnpm test:coverage - run: pnpm build ```
```bash
pnpm add -D husky lint-staged
npx husky init
echo "pnpm check && pnpm format" > .husky/pre-commit ```
- Fork the repository
- Create a feature branch (`git checkout -b feature/amazing-feature`)
- Commit your changes (`git commit -m 'Add amazing feature'`)
- Push to the branch (`git push origin feature/amazing-feature`)
- Open a Pull Request
- Use TypeScript for all new files
- Follow Prettier formatting (auto-format on commit)
- Write tests for new features (≥80% coverage)
- Add accessibility attributes (ARIA, semantic HTML)
MIT
For questions or issues, please open a GitHub issue or contact the development team.
Last Updated: 2024-11
Version: 1.0.0