The Manufacturing Efficiency Tracking System is designed for industrial production facilities to track and optimize efficiency. It logs machine cycles, identifies bottlenecks, measures cycle times, and allows for dynamic adjustments to production standards.
- Framework - Next.js 15
- Runtime - React 18 (Stable compatibility with ecosystem)
- Language - TypeScript
- Auth - Clerk
- Error tracking -
- Styling - Tailwind CSS v4
- Components - Shadcn-ui
- Schema Validations - Zod
- State Management - Zustand
- Search params state manager - Nuqs
- Tables - Tanstack Data Tables β’ Dice table
- Forms - React Hook Form
- Command+k interface - kbar
- Linting - ESLint
- Pre-commit Hooks - Husky
- Formatting - Prettier
- Multi-tenant Architecture - Support for multiple organizations and sites
- Value Stream Mapping - Hierarchical organization of production cells
- Real-time Efficiency Tracking - Live monitoring of machine performance
- Cycle Time Analysis - Target vs. actual cycle time comparison
- Clerk Authentication - Enterprise-grade user management
- Role-Based Access Control (RBAC) - Admin, Manager, Operator roles
- Protected Routes - Secure access to sensitive operations
- Row Level Security - Database-level data isolation
- Efficiency Dashboards - Real-time performance metrics
- Downtime Tracking - Planned and unplanned stoppage monitoring
- Issue Management - Problem tracking and resolution workflows
- Historical Analysis - Trend analysis and performance optimization
- Live Updates - WebSocket-based real-time data synchronization
- Instant Notifications - Real-time alerts for critical events
- Live Efficiency Metrics - Continuous monitoring of production KPIs
- Framework - Next.js 15 with App Router
- Runtime - React 18 (Stable compatibility)
- Language - TypeScript
- Authentication - Clerk (Enterprise auth)
- Database - Supabase (PostgreSQL + Real-time)
- Styling - Tailwind CSS with CSS Variables
- Components - ShadCN/UI (Radix UI primitives)
- State Management - React hooks + Context API
- Forms - React Hook Form + Zod
- Real-time - Supabase Realtime with WebSockets
- Deployment - Vercel (Frontend) + Fly.io (Backend)
src/
βββ app/ # Next.js App Router
β βββ (auth)/ # Authentication routes (route group)
β β βββ sign-in/ # Sign in page
β β βββ sign-up/ # Sign up page
β βββ welcome/ # Welcome/landing page
β βββ dashboard/ # Main application routes
β β βββ attainment/ # Efficiency tracking
β β βββ organization/ # Company/site management
β β βββ profile/ # User profile management
β βββ api/ # API endpoints
β βββ layout.tsx # Root layout
β βββ page.tsx # Home page
β βββ globals.css # Global styles
β βββ theme.css # Theme configuration
β
βββ components/ # Shared components
β βββ ui/ # ShadCN UI components
β βββ layout/ # Layout components
β βββ auth/ # Authentication components
β βββ features/ # Feature showcase components
β
βββ features/ # Feature-based modules
β βββ auth/ # Authentication features
β βββ profile/ # User profile management
β
βββ hooks/ # Custom React hooks
β βββ use-user-role.ts # Role management
β βββ use-clerk-organization.ts # Organization context
β βββ use-loading-state.ts # Loading state management
β
βββ lib/ # Core utilities
β βββ auth/ # Permission system
β βββ forms/ # Form validation
β βββ utils/ # Shared utilities
β
βββ types/ # TypeScript definitions
βββ api.ts # API types
βββ common.ts # Common types
βββ data-table.ts # Table component types
- Node.js 18+ installed
- pnpm package manager
- Clerk.com account for authentication
- Supabase account for database
- Clone the repository
git clone <your-repo-url>
cd lean-tools- Install dependencies
pnpm install- Environment Configuration
# Copy environment template
cp env.example.txt .env.local
# Add your environment variables
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=your-clerk-key
CLERK_SECRET_KEY=your-clerk-secret
NEXT_PUBLIC_SUPABASE_URL=your-supabase-url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your-supabase-key- Start development server
pnpm dev- Open your browser Navigate to http://localhost:3000
The system uses Supabase (PostgreSQL) for data storage. See SUPABASE_SETUP.md for complete database setup instructions.
-
Create Supabase Project
- Go to supabase.com
- Create new project
- Get your project URL and API keys
-
Run Database Schema
- Execute the SQL commands from
SUPABASE_SETUP.md - Set up Row Level Security policies
- Configure real-time subscriptions
- Execute the SQL commands from
-
Test Connection
- Verify database connectivity
- Test CRUD operations
- Validate RLS policies
- Admin - Full system access, user management, organization settings
- Manager - Efficiency tracking, reporting, basic organization access
- Operator - Machine cycle tracking, basic reporting, profile management
- Company & Site - Locked upon sign-up, admin-managed
- Value Stream & Cell - Adjustable within the app
- Role Permissions - Granular access control based on user roles
- TypeScript Strict Mode - Full type safety
- ESLint + Prettier - Code formatting and linting
- Feature-based Organization - Modular, maintainable architecture
- Component Library - Consistent UI with ShadCN/UI
- Unit Tests - Component and utility testing
- Integration Tests - API endpoint testing
- E2E Tests - User workflow testing
- Frontend - Vercel with automatic deployments
- Database - Supabase with automated backups
- Environment Management - Separate configs for dev/staging/prod
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Authentication Problems
- Verify Clerk environment variables
- Check user role assignments
- Validate organization membership
Database Connection Issues
- Confirm Supabase credentials
- Check network connectivity
- Verify RLS policies
Build Errors
- Clear node_modules:
rm -rf node_modules pnpm-lock.yaml && pnpm install - Check TypeScript errors:
pnpm type-check - Verify environment variables
- Check the SUPABASE_SETUP.md for database issues
- Review Clerk documentation for auth problems
- Open an issue for bugs or feature requests
This project is licensed under the MIT License - see the LICENSE file for details.
- Built with Next.js and React
- UI components from ShadCN/UI
- Authentication by Clerk
- Database powered by Supabase
Ready to optimize your manufacturing efficiency? π
Start by setting up your Supabase database and implementing the machine cycle tracking features. Check out the SUPABASE_SETUP.md for detailed database configuration instructions.