Directory structure
Backend
backend/
βββ config/ # Configuration files
β βββ db.js # MongoDB connection setup
β βββ env.js # Environment variable configuration
βββ controllers/ # Request handling logic
β βββ scheduleController.js # Scheduling logic (generate, randomize, etc.)
β βββ employeeController.js # Employee management (preferences, etc.)
β βββ statsController.js # Work hours statistics and analytics
βββ models/ # Database models
β βββ Employee.js # Employee schema/model
β βββ Schedule.js # Schedule schema/model
β βββ Statistics.js # Statistics schema/model
βββ routes/ # API route definitions
β βββ scheduleRoutes.js # Routes for schedule operations
β βββ employeeRoutes.js # Routes for employee management
β βββ statsRoutes.js # Routes for statistics
βββ services/ # Business logic and helper functions
β βββ scheduleService.js # Schedule generation and balancing logic
β βββ statsService.js # Statistics computation
βββ utils/ # Utility functions (e.g., error handling)
β βββ errorHandler.js # Custom error handling middleware
β βββ validators.js # Input validation functions
βββ .env # Environment variables (e.g., DB URL)
βββ server.js # Entry point of the backend server
βββ package.json # Node dependencies and scripts
Frontend
frontend/
βββ public/ # Static files
β βββ index.html # Main HTML file
βββ src/ # Main source folder
β βββ assets/ # Images, icons, etc.
β βββ components/ # Reusable components
β β βββ ScheduleTable.js # Table to display schedules
β β βββ EmployeeStats.js # Component to display statistics graph
β β βββ PreferencesForm.js # Form for employee preferences
β β βββ Navbar.js # Navigation bar
β βββ pages/ # Page-level components
β β βββ Dashboard.js # Main dashboard for schedule overview
β β βββ Schedule.js # Page for schedule creation and viewing
β β βββ EmployeeDetail.js # Employee-specific view with stats and preferences
β βββ services/ # API calls to backend
β β βββ scheduleService.js # API functions for schedule operations
β β βββ employeeService.js # API functions for employee management
β β βββ statsService.js # API functions for statistics
β βββ utils/ # Helper functions
β β βββ formatDate.js # Date formatting functions
β βββ App.js # Main React component
β βββ index.js # Entry point for React app
β βββ styles/ # CSS or Tailwind files
β βββ main.css # Global styles or Tailwind imports
βββ .env # Environment variables (API URLs, etc.)
βββ package.json # React dependencies and scripts
βββ tailwind.config.js # Tailwind CSS configuration