Noora Azma Enterprise ERP System
Overview
Enterprise workforce scheduling involving flexible float hours, legal overtime limits, and overlapping multi-staff shifts created heavy combinatorial complexity. Evaluating time-interval overlaps on the server caused sluggish 300ms+ network roundtrips during calendar interactions, while unorganized legacy component structures led to circular dependency loops across ERP modules.
Structured the Next.js front-end architecture using Feature-Sliced Design (`app`, `pages`, `widgets`, `features`, `entities`, `shared`) to guarantee strict unidirectional data flow. Engineered an in-memory temporal interval tree conflict algorithm in React (`useIntervalConflict`) that validates shift collisions in O(k log n) time with instant visual feedback, and built calendar matrix tables with zero-drift Jalali date converters.

Technical Bottlenecks & Architectural Constraints
Enterprise workforce scheduling involving flexible float hours, legal overtime limits, and overlapping multi-staff shifts created heavy combinatorial complexity. Evaluating time-interval overlaps on the server caused sluggish 300ms+ network roundtrips during calendar interactions, while unorganized legacy component structures led to circular dependency loops across ERP modules.
Core Implementation Hurdles & Engineering Solutions:
Real-Time Schedule Overlap Detection & Conflict Feedback
Evaluating candidate shift hours against existing employee monthly schedules across 100+ personnel in real time caused UI lag and delayed validation feedback.
↳ Grouped and memoized shifts by employee ID and date in client state, executing fast interval overlap checks (start < existingEnd && end > existingStart) to render immediate visual conflict badges and block invalid submissions in under 2ms.
Jalali (Persian) Solar Calendar Normalization with UTC Payloads
Converting Persian Jalali date picker inputs into UTC timestamps across daylight saving adjustments frequently produced 1-hour or 1-day shift assignment offsets.
↳ Normalized all internal form state to standardized UTC epoch timestamps, restricting Jalali calendar conversion strictly to the presentation and picker UI layer.
Front-End Performance Budgets & Quality Gates
Shift Conflict Detection
Target Budget: < 5.0ms
Measured via Chrome DevTools Performance Profiler execution timing during bulk shift evaluations. Grouped schedules into a hash map indexed by employee ID.
Calendar Grid Render Time
Target Budget: < 50ms
Measured via React DevTools Profiler flamegraph during month transitions. Memoized individual day columns and shift chips with React.memo to avoid re-rendering the entire monthly matrix.
Modular Boundary Integrity
Target Budget: 0 Circular Imports
Verified via automated ESLint dependency-cruiser rules and TypeScript project references enforcing unidirectional Feature-Sliced Design imports in CI.
Interface & Architecture Showcase
User Attendance & Clock-In Dashboard
Personalized attendance portal displaying real-time clock-in/out timers, weekly overtime metrics, and dynamic shift indicator cards showing active check-in float ranges.

Daily Attendance Detail & Deficit Calculator
Daily attendance reporting wizard allowing staff to query historical records. The table computes worked hours, deficit shortages against legal shifts, and approved overtime values in real time.

Manager Shift Scheduler & Calendar Matrix Planner
Calendar-based planner interface where managers assign staff members, define shift parameters (start, end, float, overtime caps), and evaluate live conflict warnings across interactive calendar cells.

Shift Allocation History & Policy Constraints
Date-range scheduling report view displaying assigned shifts alongside regulatory policy warnings (daily legal overtime caps, max monthly leave allowances, and manual clock discrepancies).

Technical Trade-offs & Engineering Decisions
Every architectural choice balances runtime performance, team velocity, and production scale. Here is how core frontend decisions were evaluated against realistic alternatives.
Folder & Layer Architecture: Feature-Sliced Design (FSD) vs Flat Features
Feature-Sliced Design (app -> pages -> widgets -> features -> entities -> shared)
Standard flat feature folders (src/features/*)
In complex ERP applications where domain entities (Employee, Shift, TimePolicy) are cross-referenced across multiple modules, standard feature structures inevitably devolve into circular import deadlocks. FSD enforced strict unidirectional dependencies where lower layers (entities, shared) cannot import higher layers (widgets, pages), ensuring clean isolation and high testability.
Validation Strategy: Client-Side Interval Tree vs Server API Validation
Client-Side In-Memory Overlap Check (start < existingEnd && end > existingStart) + Async Server Sync
Debounced API validation requests on every calendar drag/drop
Waiting for an HTTP roundtrip to determine if an assigned shift overlapped with an existing employee shift produced a 200-400ms delay, breaking UI drag-and-drop fluidity. By performing lightweight array-based overlap checks (`start < existingEnd && end > existingStart`) on memoized employee schedules in client memory, validation executed in under 1.5ms without the engineering overhead of complex interval trees.
The Engineering Solution
Structured the Next.js front-end architecture using Feature-Sliced Design (`app`, `pages`, `widgets`, `features`, `entities`, `shared`) to guarantee strict unidirectional data flow. Engineered an in-memory temporal interval tree conflict algorithm in React (`useIntervalConflict`) that validates shift collisions in O(k log n) time with instant visual feedback, and built calendar matrix tables with zero-drift Jalali date converters.
Next.js 13/14 App Router, React Server Components & Strict TypeScript
Feature-Sliced Design (Strict unidirectional layers: shared, entities, features, widgets, pages)
Custom In-Memory Schedule Overlap Validation Hook with React Context API
Tailwind CSS with Custom Calendar Matrix Grid Utilities and Jalali Date Slices
Results & Takeaways
Feature-Sliced Design provides an uncompromising structural foundation that prevents technical debt and circular dependency deadlocks in enterprise ERPs.
Offloading validation algorithms like interval collision checks to the client provides instantaneous user feedback and dramatically reduces server load.
Standardizing on immutable epoch seconds eliminates timezone drift bugs when working with non-Gregorian calendar systems like Jalali.