This file provides comprehensive instructions for AI coding agents working within the HAX ecosystem. HAX (Headless Authoring eXperience) is a comprehensive web development ecosystem that enables rapid creation of accessible, performant web components and static sites. Follow these guidelines to set up, develop, test, and contribute effectively to HAX projects.
The HAX ecosystem consists of multiple interconnected repositories, each serving specific purposes:
-
webcomponents- The heart of HAX: a monorepo containing 250+ LitElement-based web components, themes, and the DDD design system. All components are built with accessibility, performance, and HAX compatibility in mind. -
create(@haxtheweb/create) - The HAX CLI tool for scaffolding new web components, HAXsites, and managing the development workflow. This is your primary interface for creating new HAX projects. -
haxcms-php- PHP backend implementation of HAXcms, providing content management capabilities, API endpoints, and server-side rendering for HAXsites. -
haxcms-nodejs- Node.js backend implementation of HAXcms, offering the same capabilities as the PHP version but in a JavaScript environment. -
desktop- Electron-based desktop application that provides a local development environment for HAX, combining the power of HAXcms with desktop convenience.
-
hax11ty- Integration layer that bridges HAX components with Eleventy (11ty) static site generator, enabling HAX components in traditional static sites. -
json-outline-schema- Defines the JSON schema used by HAXcms for content structure, site navigation, and metadata management. -
hax-schema- Contains HAX property schemas that define how web components integrate with the HAX authoring interface. -
open-apis- Microservice APIs and shared infrastructure for HAXTheWeb ecosystem. Contains Express-based Vercel endpoints deployed at https://open-apis.hax.cloud/ providing advanced capabilities like content importing, parsing, analysis, site conversion, and migration services. Also hosts the pre-built Storybook documentation for HAX components. -
docs- Official HAX documentation site built as a HAXcms site. Contains comprehensive documentation about HAX philosophy, pillars, community guidelines, tutorials, and developer resources. Structure follows HAXcms conventions with site.json (JSON Outline Schema), pages/ directory for content, and files/ for assets. -
issues- Unified issue tracking repository for the entire HAX ecosystem, where all bugs, features, and discussions are centralized.
HAX is built on a foundation of community pillars that guide all development decisions and community interactions. These are not just technical specifications but ethical commitments:
- Accessible: HAX maximizes accessibility while removing the knowledge required to maintain accessibility standards. Components adhere to WCAG 2.0 AA standards, with automated color contrast ratios and expert-audited implementations.
- Extensible: Built for sustainable extension through web standards, microservices, and modular architecture that grows with user needs.
- Free and Open: Open community welcoming all (Penn State and beyond), embracing the 5Rs of OER (Retain, Reuse, Revise, Remix, Redistribute) for content and code.
- Efficient: Optimized for performance through web standards over heavy libraries, lazy loading, offline capability, and minimal resource usage.
- Platform Agnostic: Works anywhere - standalone HAXsites, integrated HAXcms, static web pages, or existing CMS platforms.
- Remixable: Maximizes remix-ability through modular design, open licensing, and semantic content structures.
- Sustainable: Environmental (less data, lower battery usage), technological (web standards-based longevity), and community (inclusive, collaborative governance) sustainability.
- Rapid Development: Scaffolding tools and design systems accelerate creation
- Unbundled Delivery: Pure JavaScript, HTML, CSS approach without compilation steps
- Modularity: Components work independently and compose together seamlessly
- Ubiquitous Web: The web needs a file format - content should "just work" regardless of how it was built
Before starting any work, check the unified issue queue:
- All HAX ecosystem issues are tracked at
haxtheweb/issues - Use GitHub CLI to check issues:
gh issue list - Reference existing issues when making contributions
- Install HAX CLI globally:
npm install @haxtheweb/create --global
- Install project dependencies (run from the project root):
npm install
- Start interactive CLI (for web components or HAXsites):
hax start
- Launches an interactive CLI with ASCII art (via Clack).
- Start development server (for HAXsites):
hax serve
- Launches the site in development mode at
http://localhost.
- Launches the site in development mode at
- Create a new web component:
hax webcomponent my-element --y
- Creates a LitElement-based web component with DDD design system and i18n support.
- In a monorepo, places the component in the correct location and inherits settings.
- Create a new HAXsite:
hax site mysite --y
- Generates a HAXcms-based static site with templated files.
- Update HAX CLI:
hax update
- Alternative usage (one-time execution without global install):
or
npx @haxtheweb/create
npm init @haxtheweb
- Windows-specific setup:
- If issues occur, set a custom npm cache path:
npm config set cache C:\tmp\nodejs\npm-cache --global
- For PowerShell, check execution policy to allow scripts:
Adjust if needed using
Get-ExecutionPolicy
Set-ExecutionPolicy(see Microsoft documentation).
- If issues occur, set a custom npm cache path:
- Language: Pure JavaScript with LitElement for web components
- NO TypeScript: HAX strictly avoids TypeScript to eliminate compilation requirements
- Unbundled Approach: Components ship as native JS/HTML/CSS for maximum compatibility
- Third-party Libraries: When using libraries written in TypeScript, always import the pre-compiled JavaScript distribution
- External Dependencies: Leverage libraries like
vaadin-upload,shoelace-carousel, etc. but always use their JS builds
- Global References: Use
globalThisinstead ofwindowfor consistency across environments - Formatting:
- Use single quotes (
') - Avoid semicolons where possible
- Prefer functional programming patterns
- Use Prettier for consistent formatting
- Use single quotes (
- ES Modules: Use standard ES6 import/export syntax
- Modern JavaScript: Leverage ES2018+ features while maintaining browser compatibility
- DDD System: All components MUST adhere to the DDD (Design, Develop, Destroy) design system
- Location:
elements/d-d-din the webcomponents repository - Use DDD for fonts, colors, padding, spacing, margins, and other design tokens
- Inherit from
DDDSuperclass for automatic DDD integration - Reference
.dddignorefile to exclude irrelevant files during audits
- Location:
- HAX Properties: Include
haxPropertiesin web components for HAX compatibility (use--writeHaxPropertiesflag) - Theme Development: HAXcms themes should extend
HAXCMSLitElementclass - File Structure:
- Web components: Place source files in
src/orlib/directories - HAXsites: Pages in
pages/, themes intheme/, assets inassets/ - Monorepo: Each component gets its own directory in
elements/
- Web components: Place source files in
- Web Components: Use hyphenated names (e.g.,
my-element) - Package Names: Match component/site name in
package.json - CSS Classes: Follow BEM methodology when not using DDD tokens
- Use provided i18n wiring for web components (automatically included with
hax webcomponent) - Support multiple languages from the start
The HAX ecosystem uses a sophisticated build pipeline optimized for unbundled JavaScript delivery:
- Gulp: Handles asset compilation and processing
- Prettier: Ensures consistent code formatting
- CEM (Custom Elements Manifest): Generates
custom-elements.jsonfor component metadata - Lerna: Manages monorepo dependencies and publishing
- No TypeScript Compilation: Pure JavaScript workflow eliminates build complexity
-
Standard build (from component root):
yarn run build
- Compiles assets, formats code, generates custom-elements.json
- CRITICAL: Always run this after changes to HAXCMSLitElement themes
- Do NOT manually edit
custom-elements.json- it's auto-generated
-
Development build with watching:
yarn run dev
-
Monorepo build (from webcomponents root):
yarn run build
- Builds all components in the monorepo
-
Run tests (from project or component root):
npm test -
Monorepo testing:
npm run test --filter <component_name>
- Tests specific component in monorepo
- Use Lerna for more complex filtering
- Audit web components for DDD compliance:
hax audit
- Checks CSS and structure against DDD design system standards
- Ignores files listed in
.dddignore - Run from component root for accurate results
- Required before submitting theme components
-
Linting:
npm run lint
- Ensures code style compliance before committing
- Uses ESLint, Prettier, and Stylelint
-
Fix issues automatically:
npm run lint:fix
/node_modules
/dist
/build
/public
/test
/.github
/.vscode
/.idea
/locales
LICENSE
.dddignore
.editorconfig
.gitignore
.npmignore
*.md
*.yml
*.json
*.png
*.svg
- PR Title Format:
[<project_name>] <Descriptive Title>- Example:
[my-element] Add dynamic property binding
- Example:
- Pre-commit checks:
- Run
npm testto ensure all tests pass. - Run
npm run lintto verify code style. - Run
hax auditfor web components to confirm DDD compliance.
- Run
- Commit Guidelines:
- Use clear, descriptive commit messages (e.g., "Add i18n support to my-element").
- Include relevant changes to tests or documentation.
- HAXsite PRs:
- Test locally with
hax serveto verify page rendering. - Ensure new pages or content updates align with
site.jsonand JSON Outline Schema.
- Test locally with
The HAX CLI supports various options for fine-tuned control. Use hax help, hax webcomponent --help, or hax site --help for details. Key options include:
--v: Verbose output.--debug: Developer-focused output.--format <char>: Output format (json, yaml; default: json).--path <char>: Directory to perform operation.--name <char>: Project or component name.--npm-client <char>: Package manager (npm, yarn, pnpm; default: npm).--yor--auto: Auto-accept all prompts.--skip: Skip animations for faster execution.--quiet: Suppress console logging.--no-i: Prevent interactive sub-processes (ideal for scripting).--to-file <char>: Redirect output to a file.--no-extras: Skip automatic command processing.--root <char>: Root directory for command execution.--org <char>: Organization forpackage.json.--author <char>: Author for site orpackage.json.--writeHaxProperties: WritehaxPropertiesfor web components.--import-site <char>: URL of site to import.--import-structure <char>: Import method (e.g., pressbooksToSite, htmlToSite).--custom-theme-name <char>: Custom theme name for HAXsites.--custom-theme-template <char>: Theme template (base, polaris-flex, polaris-sidebar).--repos <char...>: Repositories to clone.
- Base Class: HAXcms themes extend
HAXCMSLitElementclass - Design Integration: Themes inherit DDD design system automatically
- Template Options: Choose from
base,polaris-flex,polaris-sidebar - Custom Themes: Create entirely custom themes with full control
- Pure JavaScript: All theme code written in JavaScript, HTML, CSS only
-
Create custom theme:
hax site --custom-theme-name my-theme --custom-theme-template base
-
Modify theme files in the generated theme directory
- Edit JavaScript files directly (no TypeScript compilation needed)
- Use standard HTML templates
- Apply CSS with DDD tokens
-
Build theme (CRITICAL STEP):
yarn run build
- Generates
custom-elements.json - Compiles styles and assets
- Updates component metadata
- Generates
-
Test theme locally:
hax serve
- Use DDD tokens for consistent styling
- Import external libraries from their JavaScript distributions
- Implement responsive design patterns
- Ensure accessibility compliance
- Test across different content types
- Follow HAX component patterns
~/Documents/git/haxtheweb/
├── webcomponents/ # Component library & themes
│ └── elements/ # Individual components
│ ├── d-d-d/ # Design system
│ ├── clean-two/ # Example theme
│ └── [250+ more]/ # All other components
├── create/ # HAX CLI tool
├── haxcms-php/ # PHP backend
├── haxcms-nodejs/ # Node.js backend
├── desktop/ # Electron app
├── hax11ty/ # 11ty integration
├── json-outline-schema/ # Content schemas
├── hax-schema/ # HAX property schemas
├── open-apis/ # Microservice APIs & Component Gallery
│ ├── api/ # Express Vercel endpoints
│ │ ├── apps/ # HAXcms conversion services
│ │ ├── services/ # Media processing, analysis
│ │ ├── users/ # Authentication endpoints
│ │ └── utilities/ # Shared API helpers
│ └── component-gallery/# Component documentation
├── docs/ # Official HAX documentation
│ ├── site.json # JSON Outline Schema structure
│ ├── pages/ # Documentation content (HTML)
│ └── files/ # Assets and media
└── issues/ # Unified issue tracking
- Component Development: Work in
webcomponents/elements/[component-name]/ - CLI Development: Work in
create/ - Backend Development: Choose
haxcms-php/orhaxcms-nodejs/ - API/Microservices: Develop Express endpoints in
open-apis/api/ - Documentation: Update in
docs/(HAXcms site format) - Schema Changes: Update in
json-outline-schema/orhax-schema/ - Issues: Always check
issues/first
# Run command across all components
lerna run build
# Publish components (maintainers only)
lerna publish
# Add dependency to specific component
lerna add package-name --scope=@haxtheweb/component-name-
Import from external sources:
hax site --import-site https://example.com --import-structure htmlToSite
-
Supported import methods:
pressbooksToSite- Academic textbook platformelmslnToSite- ELMS Learning NetworkhaxcmsToSite- Between HAXcms instancesnotionToSite- Notion workspacegitbookToSite- GitBook documentationevolutionToSite- Evolution CMShtmlToSite- Generic HTML importdocxToSite- Microsoft Word documents
-
Add pages programmatically:
hax site --title "New Page" --content "<p>Content</p>" --slug "new-page"
-
Advanced page options:
hax site --title "Page" --parent "parent-slug" --order 3 --theme "custom-theme" --hide-in-menu
- Check issues:
gh issue list - Create issues:
gh issue create - Review PRs:
gh pr review - CLI is pre-installed - use directly without verification
- Vaadin Components: Import from
@vaadin/[component]/[component].js - Shoelace Components: Import from
@shoelace-style/shoelace/dist/components/[component]/[component].js - Other Libraries: Always use the
/dist/or compiled JavaScript version - Open APIs: Leverage https://open-apis.hax.cloud/ for conversion, analysis, and processing services
- Avoid: Direct TypeScript imports or source files requiring compilation
HAX leverages cloud infrastructure at https://hax.cloud for:
- CDN: Content delivery network for component libraries
- AI Services: Content analysis and processing capabilities
- Documentation: Centralized documentation and community resources
- Open Infrastructure: Publicly available APIs and services
- open-apis.hax.cloud: Conversion, analysis, and processing services
- Stateless Design: Services designed for scalability and reliability
- REST APIs: Standard HTTP interfaces for integration
- Vercel Deployment: Serverless functions for optimal performance
- Monorepo Support: Place additional
AGENTS.mdfiles in subproject folders for component-specific instructions - Schema Evolution: Changes to JSON schemas require coordination across repositories
- Component Dependencies: Use
@haxtheweb/scope for internal dependencies - Version Synchronization: Components should maintain version alignment
- No Compilation Step: Pure JavaScript approach means faster development cycles
- API Development: Express endpoints in
open-apis/deploy automatically to Vercel at https://open-apis.hax.cloud/
- HAXcms Format: Documentation sites use HAXcms structure (site.json + pages/ + files/)
- JSON Outline Schema: All content structure follows standardized schema
- Semantic HTML: Content authored in semantic HTML for maximum portability
- Asset Management: Media files organized in files/ directory with proper metadata
- Pillar-Driven Development: All decisions evaluated against community pillars
- Inclusive Decision Making: Community input welcomed on major changes
- Issue-Driven Development: Work organized through GitHub issues with pillar labels
- Educational Mission: Remember HAX's roots in empowering educators and learners
HAX has deep roots in educational technology, evolving from over a decade of work in online learning:
- ELMS:LN Legacy: HAX evolved from ELMS Learning Network (2012-2022), a Next Generation Digital Learning Environment (NGDLE) that powered hundreds of online courses at Penn State and beyond
- OER Commitment: Embraces the 5Rs of Open Educational Resources (Retain, Reuse, Revise, Remix, Redistribute)
- Instructional Design Focus: Built-in support for pedagogical patterns through specialized components
HAX includes purpose-built components for learning:
- Question Types: Multiple choice, fill-in-the-blanks, drag-and-drop, true/false, short answer, sorting, tagging
- Instructional Tools: Self-check activities, stop notes, timelines, math notation (MathML/LaTeX)
- Assessment Features: Immediate feedback, progressive disclosure, formative assessment patterns
- Accessibility in Learning: Screen reader compatibility, keyboard navigation, high contrast support
- Chunked Content: Break complex topics into digestible components
- Active Learning: Interactive elements encourage engagement over passive consumption
- Universal Design for Learning: Multiple means of representation, engagement, and expression
- Evidence-Based Design: Components based on learning science research
- ELMS:LN: Legacy platform still maintained but effectively replaced by HAX
- Course Design Templates: Pre-built pedagogical frameworks for common course structures
- Learning Analytics: Integration points for tracking learner engagement and progress
- HAX Community: Run
hax partyfor involvement opportunities - Discord: https://bit.ly/hax-discord
- Issue Reporting: Use
haxtheweb/issuesor GitHub interface - Merlin Integration: Use "Issue" command in HAX spaces for automated reporting
- Documentation: Run
man hax(Linux/macOS) for comprehensive CLI docs - Educational Resources: Complete documentation at https://haxtheweb.org/
- Dependencies: Keep dependencies updated before running
npm install - Sensitive Data: Avoid committing API keys or sensitive data to
package.json,site.json, or public files - Site Imports: Validate source URLs when using
--import-siteto prevent malicious content - File Permissions: Ensure scripts have correct execution permissions (
chmod +x script.sh) - Component Security: Sanitize user inputs in custom components
- Schema Validation: Validate against JSON schemas before processing content
- Library Security: Only import from trusted, well-maintained JavaScript distributions
- Missing custom-elements.json: Run
yarn run buildfrom component root - DDD Audit Failures: Check
.dddignoreand fix CSS token usage - Lerna Issues: Run
lerna clean && lerna bootstrap
- Wrong Directory: Always work from
haxtheweb/ - CLI Not Found: Ensure
@haxtheweb/createis globally installed - Permission Errors: Check file permissions and ownership
- Theme Not Loading: Verify HAXCMSLitElement inheritance and build process
- DDD Tokens Missing: Import DDD properly and use CSS custom properties
- HAX Integration: Ensure
haxPropertiesare defined correctly - Library Import Errors: Verify you're importing JavaScript distributions, not TypeScript sources
- Slow Loading: Check for unnecessary dependencies or large imports
- Bundle Size: HAX's unbundled approach should keep individual files small
- Memory Usage: Monitor component lifecycle and cleanup
This AGENTS.md file is maintained across all HAX ecosystem repositories to ensure consistent development experience regardless of entry point.