Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“„ TrackWise

Professional Employee Attendance Management Platform

A modern full-stack Employee Attendance Management System that streamlines workforce attendance tracking, employee administration, and daily attendance monitoring through secure authentication, role-based dashboards, and an intuitive user experience.

React Vite Tailwind CSS Node.js Express PostgreSQL JWT License

TrackWise in action β€” from login to dashboard

πŸ“– Project Overview

TrackWise is a full-stack Employee Attendance Management System designed to simplify workforce attendance tracking and employee administration through a centralized, secure, and user-friendly platform.

The platform enables employees to activate their accounts, securely log in, record daily attendance, and review attendance history β€” while providing administrators with powerful tools for managing employees, monitoring attendance statistics, controlling account activation, and overseeing daily workforce operations.

Built with React, Node.js, Express.js, and PostgreSQL, TrackWise focuses on security, scalability, and maintainability. It demonstrates a production-grade implementation of JWT authentication, RESTful APIs, role-based access control, full CRUD operations, input validation, and responsive web design β€” all inside a thoughtfully designed interface.

Whether you manage a small team or a growing organization, TrackWise provides an efficient, digital solution for workforce attendance management.


✨ Key Features

Area Feature What it does Why it matters
πŸ‘€ Employee Module Secure account activation Employees activate pending accounts with their Employee ID and set their own password Keeps accounts secure from day one β€” admins never see employee passwords
JWT login & authentication Signed 8-hour bearer tokens issued per session Stateless, secure sessions that expire automatically
Daily check-in / check-out One-click start/end of the working day with office-hours enforcement Simple, consistent daily attendance capture
Personal dashboard Live clock, current status, working-hours gauge, weekly chart Employees see exactly where their day stands at a glance
Attendance history Month-filterable table of every check-in/check-out Full transparency and self-service record keeping
πŸ‘¨β€πŸ’Ό Admin Module Dashboard statistics Total employees, working today, completed today, not started A real-time pulse of the whole workforce
Employee management Searchable, filterable employee directory Rapid access to any team member
Add / edit employees Full profile creation and updates with inline validation Keeps workforce data accurate and current
Activate / deactivate accounts Toggle employee access at any time Admins keep full control over who can sign in
Pending employee monitoring Track who has not yet activated their account No lost employees β€” follow up on activations
πŸ“Š Attendance Module Working-hour calculations Automatic check-out total-hour computation Eliminates manual math and spreadsheet errors
Work-status tracking inactive β†’ working β†’ completed lifecycle per day Always know who is present, active, or done
Office-hours guardrails Enforced 9:00 AM – 5:00 PM window (early check-in at 8:30) Realistic, policy-aligned attendance rules
Workforce monitoring Live team snapshot with check-in times and status badges At-a-glance visibility across the organization
πŸ”’ Security JWT authentication Signed tokens with role claims and 8-hour expiry Stateless, tamper-resistant session management
Password hashing bcrypt with 10 salt rounds Industry-standard password storage
Role-based authorization Dedicated adminOnly middleware on admin routes Least-privilege access β€” employees cannot reach admin endpoints
Input validation express-validator on every mutating route Prevents malformed and malicious payloads
CORS allow-listing Configurable comma-separated origin list Restricts which browsers may call the API

πŸ“Έ Screenshots

πŸ” Employee Login

Employees and administrators sign in with their Employee ID and password on a polished split-screen page β€” with the product value proposition presented alongside the form.

TrackWise employee login page


πŸ“Š Administrator Dashboard

The admin dashboard gives a real-time overview of the workforce: total employees, how many are working today, how many have completed their day, and how many have not yet started β€” alongside a "Today's workforce breakdown" donut chart and a live team snapshot.

TrackWise administrator dashboard


πŸ‘₯ Employee Management

Administrators manage the whole team from a centralized, searchable directory β€” filter by status (All / Active / Inactive / Pending), edit profiles, and activate or deactivate accounts with a confirmation prompt.

