# AGENTS.md - Development Guide ## ๐Ÿ“‹ Project Overview **ermnvldmr.com** is Vladimir Eremin's personal ecosystem of services delivered through a modern monorepo architecture. The project encompasses personal websites, documentation sites, and shared infrastructure for web-based content and services. ### Monorepo Architecture - **Repository Structure**: pnpm workspace monorepo - **Package Manager**: pnpm v9.12.3+ - **Core Technology**: TypeScript (Strict mode) - **Services**: Independent web services with shared dependencies - **Packages**: Reusable configurations and component libraries - **Build System**: Distributed builds with dependency management - **CI/CD**: GitHub Actions with path-based triggers ### Design Philosophy - **Component-First**: All UI elements developed as isolated, reusable components - **Configuration Sharing**: Centralized tooling configurations across services - **TypeScript-First**: Strict typing for all public APIs and components - **Documentation-Driven**: TSDoc required for all exported elements - **Dependency Isolation**: Clear separation between packages and services - **Build Optimization**: Efficient dependency building and caching ## ๐Ÿ—๏ธ Repository Structure ``` โ”œโ”€โ”€ packages/ # Shared packages and configurations โ”‚ โ”œโ”€โ”€ eslint-config/ # Shared ESLint configurations โ”‚ โ”œโ”€โ”€ jest-config/ # Shared Jest configurations โ”‚ โ”œโ”€โ”€ storybook-config/ # Shared Storybook configurations โ”‚ โ”œโ”€โ”€ vite-config/ # Shared Vite configurations โ”‚ โ”œโ”€โ”€ stl/ # Standard Type Library (utilities) โ”‚ โ””โ”€โ”€ ui/ # Shared React component library โ”œโ”€โ”€ services/ # Independent web services โ”‚ โ”œโ”€โ”€ www/ # Main website (Astro + React) โ”‚ โ””โ”€โ”€ docs/ # Documentation site (Hugo) โ”œโ”€โ”€ .github/workflows/ # CI/CD automation โ”œโ”€โ”€ pnpm-workspace.yaml # Workspace configuration โ””โ”€โ”€ [root config files] # Global configurations ``` ### Package Organization #### Configuration Packages (`packages/`) - **eslint-config**: Shared ESLint rules for TypeScript, React, and Astro - **jest-config**: Shared Jest configurations for different project types - **storybook-config**: Shared Storybook setup and configurations - **vite-config**: Shared Vite configurations for library builds #### Library Packages (`packages/`) - **stl** (Standard Type Library): Common utilities, types, and helper functions - **ui**: React component library with design system and Storybook stories #### Service Packages (`services/`) - **www**: Main website built with Astro.js, React, and Tailwind CSS - **docs**: Documentation site built with Hugo and Hextra theme ### Key Directory Rules #### `/packages/` - **Purpose**: Shared configurations and reusable libraries - **Dependencies**: Can depend on each other following build order (configs โ†’ stl โ†’ ui) - **Exports**: Must provide proper TypeScript declarations - **Building**: Required before dependent services can build - **Testing**: Individual test suites for each package #### `/services/` - **Purpose**: Independent web applications and sites - **Dependencies**: Can consume packages but not other services - **Deployment**: Independent deployment pipelines - **Development**: Can be developed and tested in isolation - **Configuration**: Inherit from shared packages but can override ## ๐Ÿ› ๏ธ Development Workflow ### Monorepo Development Principles - **Root-Level Scripts**: Check `package.json` at repository root for monorepo-wide operations - **Service-Specific Scripts**: Each service in `services/` has its own development commands - **Package Filtering**: Use pnpm workspace filtering to target specific packages/services - **Dependency-Aware Building**: UI components must be built before dependent services ### Package Development Workflow The monorepo follows a strict dependency hierarchy that must be respected: #### 1. Configuration Packages First Configuration packages provide shared tooling setups and must be built before anything else. Look for packages ending in `-config` in the `packages/` directory. #### 2. Library Packages Library packages (`stl`, `ui`) provide reusable code and components. They depend on configuration packages and must be built in dependency order (check their `package.json` dependencies). #### 3. Services Services consume packages but are independent of each other. They can be developed and deployed separately. Check `services/` directory for available services and their individual `package.json` files for available scripts. ### Code Organization Principles - **Dependency Order**: configs โ†’ stl โ†’ ui โ†’ services - **Single Responsibility**: Each package serves one clear purpose - **Explicit Dependencies**: All inter-package dependencies declared in package.json - **Build Isolation**: Each package can be built independently - **Configuration Inheritance**: Services inherit from shared configurations ## ๐Ÿ“ Coding Conventions ### Package Naming Convention All packages use the `@ermnvldmr/` namespace: - `@ermnvldmr/eslint-config` - Shared ESLint configurations - `@ermnvldmr/jest-config` - Shared Jest configurations - `@ermnvldmr/storybook-config` - Shared Storybook configurations - `@ermnvldmr/vite-config` - Shared Vite configurations - `@ermnvldmr/stl` - Standard Type Library - `@ermnvldmr/ui` - Component library - `@ermnvldmr/www` - Main website service - `@ermnvldmr/docs` - Documentation service ### TypeScript Guidelines - **Strict Mode**: All TypeScript strict checks must pass - **Explicit Types**: Avoid `any` and prefer explicit type definitions - **Interface First**: Use interfaces for component props and public APIs - **Cross-Package Types**: Export types from packages for service consumption ### TSDoc Documentation Requirements **MANDATORY for all exported elements**: types, functions, constants, components ```typescript /** * Combines class names using clsx and tailwind-merge for consistent styling. * * @param inputs - Class name inputs to combine * @returns Combined and deduplicated class string * * @example * \`\`\`typescript * cn('px-4 py-2', 'bg-blue-500', 'px-6') // 'py-2 bg-blue-500 px-6' * cn('text-lg', condition && 'font-bold') // 'text-lg font-bold' * \`\`\` */ export function cn(...inputs: ClassValue[]): string { return twMerge(clsx(inputs)); } ``` ### Component Development Patterns #### UI Package Components ```typescript /** * Props for the Button component. */ export interface ButtonProps { /** The button content */ children: React.ReactNode; /** Visual style variant */ variant?: 'default' | 'destructive' | 'outline' | 'secondary' | 'ghost' | 'link'; /** Button size */ size?: 'default' | 'sm' | 'lg' | 'icon'; } /** * Versatile button component with multiple variants and sizes. */ export const Button = React.forwardRef( ({ className, variant = 'default', size = 'default', ...props }, ref) => { return ( ); expect(screen.getByRole('button')).toHaveClass('destructive'); }); }); ``` ### Coverage Strategy - **Package Coverage**: Individual coverage reports per package - **Service Coverage**: Service-specific coverage including Storybook tests - **Aggregated Coverage**: Combined reporting for the entire monorepo --- *This guide serves as the architectural foundation for the monorepo. Focus on these stable patterns and structures rather than specific implementation details that may change over time.*