Overview
The demo package is a copy-and-rename starting point for building new vertical applications on top of @enterpriseaigroup/core. It demonstrates the patterns every vertical should follow: example components, hooks, providers, and a config-driven component registry.
Install
Add to .npmrc in your project root:
@enterpriseaigroup:registry=https://enterpriseaigroup.github.io/enterpriseai-packages/registry
npm install @enterpriseaigroup/demo
Requires @enterpriseaigroup/core as a dependency (installed automatically).
Exports
Components
ExampleCard
title, description, onAction, actionLabel, and children.DemoPage
componentOverrides.Hooks
useExample(options?)
{ value, setValue, reset }. Accepts optional initialValue.Providers
ExampleProvider
exampleState + setExampleState.useExampleContext()
DemoProvider
tenants (required), authProvider, runtimeConfigEndpoint, tenantResolver, loadingComponent, queryClientOptions.useAuth()
{ isAuthenticated, isSessionLoading, onLogin, onLogout }.Config
createDemoRegistry()
Map<string, ComponentType>.Create a New Vertical
Follow these steps to scaffold a new domain-specific package from the demo template.
Step-by-Step
1 Copy the demo package
cp -r packages/demo packages/your-vertical
2 Update package.json
Change name, description, and add domain-specific dependencies:
{
"name": "@enterpriseaigroup/your-vertical",
"description": "Your vertical description",
"dependencies": {
"@enterpriseaigroup/core": "*"
}
}
3 Build your components
Replace the example files with your domain components:
src/ components/ # Domain-specific UI components hooks/ # Custom hooks providers/ # Context providers config/ # Component registry, config helpers index.ts # Re-export everything
4 Update exports (if adding sub-paths)
// package.json
"exports": {
".": { "types": "./dist/index.d.ts", "import": "./dist/index.js", "require": "./dist/index.cjs" },
"./your-feature": { "types": "./dist/your-feature/index.d.ts", "import": "./dist/your-feature/index.js" }
}
5 Register in monorepo tooling
Update sync-local.sh and .github/workflows/publish.yml to include your new package.
Importing from Core
Verticals depend on @enterpriseaigroup/core. Here's how to use core within your vertical package:
// Use core UI components
import { Button, Card, CardContent, Input } from '@enterpriseaigroup/core';
// Use core hooks
import { useConfig, useApiEndpoints, useAuth } from '@enterpriseaigroup/core';
// Use the config system
import { defineConfig, registerTenant } from '@enterpriseaigroup/core/config';
// Use utilities
import { cn } from '@enterpriseaigroup/core/utils';
Setting Up Your Provider
Model your root provider after DemoProvider. It composes core's providers into a single wrapper:
// your-vertical/src/providers/YourProvider.tsx
import { EAIConfigProvider, QueryProvider, AuthProvider } from '@enterpriseaigroup/core/providers';
import { Toaster } from '@enterpriseaigroup/core';
export function YourProvider({ children, tenants }) {
return (
<QueryProvider>
<EAIConfigProvider tenants={tenants}>
<AuthProvider>
{children}
<Toaster />
</AuthProvider>
</EAIConfigProvider>
</QueryProvider>
);
}
Creating a Component Registry
Register your domain components so the config-driven layout system can render them:
// your-vertical/src/config/registry.ts
import { createDefaultRegistry } from '@enterpriseaigroup/core/config';
import { YourDashboard } from '../components/YourDashboard';
import { YourSidebar } from '../components/YourSidebar';
export function createYourRegistry() {
const registry = createDefaultRegistry();
registry.set('YourDashboard', YourDashboard);
registry.set('YourSidebar', YourSidebar);
return registry;
}
Package Structure
packages/demo/
src/
components/
ExampleCard.tsx # Demo card component
DemoPage.tsx # Config-driven page
index.ts
hooks/
useExample.ts # Demo hook
index.ts
providers/
ExampleProvider.tsx # Simple context provider
DemoProvider.tsx # All-in-one root provider
index.ts
config/
registry.ts # createDemoRegistry()
index.ts
index.ts # Main entry point
dist/ # Built output (tsup)
tsup.config.ts
package.json