Quick Start
Minimal Setup
Add to .npmrc in your project root:
@enterpriseaigroup:registry=https://enterpriseaigroup.github.io/enterpriseai-packages/registry
npm install @enterpriseaigroup/core
// app/layout.tsx
import { EAIProvider } from '@enterpriseaigroup/core';
import '@enterpriseaigroup/core/styles.css';
export default function RootLayout({ children }) {
return (
<EAIProvider>
{children}
</EAIProvider>
);
}
// lib/config.ts
import { defineConfig } from '@enterpriseaigroup/core/config';
export const config = defineConfig({
tenant: {
name: 'My App',
slug: 'my-app',
},
api: {
baseUrl: '/api/v1',
endpoints: {
// Add your API endpoints here
},
},
});
Subpath Exports
Core provides multiple entry points so you can import only what you need. This enables tree-shaking and avoids pulling server-only code into client bundles.
| Import Path | Description | Environment |
|---|---|---|
@enterpriseaigroup/core |
Main entry — types, UI components, providers, config, hooks, stores, utilities | Client |
@enterpriseaigroup/core/config |
Config system — defineConfig, store, registry, layout components, tenant registry |
Client |
@enterpriseaigroup/core/config/server |
Server-side config helpers (runtime config fetching) | Server only |
@enterpriseaigroup/core/server |
Server utilities (auth, middleware helpers) | Server only |
@enterpriseaigroup/core/providers |
All providers — EAIProvider, AuthProvider, RootProviders, QueryProvider, APIConfigProvider | Client |
@enterpriseaigroup/core/hooks |
All hooks — useConfig, useAuth, useProvisioning, useTenantConfig, etc. | Client |
@enterpriseaigroup/core/ui |
Shadcn/ui components — Button, Input, Card, Dialog, Select, Table, etc. | Client |
@enterpriseaigroup/core/utils |
Utility functions — cn() (class name merging) |
Universal |
@enterpriseaigroup/core/styles.css |
Global CSS — Tailwind base styles, CSS variables, component styles | Universal |
@enterpriseaigroup/core/theme.css |
Theme CSS — CSS custom properties for theming | Universal |
API Reference
Types
APIConfig, StandaloneAPIConfig, AuthenticatedAPIConfig, OAuthAPIConfig, ProxyAPIConfig
API configuration type variants for different auth strategies.
BaseComponentProps, APIIntegratedProps, VariantProps, APIComponentProps, FormComponentProps
Standardized prop interfaces for building typed components.
ButtonBaseProps, InputBaseProps
Base prop types for primitive UI components.
EAIConfig, TenantMetaConfig, ApiConfig, ApiEndpointsConfig, FeaturesConfig, NavigationConfig, RoutesConfig, StorageConfig, RuntimeConfig
Configuration object types for the config-driven architecture.
GlobalStore, GlobalStoreState, GlobalStoreActions, StoreSliceDefinition, StoreBinding
Zustand store types for the global state system.
ChatMessage, MessageName, FeedbackType, DocumentItem
Domain types for messaging and document workflows.
UI Components (Shadcn/ui)
Button, buttonVariants
Button with variant support (default, destructive, outline, secondary, ghost, link).
Input, Textarea, Label, Checkbox, Switch, RadioGroup
Form input primitives.
Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter
Card layout components.
Dialog, DialogTrigger, DialogContent, DialogHeader, DialogFooter, DialogTitle, DialogDescription
Modal dialog components.
Select, SelectTrigger, SelectContent, SelectItem, SelectValue
Dropdown select components.
DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem
Context menu / dropdown menu components.
Table, TableHeader, TableBody, TableRow, TableHead, TableCell
Data table components.
Tooltip, TooltipTrigger, TooltipContent, TooltipProvider
Tooltip components.
Popover, PopoverTrigger, PopoverContent
Popover components.
Command, CommandInput, CommandList, CommandItem, CommandGroup
Command palette / search components (cmdk).
Tabs, TabsList, TabsTrigger, TabsContent
Tab navigation components.
Accordion, AccordionItem, AccordionTrigger, AccordionContent
Collapsible accordion components.
Alert, AlertTitle, AlertDescription
Alert / callout components.
Badge, badgeVariants
Badge component with variant support.
Toaster
Toast notification container (sonner).
Loader, LoginLoader
Loading state components.
Providers
EAIProvider
Top-level provider wrapping auth, query client, config, and toaster. Use this as the single root wrapper.
RootProviders
Combines SessionProvider + QueryProvider + EAIConfigProvider. Used internally by EAIProvider.
AuthProvider, useAuth
Auth context provider and hook. Provides
isAuthenticated, isSessionLoading, onLogin, onLogout.APIConfigProvider, useAPIConfig, useAPIClient
API configuration context. Provides typed API client with auth headers.
QueryProvider, createQueryClient
TanStack Query provider wrapper with default client factory.
EAIConfigProvider, useEAIConfig
Config-driven architecture provider. Delivers
EAIConfig to all descendants.Config System
defineConfig(config)
Type-safe config factory. Returns a validated
EAIConfig object.createGlobalStore(slices)
Creates the Zustand global store from slice definitions.
createDefaultRegistry(), validateConfig(), getRegisteredComponents()
Component registry utilities for the slot-based layout system.
registerTenant(), getTenantConfig(), getRegisteredTenants(), hasTenant(), clearTenantRegistry()
Multi-tenant registry — register, look up, and manage tenant configurations.
SlotRenderer, HeaderSlot, LeftPaneSlot, MiddlePaneSlot, RightPaneSlot
Config-driven layout slot components. Render components registered to named slots.
ConfiguredLayout, MinimalLayout, MobileConfiguredLayout, MobilePaneController
Pre-built layout shells driven by config. Three-panel desktop, mobile pane switcher.
PageRenderer, usePageConfig, useAllPages
Page rendering system (v6.0.0). Config-driven page resolution and rendering.
useNavigationAction
Hook for executing navigation actions defined in config.
resolveIcon(), renderIcon(), getAvailableIcons()
Icon resolution from config-driven icon names to Lucide React components.
Hooks
useConfig()
Access the full
EAIConfig object from context.useGlobalStore(), useGlobalSelector(), useStoreValue(), useStoreGetter()
Zustand store access hooks. Select slices, read values, subscribe to changes.
useSetStore(), useBatchSetStore(), useResetSlice(), useClearPersistedStore()
Store mutation hooks. Set values, batch updates, reset slices, clear persistence.
useStoreBindings(), useConditional(), useSlotVisibility()
Config binding hooks. Wire store state to component props and slot visibility.
useComponentRegistry()
Access the component registry for dynamic component resolution.
useProvisioning()
User provisioning hook. Check and manage user onboarding state.
useTenantConfig()
Resolves and returns the current tenant's config. Handles tenant switching.
useUserProfile()
Access the authenticated user's profile data.
useApiEndpoints()
Access centralized API endpoints. Returns
getEndpoint() and getApiUrl() helpers.useAuthStateSync()
Keeps authentication state synchronized across providers.
useConfigStorage()
Config-driven storage abstraction (localStorage / sessionStorage).
useFallbackTenantID()
Returns a tenant ID with fallback logic (cookie → config → default).
useIsMobile()
Responsive breakpoint hook. Returns
true on mobile viewports.useWebPubSub()
Real-time messaging hook.
useDebounceValue()
Debounced state hook with configurable delay.
Zustand Stores
useAuthStore
Authentication state store (token, user info, auth status).
useApiStatusStore
API health/status tracking store.
useProfileStore
User profile data store.
Utilities
cn(...classes)
Class name merge utility (clsx + tailwind-merge). The standard way to compose class names.
createAPIClient(config)
Factory for typed HTTP client with auth headers, error handling, and retry logic.
cvx(), cva(), composeVariants(), createResponsiveVariant()
Variant utilities for building component variant APIs (class-variance-authority).
handleApiError()
Shared API error normalizer. Converts fetch/axios errors into
NormalizedError.setTenantCookie(), getTenantCookie(), clearTenantCookie(), syncTenantToCookie()
Tenant cookie utilities for persisting tenant selection across requests.
createSessionManager(), resetForLogout(), resetForProjectChange(), clearAllEAISession()
Session management utilities. Clear storage, reset state for various user flows.
devLog(), devInfo(), devWarn()
Development-only logging utilities (stripped in production).
deepMerge()
Deep object merge utility.
Peer Dependencies
Your consuming app must install these alongside core:
| Package | Version | Required |
|---|---|---|
react | ^18.0.0 || ^19.0.0 | Yes |
react-dom | ^18.0.0 || ^19.0.0 | Yes |
next | ^14.0.0 || ^15.0.0 || ^16.0.0 | Yes |
next-auth | ^5.0.0-beta.25 | Yes |
zustand | ^5.0.0 | Yes |
@tanstack/react-query | ^5.0.0 | Yes |
@tanstack/react-query-devtools | ^5.0.0 | Optional |
sharp | ^0.33.0 | Optional (favicon generation) |