# π Employee Hour Tracker > A badass web app to monitor employees entering their time, serve up real-time analytics, and automate your backups β so you can stop worrying and focus on getting sh*t done.      --- <details> <summary><i>Click to show screenshots</i></summary> ## Screenshots  [](./Screenshot_2025-08-08_at_4.03.27_PM.png) [](./Screenshot_2025-08-08_at_4.03.54_PM.png) [](./Screenshot_2025-08-08_at_4.05.46_PM.png) </details> --- ## β¨ Features ### π **Time Tracking (A.K.A. Keeping Tabs on Your Squad)** - Weekly grid interface sharp enough to make spreadsheets cry - Click once? Log it. Twice? Flag it. Thrice? Fix-it mode, baby - Built-in calendar picker so you don't fat-finger the wrong week - Default week your way β past, present, or hell, even the future - No βSaveβ button needed β everything saves itself like grown-up software ### π **Analytics Dashboard** - Sexy-ass charts courtesy of Chart.js - Date ranges? Yep. Choose from Last Week, Month, 90 Days, or freestyle - Pie charts of shame: See who's not entered a damn thing - Employee comparisons so you know whoβs crushing it - Summary stats that slap you with truths at a glance ### π₯ **Employee Management** - Add, edit, and yeet employees in or out with full control - Inline editing β because popups can get bent - Confirmation dialogs keep you from rage-deleting poor Jim by mistake - Secure, session-based login β no freeloaders allowed ### πΎ **Data Export & Backup** - Export in: - Colored Excel (preserves all that green/yellow/red goodness) - JSON (for the nerds and the APIs) - CSV (because boring as hell = universal) - Auto-backups so you can sleep like a baby β configurable too ### π¨ **Beautiful AF UI** - Responsive as heck β use it on a tablet, a phone, or a potato - A glorious purple gradient worth showing off to design nerds - Smooth transitions that donβt make you nauseous - Touch support that'll make any mobile user say βdamn thatβs cleanβ - You might actually enjoy navigating this one --- ## π Quick Start ### Prerequisites (Donβt Skip This, Ya Animal) - Node.js 18+ - OR Docker & Docker Compose (weβre fancy) --- ### π§ͺ Option 1: Raw Node.js ```bash git clone https://github.com/tebwritescode/employee-hour-tracker.git cd employee-hour-tracker npm install npm start # Start like a regular ol' app npm run dev # If you want auto-reload magic ``` --- ### π³ Option 2: Docker Compose (Recommended as Hell) ```bash git clone https://github.com/tebwritescode/employee-hour-tracker.git cd employee-hour-tracker docker-compose up -d docker-compose logs -f # Because watching logs is oddly satisfying docker-compose down # When itβs time to kill it ``` --- ### π¨ Option 3: Docker CLI (For Hardcore Terminal Nerds) ```bash docker build -t employee-hour-tracker . docker run -d \ --name employee-tracker \ -p 3000:3000 \ -v employee-tracker-data:/app/data \ employee-hour-tracker ``` App launches at `http://localhost:3000` Go ahead, open it. We dare you. --- ## π§ Configuration (Don't Screw These Up) | Variable | Default | Description | |----------|---------|-------------| | `PORT` | `3000` | Where the hell the server listens | | `NODE_ENV` | `development` | Pick your poison: `development` vs `production` | | `DB_PATH` | `./employee_tracker.db` | Where your crucial time data lives | | `SESSION_SECRET` | `employee-tracker-secret-key` | Hide this like itβs your banking password | | `DEFAULT_ADMIN_USERNAME` | `admin` | The overlordβs default login | | `DEFAULT_ADMIN_PASSWORD` | `admin123` | CHANGE THIS ASAP π₯ | | `BACKUP_ENABLED` | `true` | Yeah, you want this on | | `BACKUP_INTERVAL` | `86400000` | How often to save your backside (MS) | | `BACKUP_RETENTION_DAYS` | `30` | How long to keep your safety net | --- ### π Docker Compose Config ```yaml 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` 1. Pick your week and start clicking grid cells like a god 2. Cycle statuses like a boss 3. Sit back β auto-saveβs doing the work for you 4. Use arrows & selectors if you like jumping through time ### π Analytics `/analytics` 1. Choose your dates 2. Interpret shame-slices in the pie chart 3. Compare your teamβs hustle in bar form 4. Click Export and flex on your boss with pretty data ### π¨βπΌ Admin Stuff `/management` 1. Log in as admin (`admin` / `admin123`) β seriously, change that 2. Add new employees like itβs HR day 3. Click to edit names (typos wonβt fix themselves) 4. Boot off old names thoughtfully (confirmation included) 5. Global settings & data export tools right at your manicured fingertips --- ## ποΈ Project Architecture ``` employee-hour-tracker/ βββ π server.js # RESTful backend engine of doom βββ π backup.js # Makes sure your data doesnβt go *poof* βββ π package.json # Clearly youβve heard of this βββ π docker-compose.yml # Container boyband orchestration βββ π Dockerfile # Turns your app into deployable magic βββ π public/ # Frontend good stuff β βββ index.html # Your glorious entry point β βββ style.css # Sharp purple swagger β βββ script.js # Grid logic + admin finesse β βββ chart.js # Analytics eye-candy βββ π backups/ # This folder saves asses βββ π employee_tracker.db # Don't delete this... seriously ``` --- ### βοΈ Tech Stack - **Backend**: Node.js + Express - **Database**: SQLite3 + better-sqlite3 (the better part matters) - **Frontend**: Raw Vanilla JS (no extra calories) + Chart.js - **Auth**: express-session + bcryptjs (like a bouncer for your admin area) - **Containerization**: Docker & Docker Compose --- ## π Security - Hashed passwords (get rekt plain text) - Session-based login β no silly tokens - CORS-tight so outsiders canβt jack your data - SQL injection-proof β parameterized 'cause weβre not amateurs - Secrets optional but highly encouraged (youβve been warned) --- ## π§ Dev Life ```bash npm run dev # Hot reload fixups npm start # Serious prod mode npm run install-deps # Just in case you skipped setup like a rebel ``` --- ### π API Endpoints | Method | URL | What-It-Does | Auth | |--------|-----|--------------|------| | GET | `/api/employees` | Fetch worker list | β | | POST | `/api/employees` | Add a badass | β | | PUT | `/api/employees/:id` | Update someoneβs stuff | β | | DELETE | `/api/employees/:id`| Boot 'em | β | | GET | `/api/time-entries` | Fetch time logs | β | | POST | `/api/time-entries` | Save/correct logs | β | | GET | `/api/analytics` | Data candy | β | | POST | `/api/login` | Get in | β | | POST | `/api/logout` | Peace out | β | | GET | `/api/export/:format` | Download your victory proof | β | --- ## π Known WTFs - Week nav is a little moody if you click like a caffeinated squirrel - In rare cases, the status markerβs a lazy bastard and doesnβt update instantly (Fix coming soon. Or yell at us, that works too.) ## Support Issues? Questions? Praise-singing? File an issue on GitHub or yell at [teb](https://github.com/tebwritescode). --- π Created by: [tebbydog0605](https://github.com/tebwritescode) π Docker Hub: [tebwritescode](https://hub.docker.com/u/tebwritescode) π» Website: [teb.codes](https://teb.codes)