
Security News
The Hidden Blast Radius of the Axios Compromise
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.
@optifye/dashboard-core
Advanced tools
A comprehensive React component library and core utilities package for building enterprise-grade operational dashboards with real-time metrics, visualizations, and interactive views.
The @optifye/dashboard-core package provides a complete solution for building data-rich, real-time operational dashboards for manufacturing, production lines, and industrial workspaces. It includes a comprehensive set of UI components, data hooks, services, utilities, and fully-composed view components that can be used to build complete dashboard applications with minimal effort.
This package has been designed with a focus on:
The package is organized into the following key directories:
@optifye/dashboard-core/
├── src/
│ ├── components/ # UI Components from atomic to composite
│ ├── lib/ # Core logic, utilities, hooks, services
│ ├── views/ # Complete page-level view components
│ └── index.ts # Main export file
Components follow a hierarchical organization:
components/
├── auth/ # Authentication components
├── charts/ # Data visualization components
├── common/ # Shared components across domains
├── dashboard/ # Domain-specific dashboard components
│ ├── grid/ # Workspace grid components
│ ├── kpis/ # KPI visualization components
│ ├── line/ # Production line components
│ ├── video/ # Video streaming components
│ └── workspace/ # Workspace detail components
├── data/ # Data display and transformation components
├── layouts/ # Layout components and structure
├── navigation/ # Navigation components and menus
├── ui/ # Fundamental UI components (buttons, cards, etc.)
└── views/ # View-specific components
The core logic follows a clean separation of concerns:
lib/
├── constants/ # Application constants and configuration values
├── contexts/ # React context providers and consumers
├── hooks/ # Custom React hooks for data and UI
├── internal/ # Internal utilities (not exported)
├── services/ # Data services and API clients
│ └── factories/ # Service factory functions
├── supabase/ # Supabase client configuration
├── types/ # TypeScript type definitions
└── utils/ # Utility functions by domain
└── dev/ # Development utilities
The package provides a complete UI component system for building operational dashboards:
The package includes ready-to-use data services for common dashboard operations:
Specialized hooks for data fetching and UI interactions:
Full page-level view components that can be directly used in applications:
npm install @optifye/dashboard-core
This package requires the following peer dependencies to be installed in your project:
npm install react@^18 react-dom@^18 next@^13 tailwindcss@^3 @supabase/supabase-js@^2 date-fns@^4 date-fns-tz@^3
Additionally, you'll need to install these UI and utility dependencies:
npm install lucide-react @heroicons/react @tabler/icons-react @radix-ui/react-select @radix-ui/react-slider @radix-ui/react-slot @radix-ui/react-tabs recharts react-day-picker sonner swr zustand axios hls.js html2canvas jspdf mixpanel-browser tailwindcss-animate @aws-sdk/client-s3 @aws-sdk/s3-request-presigner
Or if using Yarn:
yarn add react@^18 react-dom@^18 next@^13 tailwindcss@^3 @supabase/supabase-js@^2 date-fns@^4 date-fns-tz@^3
yarn add lucide-react @heroicons/react @tabler/icons-react @radix-ui/react-select @radix-ui/react-slider @radix-ui/react-slot @radix-ui/react-tabs recharts react-day-picker sonner swr zustand axios hls.js html2canvas jspdf mixpanel-browser tailwindcss-animate @aws-sdk/client-s3 @aws-sdk/s3-request-presigner
This package includes global CSS styles that need to be imported in your application. In your Next.js app, import the global CSS file once in your _app.tsx or layout.tsx:
// pages/_app.tsx or app/layout.tsx
import '@optifye/dashboard-core/global.css';
This CSS file includes:
Note: You do NOT need to separately import react-day-picker/dist/style.css as these styles are already included in the package's global CSS.
The package now includes built-in authentication components for a complete Supabase OTP-based authentication flow. See AUTH_COMPONENTS_GUIDE.md for detailed usage.
Copy the Optifye logo from node_modules/@optifye/dashboard-core/src/assets/optifye-logo.png to your public folder.
Create login page:
import { LoginPage } from '@optifye/dashboard-core';
export default function Login() {
return <LoginPage logoSrc="/optifye-logo.png" />;
}
import { AuthCallback } from '@optifye/dashboard-core';
export default function AuthCallbackPage() {
return <AuthCallback />;
}
The package includes built-in rate limiting utilities:
import { checkRateLimit } from '@optifye/dashboard-core';
// In your API route
const { allowed, retryAfter } = checkRateLimit(email, {
windowMs: 60000, // 1 minute
maxRequests: 3 // 3 attempts
});
All dashboard components are designed to be fully responsive and mobile-friendly:
The dashboard uses Tailwind CSS breakpoints:
// The dashboard automatically adapts to mobile screens
<HomeView
defaultLineId={defaultLineId}
factoryViewId={factoryViewId}
// ... other props
/>
Components handle responsive behavior internally, no additional configuration needed.
If you encounter an error like:
Error: Cannot find module 'next/router' imported from node_modules/@optifye/dashboard-core/dist/index.mjs
This package is designed to be used within a Next.js application with proper bundler configuration. Make sure:
If you're using this package in a custom setup, ensure your bundler is configured to handle Next.js module resolution.
npm install @optifye/dashboard-core
import { SupabaseProvider, DashboardProvider } from '@optifye/dashboard-core';
import { createClient } from '@supabase/supabase-js';
// Initialize Supabase client
const supabaseClient = createClient(
process.env.NEXT_PUBLIC_SUPABASE_URL!,
process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!
);
// Dashboard configuration
const dashboardConfig = {
entityConfig: {
lineId: 'your-line-id',
factoryViewId: 'factory',
companyId: 'your-company-id'
},
supabaseKey: process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!,
apiUrl: process.env.NEXT_PUBLIC_API_URL!,
timezone: 'Asia/Kolkata',
// ... other configuration options
};
function MyApp({ Component, pageProps }) {
return (
<SupabaseProvider client={supabaseClient}>
<DashboardProvider config={dashboardConfig}>
<Component {...pageProps} />
</DashboardProvider>
</SupabaseProvider>
);
}
export default MyApp;
import {
KPICard,
Button,
Card,
DateDisplay,
useLineKPIs
} from '@optifye/dashboard-core';
function MyDashboardComponent() {
const { kpis, isLoading, error } = useLineKPIs('line-id');
if (isLoading) return <LoadingSpinner />;
if (error) return <div>Error loading KPIs</div>;
return (
<Card>
<Card.Header>
<Card.Title>Line Performance</Card.Title>
<DateDisplay date={new Date()} />
</Card.Header>
<Card.Content>
<div className="grid grid-cols-3 gap-4">
<KPICard
title="Efficiency"
value={kpis.efficiency}
changeValue={kpis.efficiencyChange}
variant="percentage"
/>
<KPICard
title="Output"
value={kpis.output}
changeValue={kpis.outputChange}
variant="number"
/>
<KPICard
title="PPH"
value={kpis.pph}
changeValue={kpis.pphChange}
variant="number"
/>
</div>
</Card.Content>
<Card.Footer>
<Button>View Details</Button>
</Card.Footer>
</Card>
);
}
import { FactoryView } from '@optifye/dashboard-core';
import { withAuth } from '@optifye/dashboard-core';
// Factory view with authentication protection
function FactoryPage() {
return (
<FactoryView
lineIds={['line-1-id', 'line-2-id']}
productIdMap={{
'line-1-id': 'product-1-id',
'line-2-id': 'product-2-id'
}}
showEfficiency={true}
showOutput={true}
showUnderperforming={true}
/>
);
}
export default withAuth(FactoryPage);
The package includes a comprehensive authentication system:
The package includes several performance optimizations:
The package includes AWS S3 integration for video clips:
interface DashboardConfig {
// Entity configuration
entityConfig: {
lineId: string;
factoryViewId: string;
companyId: string;
// Optional additional line IDs
lineIds?: Record<string, string>;
};
// API configuration
supabaseKey: string;
apiUrl: string;
// Time configuration
timezone: string;
// Feature flags
features?: {
enableRealtime?: boolean;
enableVideoStreaming?: boolean;
enableWhatsAppShare?: boolean;
enablePdfExport?: boolean;
};
// Theme configuration
theme?: {
primaryColor?: string;
secondaryColor?: string;
accentColor?: string;
errorColor?: string;
warningColor?: string;
successColor?: string;
};
// Other configuration options
options?: {
refreshInterval?: number;
dateFormat?: string;
timeFormat?: string;
};
}
The package is designed to work with Supabase for data storage and real-time capabilities:
SupabaseProvider component must be configured with a Supabase client.The package expects the following Supabase tables and structure:
For Next.js applications, a common pattern is to use the dynamic catch-all routing to render the appropriate view:
// pages/[[...dashboard]].tsx
import { useRouter } from 'next/router';
import dynamic from 'next/dynamic';
// Dynamic imports with loading fallbacks
const HomeView = dynamic(() => import('@optifye/dashboard-core/views/HomeView'), {
loading: () => <div className="flex h-screen w-full items-center justify-center">Loading...</div>,
ssr: false
});
const FactoryView = dynamic(() => import('@optifye/dashboard-core/views/FactoryView'), {
loading: () => <div className="flex h-screen w-full items-center justify-center">Loading...</div>,
ssr: false
});
// ... other view imports
export default function DashboardPage() {
const router = useRouter();
const { dashboard } = router.query;
// Determine which view to render based on the route
const renderView = () => {
if (!dashboard || dashboard.length === 0) {
return <HomeView />;
}
const [main, id] = dashboard as string[];
switch (main) {
case 'factory-view':
return <FactoryView />;
case 'kpis':
return <KPIDetailView lineId={id} />;
case 'workspace':
return <WorkspaceDetailView workspaceId={id} />;
case 'targets':
return <TargetsView />;
case 'shifts':
return <ShiftsView />;
default:
return <div>Page not found</div>;
}
};
return (
<MainLayout>
{renderView()}
</MainLayout>
);
}
For React SPA applications, you can use React Router:
import { BrowserRouter, Routes, Route } from 'react-router-dom';
import {
HomeView,
FactoryView,
KPIDetailView,
WorkspaceDetailView,
TargetsView,
ShiftsView
} from '@optifye/dashboard-core';
export default function App() {
return (
<BrowserRouter>
<Routes>
<Route path="/" element={<HomeView />} />
<Route path="/factory-view" element={<FactoryView />} />
<Route path="/kpis/:lineId" element={<KPIDetailView />} />
<Route path="/workspace/:id" element={<WorkspaceDetailView />} />
<Route path="/targets" element={<TargetsView />} />
<Route path="/shifts" element={<ShiftsView />} />
</Routes>
</BrowserRouter>
);
}
The core service for dashboard data operations.
// Key Methods
dashboardService.getUnderperformingWorkspaces(lineId: string): Promise<WorkspaceMetrics[]>
dashboardService.getLineInfo(lineId: string): Promise<LineInfo>
dashboardService.getLineMetrics(lineId: string): Promise<LineMetrics>
dashboardService.getWorkspacesForLine(lineId: string): Promise<Workspace[]>
dashboardService.getHistoricalMetrics(params: HistoricalMetricsParams): Promise<HistoricalMetrics>
Service for workspace management and configuration.
// Key Methods
workspaceService.getWorkspace(workspaceId: string): Promise<Workspace>
workspaceService.getWorkspaceMetrics(workspaceId: string): Promise<WorkspaceDetailedMetrics>
workspaceService.updateWorkspaceAction(params: WorkspaceActionUpdate): Promise<void>
workspaceService.bulkUpdateWorkspaceActions(params: BulkWorkspaceActionUpdate): Promise<void>
workspaceService.getLineWorkspaceThresholds(lineId: string): Promise<LineThreshold[]>
Service for action tracking and management.
// Key Methods
actionService.getActionForWorkspace(workspaceId: string): Promise<Action>
actionService.updateAction(params: ActionUpdate): Promise<void>
actionService.addAction(params: ActionCreate): Promise<Action>
actionService.deleteAction(actionId: string): Promise<void>
WhatsApp integration for notifications.
// Key Methods
whatsAppService.shareWorkspaceMetrics(params: ShareWorkspaceParams): Promise<string>
whatsAppService.shareLineMetrics(params: ShareLineParams): Promise<string>
whatsAppService.shareFactoryMetrics(params: ShareFactoryParams): Promise<string>
Real-time data streaming and subscriptions.
// Key Methods
realtimeService.subscribeToLineMetrics(lineId: string, callback: Callback): Subscription
realtimeService.subscribeToWorkspaceMetrics(workspaceId: string, callback: Callback): Subscription
realtimeService.unsubscribe(subscription: Subscription): void
The package supports several extension mechanisms:
The DashboardOverridesContext allows overriding specific components:
import { DashboardOverridesProvider } from '@optifye/dashboard-core';
// Custom components for overrides
const CustomKPICard = (props) => <div>Custom KPI Card: {props.title}</div>;
const CustomWorkspaceCard = (props) => <div>Custom Workspace: {props.name}</div>;
function MyApp({ Component, pageProps }) {
const overrides = {
components: {
KPICard: CustomKPICard,
WorkspaceCard: CustomWorkspaceCard
},
hooks: {
// Hook overrides
},
views: {
// View overrides
}
};
return (
<DashboardOverridesProvider overrides={overrides}>
<Component {...pageProps} />
</DashboardOverridesProvider>
);
}
All view components accept extensive prop-based customization:
<FactoryView
lineIds={['line1', 'line2']}
showEfficiency={true}
showOutput={true}
showPPH={true}
refreshInterval={30000}
onLineSelect={(lineId) => console.log(`Selected line: ${lineId}`)}
customHeader={<MyCustomHeader />}
customFooter={<MyCustomFooter />}
/>
If you encounter React type compatibility issues between the package and your application, use type casting:
import ComponentOriginal from '@optifye/dashboard-core/components/path/Component';
const Component = ComponentOriginal as any;
Error: "Supabase client not initialized in @optifye/dashboard-core. Use SupabaseProvider."
Solution: Ensure your application is wrapped with SupabaseProvider and a valid Supabase client is provided.
Error: "Dashboard configuration not found. Use DashboardProvider."
Solution: Ensure your application is wrapped with DashboardProvider and valid configuration is provided.
This package is continuously evolving. For contributions, please follow the established code patterns and ensure all tests pass.
Proprietary - All rights reserved. This package is for internal use only.
This package is published to npm as @optifye/dashboard-core and follows semantic versioning. New releases are automatically published when a PR with "RELEASE" in the title is merged to the main branch.
pnpm changeset or npx changesetnpx changeset version to update package.json and CHANGELOG.mdImportant: The release workflow is triggered by PR merges, not direct pushes to main. The PR title MUST contain "RELEASE" for the workflow to run.
RELEASE v2.0.1: Fix Next.js CSS import error
The package repository field has been properly formatted for npm publishing standards.
(License information, e.g., MIT, would go here.)
Last updated for v4.0.0 - Published to npm
FAQs
Reusable UI & logic for Optifye dashboard
The npm package @optifye/dashboard-core receives a total of 588 weekly downloads. As such, @optifye/dashboard-core popularity was classified as not popular.
We found that @optifye/dashboard-core demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.