Skip to content

rileysklar/lean-tools

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

16 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Manufacturing Efficiency Tracking System

Industrial Production Efficiency & Machine Cycle Tracking
Built with Next.js 15, React 18, TypeScript, and Supabase

Overview β€’ Features β€’ Tech Stack β€’ Getting Started β€’ Database Setup

Overview

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.

Features

🏭 Production Management

  • 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

πŸ” Security & Access Control

  • 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

πŸ“Š Analytics & Reporting

  • 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

⚑ Real-time Capabilities

  • Live Updates - WebSocket-based real-time data synchronization
  • Instant Notifications - Real-time alerts for critical events
  • Live Efficiency Metrics - Continuous monitoring of production KPIs

Tech Stack

Project Structure

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

Getting Started

Prerequisites

  • Node.js 18+ installed
  • pnpm package manager
  • Clerk.com account for authentication
  • Supabase account for database

Installation

  1. Clone the repository
git clone <your-repo-url>
cd lean-tools
  1. Install dependencies
pnpm install
  1. 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
  1. Start development server
pnpm dev
  1. Open your browser Navigate to http://localhost:3000

Database Setup

The system uses Supabase (PostgreSQL) for data storage. See SUPABASE_SETUP.md for complete database setup instructions.

Quick Database Setup

  1. Create Supabase Project

    • Go to supabase.com
    • Create new project
    • Get your project URL and API keys
  2. Run Database Schema

    • Execute the SQL commands from SUPABASE_SETUP.md
    • Set up Row Level Security policies
    • Configure real-time subscriptions
  3. Test Connection

    • Verify database connectivity
    • Test CRUD operations
    • Validate RLS policies

Authentication & Roles

User Roles

  • Admin - Full system access, user management, organization settings
  • Manager - Efficiency tracking, reporting, basic organization access
  • Operator - Machine cycle tracking, basic reporting, profile management

Access Control

  • Company & Site - Locked upon sign-up, admin-managed
  • Value Stream & Cell - Adjustable within the app
  • Role Permissions - Granular access control based on user roles

Development Workflow

Code Quality Standards

  • 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

Testing

  • Unit Tests - Component and utility testing
  • Integration Tests - API endpoint testing
  • E2E Tests - User workflow testing

Deployment

  • Frontend - Vercel with automatic deployments
  • Database - Supabase with automated backups
  • Environment Management - Separate configs for dev/staging/prod

Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Troubleshooting

Common Issues

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

Getting Help

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments


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.

About

NextJS application with Clerk Auth, and ShadCN

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

Packages

 
 
 

Contributors