|
| 1 | +# CLAUDE.md |
| 2 | + |
| 3 | +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. |
| 4 | + |
| 5 | +## Development Commands |
| 6 | + |
| 7 | +### Package Management |
| 8 | +- Use `pnpm` for package management (not npm/yarn) |
| 9 | +- `pnpm install` - Install dependencies |
| 10 | +- `pnpm dev` - Start development server on localhost:3000 |
| 11 | + |
| 12 | +### Build & Test |
| 13 | +- `pnpm build` - Build for production |
| 14 | +- `pnpm preview` - Preview production build locally |
| 15 | +- `pnpm test` - Run tests with Vitest |
| 16 | +- `pnpm tsc-check` - Run TypeScript type checking |
| 17 | + |
| 18 | +### Code Quality |
| 19 | +- `pnpm lint` - Run ESLint |
| 20 | +- `pnpm lint:fix` - Fix ESLint issues automatically |
| 21 | +- `pnpm format` - Format code with Prettier |
| 22 | +- `pnpm format:check` - Check code formatting |
| 23 | + |
| 24 | +### Documentation & Storybook |
| 25 | +- `pnpm storybook` - Run Storybook on port 6006 |
| 26 | +- `pnpm storybook:build` - Build Storybook |
| 27 | +- `pnpm docs:dev` - Run VitePress docs on localhost:5173 |
| 28 | +- `pnpm blog:dev` - Run VitePress blog on localhost:5174 |
| 29 | + |
| 30 | +## Architecture Overview |
| 31 | + |
| 32 | +### Framework & Technology Stack |
| 33 | +- **Nuxt 3** (Vue 3) framework with TypeScript |
| 34 | +- **Tailwind CSS** for styling with **PrimeVue** component library |
| 35 | +- **Pinia** for state management |
| 36 | +- **TanStack Vue Query** for data fetching and caching |
| 37 | +- **ECharts** for data visualization |
| 38 | +- **Auth0** for authentication with OIDC/OAuth2 flows |
| 39 | +- **PostgreSQL** database integration |
| 40 | +- **Vitest** for testing, **Storybook** for component development |
| 41 | + |
| 42 | +### Project Structure |
| 43 | +``` |
| 44 | +app/ # Main application code |
| 45 | +├── assets/ # Static assets and styles |
| 46 | +├── components/ # Vue components (UI kit and feature components) |
| 47 | +├── config/ # Configuration files |
| 48 | +├── layouts/ # Nuxt layout components |
| 49 | +├── pages/ # File-based routing pages |
| 50 | +└── plugins/ # Nuxt plugins |
| 51 | +
|
| 52 | +server/ # Server-side code |
| 53 | +├── api/ # API routes and endpoints |
| 54 | +├── constants/ # Server constants |
| 55 | +├── data/ # Data layer and queries |
| 56 | +├── helpers/ # Utility functions |
| 57 | +├── middleware/ # Server middleware |
| 58 | +├── mocks/ # Mock data for development |
| 59 | +├── repo/ # Repository pattern implementations |
| 60 | +└── utils/ # Server utilities |
| 61 | +
|
| 62 | +types/ # TypeScript type definitions |
| 63 | +composables/ # Vue composables |
| 64 | +setup/ # Nuxt configuration modules |
| 65 | +``` |
| 66 | + |
| 67 | +### Key Architectural Patterns |
| 68 | + |
| 69 | +#### Authentication Flow |
| 70 | +- Uses Auth0 with PKCE (Proof Key for Code Exchange) flow |
| 71 | +- Server-side session management with HTTP-only cookies |
| 72 | +- API routes handle login (`/api/auth/login`), callback (`/api/auth/callback`), and logout |
| 73 | +- `useAuth` composable manages client-side auth state |
| 74 | +- Detailed flow documented in `AUTH_CONFIGURATION.md` |
| 75 | + |
| 76 | +#### Data Management |
| 77 | +- **Vue Query** for server state management and caching |
| 78 | +- **Pinia** stores for client-side application state |
| 79 | +- API layer in `server/api/` follows RESTful conventions |
| 80 | +- Repository pattern for data access in `server/repo/` |
| 81 | + |
| 82 | +#### Component Architecture |
| 83 | +- UI Kit components in `app/components/uikit/` for reusable design system |
| 84 | +- Feature-specific components organized by domain |
| 85 | +- PrimeVue components for complex UI patterns |
| 86 | +- Storybook for component documentation and testing |
| 87 | + |
| 88 | +#### Configuration Management |
| 89 | +- Modular Nuxt config split across `setup/` directory: |
| 90 | + - `head.ts` - Meta tags and SEO |
| 91 | + - `tailwind.ts` - Tailwind configuration |
| 92 | + - `primevue.ts` - PrimeVue theming |
| 93 | + - `caching.ts` - Route caching rules |
| 94 | + - `sitemap.ts` - Sitemap generation |
| 95 | + |
| 96 | +#### Environment & Deployment |
| 97 | +- Environment-specific configuration via runtime config |
| 98 | +- Production vs development environment detection |
| 99 | +- Proxy configuration for docs (`/docs`) and blog (`/blog`) routes |
| 100 | +- Analytics integration (Google Analytics, Plausible) |
| 101 | + |
| 102 | +### Database Integration |
| 103 | +- PostgreSQL with separate read/write hosts |
| 104 | +- Environment variables for database configuration: |
| 105 | + - `INSIGHTS_DB_WRITE_HOST` / `INSIGHTS_DB_READ_HOST` |
| 106 | + - `INSIGHTS_DB_PORT`, `INSIGHTS_DB_USERNAME`, `INSIGHTS_DB_PASSWORD` |
| 107 | + - `INSIGHTS_DB_DATABASE` |
| 108 | + |
| 109 | +### API Integration |
| 110 | +- Tinybird API integration for analytics data |
| 111 | +- GitHub API token for repository data |
| 112 | +- Redis for caching (optional) |
| 113 | +- Configurable via environment variables |
| 114 | + |
| 115 | +## Development Guidelines |
| 116 | + |
| 117 | +### TypeScript |
| 118 | +- Strict TypeScript configuration enabled |
| 119 | +- Type definitions organized in `types/` directory |
| 120 | +- Use `tsc-check` command to verify types before committing |
| 121 | + |
| 122 | +### Authentication Development |
| 123 | +- Auth0 domain differs between environments (staging vs production) |
| 124 | +- Local development uses `http://localhost:3000` callbacks |
| 125 | +- Production uses `https://insights.linuxfoundation.org` callbacks |
| 126 | +- See `AUTH_CONFIGURATION.md` for detailed setup instructions |
| 127 | + |
| 128 | +### Testing |
| 129 | +- Vitest for unit testing |
| 130 | +- Happy DOM for DOM simulation |
| 131 | +- Use `pnpm test` to run tests during development |
| 132 | + |
| 133 | +### Code Quality |
| 134 | +- ESLint with TypeScript and Vue-specific rules |
| 135 | +- Prettier for code formatting |
| 136 | +- Husky git hooks for pre-commit checks |
| 137 | +- License headers automatically added via lint-staged |
| 138 | +- whenever you generate html/vue code make sure to use ui components from the ui kit in the project src/components/uikit |
| 139 | +- make sure to always consider tailwind config file to see correct classes names |
0 commit comments