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