PACE.js
The official JavaScript framework for building PACE Pattern applications.
Overview
PACE.js is a lightweight (15KB), zero-dependency JavaScript framework that makes it easy to build guide-first, conversational interfaces following the PACE Pattern.
Repository: github.com/semanticintent/pace.jsNPM: @semanticintent/pace-patternLicense: MIT
Quick Start
npm install @semanticintent/pace-patternimport { PACE } from '@semanticintent/pace-pattern'
const pace = new PACE({
container: '#app',
products: './products.json'
})
pace.mount()That's it! Your PACE app is live.
Why PACE.js?
1. Tiny Bundle Size
PACE.js: 15KB minified + gzipped
React: 42KB
Vue: 34KB
Alpine.js: 15KB6x smaller than React. Same power.
2. Zero Dependencies
{
"dependencies": {}
}No npm dependency hell. No security vulnerabilities. No version conflicts.
3. Framework Agnostic
// Standalone
new PACE({ container: '#app' })
// With React
<PACEReact config={config} />
// With Vue
<pace-component :config="config" />
// With Svelte
<PACE {config} />Works anywhere JavaScript runs.
4. Built-in AI
const pace = new PACE({
aiAdapter: new ClaudeAdapter({ apiKey: '...' })
})Claude, OpenAI, or custom adapters included.
Architecture
Core Modules
1. PACE Orchestrator
- Main controller
- Lifecycle management
- Plugin system
2. State Manager
- Reactive state
- Observer pattern
- Subscribe/notify
3. Router
- Hash-based routing
- Deep linking
- View management
4. Component System
- ProductCatalog
- AboutPage
- ChatWidget
- ExecutiveSummary
Data Flow
Features
Reactive State
state.set('activeView', 'chat')
state.subscribe('activeView', (newView) => {
console.log('View changed:', newView)
})Event System
pace.on('product:select', ({ product }) => {
console.log('Selected:', product.name)
})
pace.on('chat:message', ({ message }) => {
console.log('User said:', message)
})Plugin Architecture
const analyticsPlugin = {
name: 'analytics',
install(pace) {
pace.on('product:select', ({ product }) => {
gtag('event', 'product_view', { product_id: product.id })
})
}
}
pace.use(analyticsPlugin)Theme System
const pace = new PACE({
theme: {
primary: '#3b82f6',
accent: '#8b5cf6',
font: 'Roboto, sans-serif'
}
})Components
ProductCatalog
Display and filter products:
import { ProductCatalog } from '@semanticintent/pace-pattern'
const catalog = new ProductCatalog(products, state)
catalog.render()
catalog.search('database')ChatWidget
Conversational interface:
import { ChatWidget } from '@semanticintent/pace-pattern'
const chat = new ChatWidget({
aiAdapter: claudeAdapter,
greeting: 'Welcome!'
}, state)ExecutiveSummary
Real-time insights:
import { ExecutiveSummary } from '@semanticintent/pace-pattern'
const summary = new ExecutiveSummary(config, state)
summary.trackProduct(product)
summary.setExpertise('advanced')AI Adapters
Claude
import { ClaudeAdapter } from '@semanticintent/pace-pattern'
const adapter = new ClaudeAdapter({
apiKey: process.env.CLAUDE_API_KEY,
model: 'claude-3-sonnet-20240229'
})OpenAI
import { OpenAIAdapter } from '@semanticintent/pace-pattern'
const adapter = new OpenAIAdapter({
apiKey: process.env.OPENAI_API_KEY,
model: 'gpt-4'
})Custom
class MyAdapter {
async sendMessage(message, context) {
const response = await fetch('/api/chat', {
method: 'POST',
body: JSON.stringify({ message, context })
})
return await response.json()
}
}Development
Repository Structure
pace.js/
├── src/
│ ├── core/
│ │ ├── pace.js
│ │ ├── state.js
│ │ └── router.js
│ ├── components/
│ │ ├── product-catalog.js
│ │ ├── about-page.js
│ │ ├── chat-widget.js
│ │ └── executive-summary.js
│ └── adapters/
│ ├── claude.js
│ └── openai.js
├── dist/
│ ├── pace.min.js
│ ├── pace.esm.js
│ └── pace.min.css
├── examples/
│ ├── minimal/
│ ├── millpond/
│ └── react/
├── docs/
└── tests/Build
npm run buildOutputs:
pace.min.js— UMD bundlepace.esm.js— ES modulepace.min.css— Styles
Test
npm testUses Jest for unit tests.
Versioning
Current: v1.0.1
Published: December 23, 2024 DOI: 10.5281/zenodo.18049371
Roadmap
v1.1.0 (Q1 2025)
- Streaming AI responses
- Vue official adapter
- Svelte official adapter
v1.2.0 (Q2 2025)
- SSR support
- i18n/l10n
- Voice interface
v2.0.0 (Q3 2025)
- Breaking changes (if needed)
- Multi-modal support
- Advanced analytics
Community
GitHub
- Stars: Growing
- Forks: Active
- Issues: Responsive
- PRs: Welcome
NPM
- Downloads: Weekly growth
- Dependents: Expanding
- Version: Stable
Contributors
Built by the open source community:
- Core maintainers: 2
- Contributors: Growing
- Community examples: Multiple
Resources
- Documentation: pace.cormorantforaging.dev
- GitHub: semanticintent/pace.js
- NPM: @semanticintent/pace-pattern
- Examples: Examples Section
Get Started
Ready to build with PACE.js?
- Quick Start Guide — 5-minute setup
- First App Tutorial — Complete walkthrough
- API Reference — Full documentation
- Examples — Real implementations
15KB. Zero dependencies. Framework agnostic. That's PACE.js. ✨