A full-featured employee management platform with role-based dashboards, secure authentication, task management, leave tracking, and real-time team visibility.
- Overview
- Tech Stack
- Features
- Folder Structure
- Getting Started
- Routing Architecture
- State Management
- Data Shapes
- Build Steps
- App Flow
EmpoManager is a React + TypeScript frontend for managing employees, tasks, departments, and leave β built with low-level design principles, secure authentication, and a clean component architecture.
| Role | Access |
|---|---|
| Admin | Full dashboard Β· Manage employees Β· Assign tasks Β· View reports Β· Manage departments |
| Employee | Personal dashboard Β· View own tasks Β· Apply for leave Β· View schedule & colleagues |
| Category | Technology |
|---|---|
| Framework | React 18 + TypeScript |
| Routing | React Router v6 |
| State | Redux Toolkit |
| Styling | Tailwind CSS |
| Build tool | Vite |
| HTTP | Axios (or fetch) |
| Notifications | React Hot Toast |
| SEO | React Helmet |
- Redux Toolkit stores all auth state β user info, role, login status, token
- Email and password validated with regex before any form submission
- Auth token stored in
localStorageβ never plain passwords - Role-based route guards block cross-role access automatically
GuestRouteprevents logged-in users from revisiting login or signup
authSliceβuser,loginStatus,role,tokenemployeeSliceβ employee list, selected employee, loading, error states- Async thunks simulate real API calls for all CRUD operations
- Selectors provide clean access to state without prop drilling
- Stat overview β employee count, active tasks, completion rate, departments
- Employee table β search, department filter, add / edit / delete with confirm dialog
- Task management β create, assign to employee, filter by status, mark done, delete
- Reports β completion by department, employee performance table, CSV export
- Department management β workload cards, add / edit departments
- Personal stats β my tasks, completed count, leave balance, next meeting time
- Task list scoped to logged-in employee only β mark in-progress or done
- Leave management β balance cards (annual/sick/casual), apply form, history table
- Schedule β 7-day week strip, click any day to see its meetings
- Colleagues β team grid with online / away / offline status
- Announcements β company-wide notices filtered by type
- Fully responsive β mobile, tablet, and desktop layouts
- Reusable component library:
Button,Input,Modal,Table,Badge,EmptyState,Loader - Inline form validation errors, success toasts, and loading indicators
- Accessible β proper
aria-label, focus outlines, sufficient contrast ratios - Debounced inputs β validation doesn't fire on every keystroke
- Unique
<title>and<meta description>per page via React Helmet - Semantic HTML β
<header>,<main>,<section>,<nav>used correctly - All pages lazy-loaded with
React.lazy+Suspense - SVG icons used throughout β zero extra image HTTP requests
- Environment variables separate dev, staging, and production API base URLs
src/
βββ components/
β βββ shared/ # StatCard, TaskItem, StatusBadge, Avatar, ProgressBar
β βββ admin/ # EmployeeTable, CreateTaskForm, ActivityFeed, DepartmentCard
β βββ employee/ # LeaveBalanceCards, ScheduleList, ColleagueCard, AnnouncementCard
β βββ ui/ # Button, Input, Modal, Loader, EmptyState, FilterBar
β
βββ pages/
β βββ public/ # Home, About, Login, Signup
β βββ admin/ # AdminDashbord, AdminEmployees, AdminTasks, AdminReports, AdminDepartment
β βββ employee/ # EmpolyDashBoard, EmployeeTasks, EmployeeLeave, EmployeeSchedule, Colleagues, Annoucments
β
βββ store/
β βββ store.js # Redux store config
β βββ authSlice.js # Auth state β user, role, loginStatus, token
β βββ employeeSlice.js # Employee list, CRUD async thunks, loading/error states
β
βββ hooks/
β βββ useAuth.js # Access auth state and actions
β βββ useLogout.js # Clear state + localStorage + redirect
β βββ useValidator.js # Email/password regex validation helpers
β
βββ context/
β βββ AuthProvider.jsx # Auth context wrapping the app
β
βββ utils/
β βββ validators.js # Regex patterns for email and password
β βββ formatters.js # Date, name, and number formatters
β
βββ imports.js # Central re-export file for all pages and components
βββ Layout.jsx # Root layout with Outlet
βββ main.jsx # App entry β providers + router
βββ index.css # Tailwind imports + CSS design tokens
/ (Layout)
βββ / β Home [public]
βββ /about β About [public]
βββ /login β Login [guest only β redirects if logged in]
βββ /signup β Signup [guest only β redirects if logged in]
β
βββ /DashBoard β Dashboard shell [protected β must be logged in]
βββ index β RoleRedirect [admin β AdminDashbord, employee β employeedashboard]
βββ /overview β OverView [any logged-in user]
βββ /settings β Settings [any logged-in user]
β
βββ [AdminRoute] β admin role only
β βββ /AdminDashbord
β βββ /AdminEmployees
β βββ /AdminTasks
β βββ /AdminReports
β βββ /AdminDepartment
β βββ /AdminProfile
β
βββ [EmployeeRoute] β employee role only
βββ /employeedashboard
βββ /EmployeeTasks
βββ /EmployeeLeave
βββ /EmployeeSchedule
βββ /Colleagues
βββ /Annoucments
| Guard | Behaviour |
|---|---|
ProtectedRoute |
Redirects to /login if not logged in |
GuestRoute |
Redirects to /DashBoard if already logged in |
AdminRoute |
Redirects employee β /DashBoard/employeedashboard |
EmployeeRoute |
Redirects admin β /DashBoard/AdminDashbord |
RoleRedirect |
Reads role and sends user to the correct index page |
Follow these steps in order for the cleanest development experience:
| # | Step | What to build |
|---|---|---|
| 1 | Setup & Base Layout | Init Vite + TypeScript, configure React Router, create outer shell (navbar + sidebar + main), make responsive from day one |
| 2 | Design System | Tailwind config with color variables, typography scale, CSS design tokens in index.css |
| 3 | Authentication UI | Login + Signup pages, regex validation, password toggle, role selection, disable submit on invalid |
| 4 | Route Guards | ProtectedRoute, GuestRoute, AdminRoute, EmployeeRoute, RoleRedirect, 404 fallback |
| 5 | Redux Setup | authSlice, employeeSlice, async thunks, selectors, connect Provider in main.jsx |
| 6 | Admin Pages | AdminDashbord, AdminEmployees, AdminTasks, AdminReports, AdminDepartment |
| 7 | Employee Pages | EmpolyDashBoard, EmployeeTasks, EmployeeLeave, EmployeeSchedule, Colleagues, Annoucments |
| 8 | Data States | Loader, EmptyState, error banners, disable-during-fetch patterns |
| 9 | TypeScript Strict | Interfaces for all data shapes, typed props, typed Redux state, remove all any |
| 10 | Responsiveness | Mobile bottom nav, single-column stacking, test at 375px / 768px / 1280px |
| 11 | SEO & Performance | React Helmet per page, React.lazy all pages, SVG icons, .env config |
User opens app
β
βΌ
Logged in?
βββ NO β Public pages (Home, About, Login, Signup)
βββ YES β Check role
βββ admin β /DashBoard/AdminDashbord
βββ employee β /DashBoard/employeedashboard
β
User works in dashboard
β
Clicks Logout
β
Clear token + state
β
Redirect to / (Home)
Built with β€οΈ using React Β· TypeScript Β· Redux Toolkit Β· Tailwind CSS