TrackWise employee management page


βž• Add Employee

Registering a new employee is straightforward. New accounts start in a pending state β€” the employee activates their own password before their first sign-in.

TrackWise add employee page


✏️ Edit Employee

Updating an employee's details is just as simple. The pre-filled form keeps the Employee ID read-only β€” the unique identifier can never be changed β€” while name, email, phone, department, and designation remain fully editable. Changes apply immediately on save.

TrackWise edit employee page


πŸ”‘ Account Activation

New employees activate their pending account using the Employee ID issued by their administrator. Setting their own password completes sign-up and moves the account to an active state β€” admins never see employee passwords.

TrackWise account activation page


πŸ‘¨β€πŸ’Ό Employee Dashboard

Employees monitor their day through a personalized dashboard β€” current work status, check-in time, working hours toward an 8-hour target, a weekly bar chart, and recent days.

TrackWise employee dashboard


πŸ“… Attendance History

Every check-in and check-out, month by month. Employees filter by month and see days worked, hours logged, average hours per day, and the full detailed breakdown.

TrackWise employee attendance history


πŸ› οΈ Technology Stack

Category Technology Purpose
Frontend React 19 Component-based UI
React Router 7 Client-side routing & route guards
Axios HTTP client with interceptors
Tailwind CSS 4 Utility-first styling with design tokens
Vite 8 Build tooling & dev server
lucide-react Lightweight icon set
react-toastify In-app notifications
Backend Node.js + Express 5 REST API server
PostgreSQL (pg) Relational database
jsonwebtoken JWT signing & verification
bcrypt Password hashing
express-validator Request validation
cors Cross-origin resource sharing
dotenv Environment configuration
Dev Tools nodemon Auto-restarting dev server

πŸ—οΈ System Architecture

                       React Frontend (Vite + Tailwind)
                              β”‚
                              β–Ό
                  React Router (lazy-loaded routes)
                              β”‚
                              β–Ό
                   Axios HTTP Requests (REST API)
                   └── 401 interceptor β†’ auto-logout
                              β”‚
                              β–Ό
                 Express.js Backend (Node.js)
                    └── CORS allow-list + JWT middleware
                              β”‚
      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
      β–Ό                       β–Ό                        β–Ό
 Authentication         Attendance Module          Admin Module
  /api/auth             /api/attendance            /api/admin
 (JWT + bcrypt)         (office-hours guard)   (adminOnly middleware)
      β”‚                       β”‚                        β”‚
      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                              β–Ό
                       PostgreSQL Database
                              β”‚
              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
              β–Ό               β–Ό                β–Ό
            users        attendance      leave_requests

πŸ“‚ Project Structure

TrackWise/
β”‚
β”œβ”€β”€ client/                          # React frontend
β”‚   β”œβ”€β”€ public/
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/              # Reusable UI (RadialGauge, StatusBadge, …)
β”‚   β”‚   β”œβ”€β”€ context/                 # AuthContext (session state)
β”‚   β”‚   β”œβ”€β”€ pages/
β”‚   β”‚   β”‚   β”œβ”€β”€ admin/               # Dashboard, Employees, Add/Edit Employee
β”‚   β”‚   β”‚   β”œβ”€β”€ employee/            # Dashboard, Attendance History
β”‚   β”‚   β”‚   └── Landing, Login, Activate, 404
β”‚   β”‚   β”œβ”€β”€ routes/                  # Lazy-loaded route definitions + guards
β”‚   β”‚   β”œβ”€β”€ services/                # Axios API client + auth service
β”‚   β”‚   β”œβ”€β”€ styles/                  # Tailwind v4 design tokens (@theme)
β”‚   β”‚   β”œβ”€β”€ App.jsx
β”‚   β”‚   └── main.jsx
β”‚   └── .env.example
β”‚
β”œβ”€β”€ server/                          # Express backend
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ config/                  # companyPolicy (office hours)
β”‚   β”‚   β”œβ”€β”€ controllers/             # auth, admin, attendance
β”‚   β”‚   β”œβ”€β”€ database/                # schema.sql + setup.js (idempotent bootstrap)
β”‚   β”‚   β”œβ”€β”€ middleware/              # auth (JWT), adminOnly, validation
β”‚   β”‚   β”œβ”€β”€ models/                  # Data access layer
β”‚   β”‚   β”œβ”€β”€ routes/                  # /api/auth, /api/admin, /api/attendance
β”‚   β”‚   β”œβ”€β”€ services/                # Business logic
β”‚   β”‚   β”œβ”€β”€ validations/             # express-validator schemas
β”‚   β”‚   β”œβ”€β”€ app.js                   # Express app + CORS + error handling
β”‚   β”‚   └── server.js                # Entry point
β”‚   └── .env.example
β”‚
β”œβ”€β”€ screenshots/                     # README screenshots
β”œβ”€β”€ README.md
β”œβ”€β”€ LICENSE
└── .gitignore

