This file provides context for AI coding assistants (Cursor, GitHub Copilot, Claude Code, etc.) when working with code in this repository.
The full-stack-exploration is a pnpm workspace monorepo for learning and demonstrating Vite, Tailwind CSS, React, Vue, and Next.js. It contains four independent packages with no interdependencies.
pnpm install # Install all dependencies
pnpm dev:basic # Vite + Vue 3 (port 5173)
pnpm dev:server # Vite + React 19 + shadcn/ui (port 5174)
pnpm dev:vite-build # Vite + React 19 + Ant Design (port 5175)
pnpm dev:next # Next.js 16 (port 3000)
pnpm build # Build all packages
pnpm type-check # Type-check all packagesWithin packages/next-demo:
pnpm -C packages/next-demo dev # Next.js dev server
pnpm -C packages/next-demo lint # ESLint
pnpm -C packages/next-demo fix # ESLint --fixTech stack: Next.js 16, React 19, Tailwind CSS 4, SWR, clsx + tailwind-merge
Directory conventions:
app/— App Router pages and API routes; each route is a folder withpage.tsxapp/api/— Route handlers (Next.js API routes)components/— Shared React components (both server and client components)data/— Static mock data and data access functions (e.g.,getUserById)types/— TypeScript interfaces (no runtime code)lib/— Utility functions; notablyutils.tsexports thecn()classname helper
Key patterns:
- Pages default to Server Components; opt into client with
"use client"only when using state/effects/browser APIs - Data fetching uses SWR for client-side (User detail page) or direct
fetchin async Server Components (Blog page with ISRrevalidate = 60) - The
cn()function fromlib/utils.tscombinesclsx(conditional classes) +tailwind-merge(conflict resolution); always prefercn()over template literals for className @/path alias maps to the package root (configured intsconfig.jsonpaths)- Tailwind CSS v4 uses
@themeinglobals.cssto define design tokens (colors, radii, shadows, animations) — do not usetailwind.config.js - Dark mode uses
prefers-color-schememedia query with CSS custom properties; no JS toggle - ESLint uses flat config format (
eslint.config.mjs) witheslint-config-nextpresets
API routes call external services (jsonplaceholder) and return NextResponse.json(). They are independent from page data fetching — pages that need the same data call the external API directly to avoid build-time ECONNREFUSED errors.
Vue 3 with vue-router, SCSS, and @vitejs/plugin-vue. Uses Composables pattern (src/composables/) for shared reactive logic. Alias @ → src/.
React 19 with react-router-dom, Tailwind CSS 4, Jotai state management, and shadcn/ui. Vite config demonstrates dev server proxy (proxies /api to localhost:3000). Uses @vitejs/plugin-react-swc for fast refresh.
React 19 with react-router-dom, Tailwind CSS 4, Ant Design 6, Zustand state management, and vite-bundle-analyzer. Vite config demonstrates:
- Manual code splitting via
rolldownOptions.output.manualChunks(react, react-dom) - Design Tokens system in
src/styles/tokens.css— CSS custom properties in three layers: Primitive → Semantic → Component, with[data-theme="dark"]overrides
Tech stack: Next.js 16, React 19, Tailwind CSS 4, shadcn/ui (12 components), Zustand, SparkMD5 (Web Worker)
Directory conventions:
app/— App Router pages and Route Handlersapp/api/upload/{check,chunk,merge}/route.ts— three upload endpointsapp/api/files/[hash]/route.ts— streaming downloaddata/uploads.ts— server-side filesystem data access layer (atomic write + streaming merge)lib/upload/— client-side upload logic (Zustand store / pipeline / api client / hash worker client / constants / status-style)types/upload.ts— shared protocol DTOs and state machine typesworkers/hash.worker.ts— SparkMD5 incremental hashing in a Web Worker
Key patterns:
- Server state model is convention-based: filesystem layout
.uploads/chunks/<hash>/<index>.part+.uploads/merged/<hash>.binIS the upload session state — no manifest, no DB - Client state is a single Zustand store with 8-state task machine; per-task pipeline (
runTask) does hash → check → concurrent chunk pool → merge with exponential-backoff retry - AbortController on each task enables clean pause/resume/cancel —
pauseTaskaborts,resumeTaskswaps in a new controller and re-runs pipeline from check - Hash worker is a singleton serializing multi-file hash (avoid memory contention); upload phase remains parallel
- shadcn/ui + Tailwind v4: uses
@custom-variant dark (&:where(.dark, .dark *));andtw-animate-css(the v4 replacement fortailwindcss-animate) - Dark mode shares the next-demo pattern: hand-rolled
ThemeProviderContext with.darkclass on<html>(nonext-themes)
Both vite-build and next-demo implement design tokens, but differently:
- vite-build (
tokens.css): Pure CSS custom properties with a three-layer architecture (Primitive → Semantic → Component); theme switching viadata-themeattribute on<html> - next-demo (
globals.css): Tailwind CSS v4@themedirective, which auto-generates utility classes; theme switching viaprefers-color-schememedia query
When generating code, add structured comments following these conventions:
File-level comments — Every new file starts with a JSDoc-style block describing the module's purpose, features, and usage scenarios:
/**
* ============================================================================
* Component Name — 组件/模块名称
* ============================================================================
*
* 描述该模块的核心功能和职责。
*
* 功能特点:
* - 功能点 1
* - 功能点 2
*
* @module path/to/file
*/Section dividers — Use /* ==== ... ==== */ to separate major logical sections within a file:
/* =================================================================
* Section Name
* ================================================================ */Function/component JSDoc — Document parameters, return values, and usage examples with @param, @returns, @example tags. Descriptions are in Chinese.
Inline comments — Use // for explaining non-obvious logic, // with inline descriptions above code blocks for data flow or architectural decisions. Avoid stating what the code literally does — focus on why.
Commits follow conventional commit format: type(scope): description
- Types:
feat,fix,docs,style,refactor,test,chore - Scope is typically the package name (e.g.,
next-demo,vite-basic) - Descriptions are in Chinese or English, describing the "why" over the "what"