π Employee Hour Tracker
A comprehensive web application for tracking employee work time with real-time analytics, management features, and automated backups.
β¨ Features
π Time Tracking
- Interactive weekly grid interface for tracking employee time entries
 - Click-to-cycle through status states: Not Entered β Entered β Incorrect
 - Week navigation with integrated calendar picker
 - Configurable default week settings
 - Auto-save functionality for all changes
 
π Analytics Dashboard
- Visual Analytics: Interactive charts powered by Chart.js
 - Date Filtering: Preset ranges (Last Week, Last Month, Last 90 Days) or custom date selection
 - Status Distribution: Pie chart showing overall entry patterns
 - Employee Comparison: Bar chart for performance analysis
 - Summary Cards: Quick statistics at a glance
 
π₯ Employee Management
- Complete employee lifecycle management
 - Add new employees with immediate tracking integration
 - Inline editing for employee names
 - Safe removal with confirmation dialogs
 - Session-based authentication for secure access
 
πΎ Data Export & Backup
- Multiple Export Formats:
- Colored Excel files maintaining visual status indicators
 - JSON format for system integrations
 - CSV for universal compatibility
 
 - Automated Backups: Scheduled database backups with configurable retention
 
π¨ Modern UI/UX
- Responsive design optimized for all devices
 - Cohesive purple gradient theme throughout
 - Smooth animations and transitions
 - Mobile-friendly touch interactions
 - Clean, intuitive navigation
 
π Quick Start
Prerequisites
- Node.js 18+ and npm
 - OR Docker and Docker Compose
 
Installation Options
Option 1: Node.js
# Clone the repository git clone https://github.com/tebwritescode/employee-hour-tracker.git cd employee-hour-tracker # Install dependencies npm install # Start the application npm start # For development with auto-reload npm run dev
Option 2: Docker Compose (Recommended)
# Clone the repository git clone https://github.com/tebwritescode/employee-hour-tracker.git cd employee-hour-tracker # Start with Docker Compose docker-compose up -d # View logs docker-compose logs -f # Stop the application docker-compose down
Option 3: Docker CLI
# Build the image docker build -t employee-hour-tracker . # Run the container docker run -d \ --name employee-tracker \ -p 3000:3000 \ -v employee-tracker-data:/app/data \ employee-hour-tracker
Access the application at http://localhost:3000
π§ Configuration
Environment Variables
| Variable | Default | Description | 
|---|---|---|
PORT | 
3000 | 
Server port | 
NODE_ENV | 
development | 
Environment mode (development or production) | 
DB_PATH | 
./employee_tracker.db | 
Database file location | 
SESSION_SECRET | 
employee-tracker-secret-key | 
Session encryption key | 
DEFAULT_ADMIN_USERNAME | 
admin | 
Initial admin username | 
DEFAULT_ADMIN_PASSWORD | 
admin123 | 
Initial admin password | 
BACKUP_ENABLED | 
true | 
Enable automated backups | 
BACKUP_INTERVAL | 
86400000 | 
Backup interval in milliseconds (default: 24 hours) | 
BACKUP_RETENTION_DAYS | 
30 | 
Number of days to keep backup files | 
Docker Compose Configuration
version: '3.8' services: app: image: employee-hour-tracker environment: - NODE_ENV=production - SESSION_SECRET=your-secure-secret-here - DEFAULT_ADMIN_USERNAME=admin - DEFAULT_ADMIN_PASSWORD=change-this-password ports: - "3000:3000" volumes: - ./data:/app/data - ./backups:/app/backups
π Usage Guide
Time Tracking (/tracking)
- Select the desired week using the date picker or arrow navigation
 - Click on any cell in the grid to cycle through status states
 - Changes are automatically saved to the database
 - Use the week selector to navigate between different time periods
 
Analytics (/analytics)
- Select a date range using preset options or custom dates
 - View status distribution in the pie chart
 - Compare employee performance in the bar chart
 - Export data using the export buttons
 
Management (/management)
- Login with admin credentials (default: 
admin/admin123) - Add new employees using the "Add Employee" form
 - Edit employee names by clicking the edit icon
 - Remove employees with the delete button (requires confirmation)
 - Access global settings and export options
 
ποΈ Architecture
employee-hour-tracker/ βββ π server.js # Express server and API endpoints βββ π backup.js # Automated backup functionality βββ π package.json # Dependencies and scripts βββ π docker-compose.yml # Docker composition βββ π Dockerfile # Container configuration βββ π public/ # Frontend assets β βββ π index.html # Main application HTML β βββ π style.css # Styles and responsive design β βββ π script.js # Frontend logic and interactions β βββ π chart.js # Analytics visualization βββ π backups/ # Automated backup storage βββ π employee_tracker.db # SQLite database
Tech Stack
- Backend: Node.js + Express.js
 - Database: SQLite3 with better-sqlite3
 - Frontend: Vanilla JavaScript + Chart.js
 - Authentication: Express-session + bcryptjs
 - Containerization: Docker + Docker Compose
 
π Security
- Password hashing using bcryptjs
 - Session-based authentication
 - CORS protection
 - SQL injection prevention via parameterized queries
 - Secure session management with configurable secrets
 
π οΈ Development
Available Scripts
# Start development server with auto-reload npm run dev # Start production server npm start # Install all dependencies npm run install-deps
API Endpoints
| Method | Endpoint | Description | Auth Required | 
|---|---|---|---|
| GET | /api/employees | 
List all employees | No | 
| POST | /api/employees | 
Add new employee | Yes | 
| PUT | /api/employees/:id | 
Update employee | Yes | 
| DELETE | /api/employees/:id | 
Remove employee | Yes | 
| GET | /api/time-entries | 
Get time entries | No | 
| POST | /api/time-entries | 
Update time entry | No | 
| GET | /api/analytics | 
Get analytics data | No | 
| POST | /api/login | 
Admin authentication | No | 
| POST | /api/logout | 
End admin session | Yes | 
| GET | /api/export/:format | 
Export data | Yes | 
π Known Issues
- Week navigation may occasionally show incorrect dates when changing weeks rapidly
 - Status markers might not update immediately in some edge cases with week transitions
 
π License
This project is licensed under the MIT License - see the LICENSE file for details.
π€ Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the project
 - Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
 
π§ Support
For issues, questions, or suggestions, please open an issue on the GitHub repository.
Made with β€οΈ by tebwritescode