βš™οΈ Installation & Setup

1️⃣ Prerequisites

  • Node.js 20+ and npm
  • PostgreSQL 14+ running locally

2️⃣ Clone the Repository

git clone https://github.com/Aby020/TrackWise.git
cd TrackWise

3️⃣ Install Backend Dependencies

cd server
npm install

4️⃣ Install Frontend Dependencies

Open a new terminal.

cd client
npm install

5️⃣ Configure Environment Variables

Inside the server folder, copy the example file and fill in your database credentials:

cd server
cp .env.example .env
PORT=5000
DATABASE_URL=postgresql://postgres:password@localhost:5432/trackwise_db
JWT_SECRET=your_secret_key

Then inside the client folder:

cd client
cp .env.example .env
VITE_API_URL=http://localhost:5000/api

6️⃣ Set Up the Database

The schema and admin account are bootstrapped automatically on the first server start β€” the setup is idempotent, so it is safe to run on every boot. You can also trigger it manually:

cd server
npm run db:setup

7️⃣ Start the Backend Server

cd server
npm run dev

Backend runs on:

http://localhost:5000

8️⃣ Start the Frontend

cd client
npm run dev

Frontend runs on:

http://localhost:5173

πŸ” Environment Variables

Backend (server/.env)

Variable Description Required
PORT Backend server port No (default: 5000)
NODE_ENV Environment mode No (default: development)
DATABASE_URL PostgreSQL connection string Yes*
DB_HOST / DB_PORT / DB_USER / DB_PASSWORD / DB_NAME Individual database variables (used if DATABASE_URL is not set) Yes*
JWT_SECRET Secret key for JWT tokens (32+ random bytes) Yes
CORS_ORIGIN Comma-separated allowed browser origins No (default: http://localhost:5173)
ADMIN_EMAIL Bootstrap admin email No (default: admin@trackwise.app)
ADMIN_EMPLOYEE_ID Bootstrap admin employee ID No (default: ADMIN001)
ADMIN_PASSWORD Bootstrap admin password No (default: TrackwiseDev2026)
ATTENDANCE_ENFORCE_HOURS Enforce office-hours check-in/check-out (true/false) No (default: true)

*Either DATABASE_URL or all DB_* variables are required.

Generate a strong secret:

node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"

Frontend (client/.env)

Variable Description Required
VITE_API_URL Backend API base URL (includes the /api prefix) No (default: http://localhost:5000/api)

πŸš€ Running the Project

  1. Ensure PostgreSQL is running and the database exists (see Installation).
  2. Start the backend: cd server && npm run dev β†’ http://localhost:5000
  3. Start the frontend: cd client && npm run dev β†’ http://localhost:5173
  4. Open http://localhost:5173 in your browser.

The admin account is created automatically on the first server start from your environment variables. Use it to log in, add employees, and explore the dashboard.


πŸ§‘β€πŸ’Ό Default Admin Credentials

⚠️ Development only. These defaults ship for local development. Change them in production by setting ADMIN_EMAIL, ADMIN_EMPLOYEE_ID, and ADMIN_PASSWORD in server/.env β€” the account is re-synced from these variables on every server start.

Credential Value
Employee ID ADMIN001
Password TrackwiseDev2026
Email admin@trackwise.app
Role Admin

πŸ‘₯ User Roles

πŸ‘¨β€πŸ’Ό Admin πŸ‘€ Employee
Sign in βœ… βœ… (after activation)
Personal attendance dashboard ❌ βœ…
Check in / check out ❌ βœ…
Attendance history ❌ βœ…
Dashboard statistics βœ… ❌
Add / edit employees βœ… ❌
Activate / deactivate accounts βœ… ❌
Monitor pending employees βœ… ❌

Admin routes are protected by both authenticate (JWT) and adminOnly (role check) middleware β€” an employee token cannot reach admin endpoints.


πŸ”„ Feature Workflow

πŸ§‘β€πŸ’Ό Employee Lifecycle

Admin creates employee ──► status = pending ──► Employee activates account
      (no password)              β”‚                    (sets own password)
                                 β–Ό
                        status = active ──► Can log in & mark attendance
                                 β”‚
                                 └──► Admin can deactivate at any time (login blocked)

πŸ“… Daily Attendance Flow

Before 8:30 AM ──► Check-in blocked (office hours not open)
8:30 AM – 5:00 PM ──► Check-in allowed
After 5:00 PM ──► Check-out allowed (working day complete)
Step Action Result
1 Employee clicks Start work working_status β†’ working, check-in timestamp recorded
2 Employee works through the day Dashboard shows live status + hours toward the 8-hour target
3 Employee clicks End work (after 5:00 PM) working_status β†’ completed, total_hours auto-calculated
4 Any time Employee reviews Attendance History month by month

πŸ‘¨β€πŸ’Ό Admin Management

  1. Add employee β†’ new account created as pending
  2. Monitor pending employees until they activate
  3. Edit profiles as details change
  4. Deactivate accounts when someone leaves β†’ their login is immediately blocked

πŸ”Œ API Overview

All routes return JSON. Mutating routes validate the request body with express-validator. Admin routes require the admin role.

πŸ” Authentication β€” /api/auth

Method Endpoint Description Auth
POST /api/auth/activate Activate a pending account (set password) β€”
POST /api/auth/login Sign in, returns a JWT β€”

πŸ‘¨β€πŸ’Ό Admin β€” /api/admin

Method Endpoint Description Auth
GET /api/admin/dashboard Workforce statistics Admin
GET /api/admin/employees List all employees Admin
GET /api/admin/employees/:employeeId Employee details Admin
POST /api/admin/employees Create a new employee Admin
PUT /api/admin/employees/:employeeId Update employee profile Admin
PATCH /api/admin/employees/:employeeId/status Activate / deactivate account Admin

πŸ“Š Attendance β€” /api/attendance

Method Endpoint Description Auth
GET /api/attendance/today Today's attendance record Employee
GET /api/attendance/history Attendance history (month-filterable) Employee
POST /api/attendance/start Check in (start work) Employee
POST /api/attendance/end Check out (end work) Employee

Example β€” login:

curl -X POST http://localhost:5000/api/auth/login \
  -H "Content-Type: application/json" \
  -d '{"employeeId":"ADMIN001","password":"TrackwiseDev2026"}'

Example β€” protected route (Bearer token):

curl http://localhost:5000/api/admin/dashboard \
  -H "Authorization: Bearer <your-jwt-token>"

πŸ—„οΈ Database Overview

Three tables make up the PostgreSQL schema (server/src/database/schema.sql), applied idempotently on server start.

πŸ‘₯ users

One row per account β€” employees and admins live in a single table.

Column Type Notes
id SERIAL Primary key
employee_id VARCHAR(20) UNIQUE β€” used for login & activation
first_name / last_name VARCHAR(100) Employee name
email VARCHAR(150) UNIQUE
phone VARCHAR(20) Optional
department / designation VARCHAR(100) Role within the company
joining_date DATE Optional
password TEXT bcrypt hash; NULL while pending
role VARCHAR(20) admin or employee
account_status VARCHAR(20) pending β†’ active / inactive
token_version INT Session invalidation counter
created_at / updated_at TIMESTAMP Auditing

πŸ“… attendance

One row per employee per working day.

Column Type Notes
id SERIAL Primary key
user_id INT FK β†’ users(id), ON DELETE CASCADE
work_date DATE With user_id, forms the UNIQUE constraint
check_in / check_out TIMESTAMP Punch times
total_hours DECIMAL(5,2) Auto-calculated on check-out
working_status VARCHAR(20) inactive / working / completed

πŸ–οΈ leave_requests

Placeholder domain table reserved for a future leave-management workflow.

πŸ” Indexes

idx_users_role            ON users(role)
idx_attendance_user_day   ON attendance(user_id, work_date DESC)
idx_attendance_workday    ON attendance(work_date)

πŸ”’ Security Features

Feature Implementation
JWT authentication Signed tokens with { id, employeeId, role } claims and an 8-hour expiry
Password hashing bcrypt with 10 salt rounds β€” raw passwords are never stored
Role-based access control adminOnly middleware denies employee tokens on admin routes
Deny-by-default sessions account_status gates login; pending and inactive accounts are rejected
Input validation express-validator on every mutating endpoint
CORS allow-list Only configured origins may call the API (CORS_ORIGIN)
401 auto-logout Axios response interceptor clears the session and redirects to login
Token invalidation token_version supports revoking issued tokens
No secrets in code All configuration via environment variables (.env is git-ignored)

πŸš€ Future Enhancements

  • πŸ“± Mobile application β€” native iOS & Android companions
  • πŸ“Š Advanced attendance analytics β€” trends, reports, and exports
  • πŸ“ GPS-based attendance tracking β€” location-verified check-ins
  • πŸ–οΈ Biometric attendance integration β€” fingerprint / face recognition
  • πŸ“§ Email notifications β€” activation reminders and daily digests
  • πŸ“ˆ Employee performance dashboard β€” productivity insights
  • 🐳 Docker deployment β€” containerized server + database
  • ☁️ Cloud deployment β€” production-ready hosting guide
  • 🌐 API documentation β€” OpenAPI / Swagger specification
  • πŸ–οΈ Leave management β€” end-to-end leave request workflow

🌟 Project Highlights

  • Secure by design β€” JWT + bcrypt + role-based authorization + validated input, end to end
  • Real office-hour enforcement β€” configurable 9–5 attendance window with early check-in
  • Idempotent bootstrapping β€” schema and admin account self-configure on every start
  • Polished design system β€” Tailwind v4 design tokens with a modern indigo/violet brand
  • Reactive session handling β€” expired tokens log the user out gracefully via a custom event
  • Complete role separation β€” distinct employee and admin experiences with strict access control
  • Responsive and modern β€” mobile-friendly, component-driven React architecture

πŸ“„ License

This project is licensed under the MIT License.

See the LICENSE file for more information.


πŸ‘¨β€πŸ’» Author

Abi Thomas

Backend Developer | Python, Django & Node.js Developer

Passionate about building scalable backend systems, RESTful APIs, modern web applications, and production-ready software using Python, Django, Node.js, Express.js, PostgreSQL, and React.

⭐ Support

If you found this project helpful, please consider giving it a ⭐ on GitHub.

Your support motivates me to continue building and improving high-quality open-source software.

If you have suggestions, feedback, or would like to collaborate, feel free to connect with me on GitHub or LinkedIn.

About

A full-stack Employee Attendance Management System built with React, Node.js, Express.js, and PostgreSQL.

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages