This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Codetime Web V3 is a Nuxt.js web application for code time analytics, running at https://codetime.dev. This is the third iteration, evolved from Vue SPA to Next.js and now to Nuxt.js, with visualization switched from ECharts to Observable Plot.
- Install dependencies:
pnpm install(preferred package manager) - Development server:
pnpm run dev(binds port 3002 with .env.dev; production PM2 holds 3001) - Build for production:
pnpm run build - Lint and fix:
pnpm run lint(uses @jannchie/eslint-config with UnoCSS support) - Generate static site:
pnpm run generate - Preview production build:
pnpm run preview - Update API SDK:
pnpm openapi(regenerates from OpenAPI spec at test.codetime.dev) - Deploy:
pnpm deploy(updates API, builds, and starts with PM2)
- Frontend: Nuxt.js 4 with Vue 3 and TypeScript
- Styling: UnoCSS with design tokens declared in
app/assets/tokens.cssand exposed via thect-*theme block inuno.config.ts - API: Auto-generated TypeScript SDK from OpenAPI spec
- Backend: Nuxt/Nitro routes under
server/routes/v3/...own every/v3/*endpoint. The legacy Python service (codetime-server-v3, still reachable atapi.codetime.dev) survives only for the VSCode plugin's event-log uploads and the LemonSqueezy webhook, until edge routing proxies them across. Drizzle ORM over the same Postgres. - Deployment: PM2 cluster mode with health checks
- Visualization: Observable Plot for charts and data visualization
app/- Main application code (Nuxt 4 app directory structure)api/v3/- Auto-generated API client (ignored by ESLint)components/- Vue components organized by featurecomposables/- Shared reactive logici18n/- Internationalization with support for 12+ languageslayouts/- Page layouts (default, dashboard, landing, user)pages/- File-based routing with locale supportutils/- Helper functions and data formatters
public/- Static assets including VSCode iconsserver/- Nitro server: middleware, routes, and the owner of every/v3/*endpoint (seeserver/CLAUDE.md)shared/- Code visible to both app and server (empty after the Python → Nuxt cutover removedmigrated-routes.ts)
- Routing: File-based with locale parameter
[locale]/dashboard/workspace.vue - State Management: Vue's ref/computed + composables (no Vuex/Pinia)
- Data Fetching:
useAsyncDatacomposable with API client - Internationalization: Translation keys via
useI18N()composable - LRU Cache: Custom
useLRUcomposable for recent selections - Type Safety: Strict TypeScript with
@typescript-eslint/consistent-type-definitions
Badge/- Badge and card componentsDashboard/- Dashboard-specific components (calendar, stats, filters)Landing/- Landing page componentsPolt/- Observable Plot chart wrappersTag/- Tag management and statisticsR/- Reusable UI components (buttons, inputs, etc.)
- Auto-generated SDK from OpenAPI spec at
https://codetime.dev/v3/docs/openapi.json - Client configured in
app/app.vuewithcredentials: 'include'and a same-origin base URL — every request lands on the Nuxt backend that serves the current page. - The curated OpenAPI surface at
/v3/docs/openapi.jsonis built from each route'sdefineRouteMetablock (server/routes/v3/docs/openapi.json.ts) and rendered through Scalar at/docs/api.
Conventions for /v3/* handlers — auth, Drizzle, error shape, OpenAPI
metadata, and the things to deliberately NOT do — live in
server/CLAUDE.md. Read it before touching anything under server/.
- UnoCSS utility-first approach driven by
ct-*theme tokens - Safelist includes platform icons (
i-mdi-apple,i-mdi-microsoft-windows, etc.) - Font stack: Inter for Latin, HarmonyOS Sans for CJK languages
- VSCode file type icons available in
public/vscode-icons/
- PM2 cluster mode with 2 instances
- Health checks on port 3000 at
/enendpoint - Memory limit: 500MB with automatic restart
- Production server runs on port 3001 (dev server uses 3002)
- Postgres credentials (
POSTGRES_*env) must be present at runtime — the Nuxt backend connects to the same DB as the Python service
- ESLint with strict TypeScript rules enforced
- Type definitions prefer
typeoverinterface - Auto-generated API code excluded from linting
- Binary operators indentation rule disabled for readability
- Support for 12+ languages (en, zh-CN, zh-TW, ja, de, es, fr, it, ru, ua, ms, pt-BR)
- All UI text must use translation keys
- Locale-aware routing with
[locale]parameter
- Observable Plot for charts (daily distribution, language stats, flame charts)
- Custom plot components in
components/Polt/ - D3.js available for advanced visualizations
- UnoCSS for optimized CSS
- Nuxt image optimization enabled
- Auto-imports for composables and utilities
- Code splitting via Nuxt's built-in features