Overview
The MLM CMMS frontend is a single-page application built with React 19, TypeScript, Vite, and Tailwind CSS v4. The codebase follows a modular architecture with clear separation of concerns.Directory Structure
Core Application
Key Directories
components/
Reusable UI components organized by domain:
ui/- Base UI primitives (buttons, inputs, modals)layout/- Layout components (headers, sidebars)navigation/- Navigation componentscommon/- Shared componentsdashboard/- Dashboard-specific componentsreports/- Reporting components
pages/
Page-level components mapped to routes:
admin/- Administration pagesinventory/- Inventory management pages- Lazy-loaded for performance
services/
Data access layer:
ticketService.ts- Ticket operationsuserService.ts- User managementinventory/- Inventory services- All Supabase interactions happen here
context/
Global state management:
AuthContext.tsx- Authentication stateUserContext.tsx- User profile dataPermissionsContext.tsx- RBAC permissionsSettingsContext.tsx- Application settings
Application Bootstrap
The application initializes throughmain.tsx with a nested provider structure:
Code Organization Patterns
Component Hierarchy
Feature Modules
Complex features are organized into dedicated modules:Feature modules encapsulate domain-specific logic, keeping page components clean and focused.
Type Definitions
TypeScript types are centralized intypes/ directory:
- Core Types
- Inventory Types
types/Ticket.ts
Environment Configuration
Frontend environment variables are prefixed withVITE_:
.env.example
Build Output
The Vite build produces:- Lazy-loaded chunks for each route
- Optimized assets with content hashing
- Service worker for PWA capabilities
- Manifest for installation
Next Steps
Routing
Learn about route configuration and navigation
Services
Understand the data access layer
Components
Explore the component library