A lightweight daily report & hours tracking app with role-based dashboards, HR tools, client/activity analytics, and company-wide insights.
Frontend: React + Vite · Backend: Go (Gin) + MongoDB · Deployed on Vercel (FE) and Render (BE).
Superadmin + per-department Admin/Employee demo accounts are already provisioned on the live server so you can try the app end-to-end.
🌐 Live on Vercel:
https://report-management-system-one.vercel.app
Superadmin
email: daniel.cross@example.com
password: 123
Admin (e.g., Sales)
email: olivia.trent@example.com
password: 123
HR
email: ellie.cantrell@example.com
password: 123
Employee (e.g., Sales)
email: aaron.blake@example.com
password: 123
ℹ️ HR, multi-department accounts, and client analytics are easiest to see when logged in as Superadmin (for the Company Review & HR tools) and as Admin/Employee (for daily flow).
-
🕒 Daily Reports
- Employees submit per-day reports with total hours + detailed entries (activity, client, hours, notes).
- Edit today’s report or revisit previous days from history.
-
🔍 Smart Search
- Full-text search on report content (title/body).
- Filter by department, date range, and employee (for admins/superadmin).
-
👥 Employee & Department Analytics
- Department dashboards with:
- Time-series charts (7d, 30d, 6m, 12m).
- Totals, averages, and top contributors.
- Compare multiple employees within a department on the same chart.
- Department dashboards with:
-
🧠 Company Review (Superadmin Analytics Layer)
- Company Summary card with:
- Employees: total, active, on leave, sick, military, resigned
(calculated unique per email, so multi-department clones count as one person). - Clients: total vs active (by usage).
- Activities: total vs active.
- Departments: total, active, archived.
- Employees: total, active, on leave, sick, military, resigned
- Reports Coverage:
- View which departments actually uploaded reports.
- Shows number of reports and unique employees who reported.
- Mix Pie Charts:
- Client mix: which clients consume most hours (7d/30d/6m/12m).
- Activity mix: which activities consume most hours.
- Department hours pie: which departments log more hours.
- Per-department activity pie: within a department, which activities dominate.
- Client Trends:
- Detect clients whose hours are trending up or down between two consecutive periods.
- Shows current vs previous hours, absolute & % delta, and “up/down/flat” trend.
- Company Summary card with:
-
📋 People / Clients / Activities / Departments Detail Modal
- A “Details” modal (Summary Inspect) where Superadmin can drill down into:
- People: lists on leave, sick, military service, resigned (with dates & departments).
- Clients: split into “Active / Not Active” based on last 30 days of recorded hours.
- Activities: which activities were used vs not used in the recent period.
- Departments: active vs archived departments and their employee counts.
- Built-in search inside the modal for quick filtering and highlighting.
- A “Details” modal (Summary Inspect) where Superadmin can drill down into:
-
💬 Reminders & Messages
- HR/Admin/Superadmin can send department-targeted or company-wide announcements.
- Reminders auto-expire after a certain time window so the UI stays clean.
-
📊 Exports (Experimental)
- Frontend-only export buttons (CSV/PNG) on some charts.
This feature is experimental and may not be fully reliable yet.
-
🧱 Role-Based Access Control
- Roles: Superadmin, HR, Admin, Employee.
- All protected routes are gated via JWT + role checks on both backend and frontend.
-
🔐 SPA-safe Routing & Auth
- React Router SPA setup, with
RedirectIfAuthandRequireRoleguard components. - Deep links and refreshes work; unauthorized access redirects back to
/login.
- React Router SPA setup, with
The HR role gets a dedicated dashboard to manage structural data about the company:
-
🗂 Departments Management
- Create, rename, and archive departments.
- Backend enforces department collection seeding and keeps field names consistent.
- Archived departments are treated separately in analytics & summaries.
-
🧑💼 Employee Status Tracking
- HR can maintain a status timeline for each employee:
active,on_leave,sick,military,resigned- Optional
untildates for time-bound statuses (on_leave,sick,military). resignedautomatically pins the resignation date to “today”.
- Backend guarantees:
- Per-user latest status via aggregation.
- Company Summary uses these to compute active/leave/sick/military/resigned counts.
- HR can maintain a status timeline for each employee:
-
🎨 Branding
- HR can adjust basic branding:
- Company name / brand label.
- (Optionally) primary color / logo settings depending on environment.
- HR can adjust basic branding:
Some people work across multiple departments (e.g., Sales and Support).
The system models this via per-department user clones linked by the same email:
-
HRAssignDepartmentcreates a new user record for the same email in another department:- Copies only core fields (name, email, hash, role).
- Does not copy client assignments — new department starts clean.
-
HRRemoveDepartmentremoves a specific department copy:- Cleans up related
reports,messages,self_reminders,employee_statusfor that user/dept. - Optionally creates a fallback “Development” user if no other department records exist for that email.
- Cleans up related
On the frontend:
- Top bar shows current department and a department switcher:
GET /api/auth/my-accountsreturns all accounts (clones) for the logged-in email.POST /api/auth/switch-accountreturns a new JWT + user payload for the chosen department.- A smooth overlay (
DepartmentSwitchOverlay) shows a “Switching to X Department…” animation before reload.
This makes multi-department work realistic while still keeping per-department data isolated.
- The
clientscollection stores all client names. - HR/Admin/Superadmin can:
- Add new clients from the Clients Manager modal.
- Soft-delete clients:
DELETE /api/clients/:idsetsactive: false. - Reactivate clients later with a dedicated “Reactivate” button.
On the frontend:
HRClientsManagerallows:- Adding new active clients.
- Listing active or inactive clients (toggle “Show Active / Show Inactive”).
- Soft-delete & restore using a clean confirmation flow and toast notifications.
- Admins and Superadmin can assign which clients a user is allowed to report for:
- API:
PUT /api/users/:id/clientswith a list of client IDs. - Enforced so department admins can only manage users within their department.
- API:
- Employee dashboards can then use this set to drive:
- Allowed client dropdowns in report entries.
- Client-based analytics for that user.
- Activities are defined per department.
- HR/Admin/Superadmin can see:
- Which activities are in use vs unused in a given period via Company Review → Activities.
- Activity mix charts to understand where hours are spent.
- Full company-wide access:
- Company Review: summary cards, coverage stats, global mix pies, client trends.
- View analytics across all departments, switch context, and compare departments.
- Manage:
- Users (add admin/employee, multi-department assignment).
- HR-related metadata (with HR role).
- Global reminders/messages.
- Doesn’t submit personal reports (no “My Activity” section).
- Manage departments, employee statuses, and branding.
- See company-level people breakdown:
- Who is on leave, sick, military, or resigned and until when.
- Can coordinate with Superadmin/Admin for structural changes.
- Full analytics for their department only:
- Trends, stats, top contributors, coverage.
- Manage:
- Employees in their department (user list, basic user info).
- Client assignments for their department’s employees.
- Department-level reminders/messages.
- Also has a personal daily report flow (write/edit/search own reports).
- Submit/edit daily/weekly reports (hours + content + activity/client breakdown).
- View personal history and summary statistics (“My Activity”).
- See department reminders & general announcements.
- React + Vite
- React Router (protected routes with
RequireRole/RedirectIfAuth) - Recharts (data viz: trends, pies, coverage charts)
- Lucide React (icons)
- Vanilla CSS modules (custom layout & styling)
- Lightweight Toast system for notifications
- Go (Gin) for HTTP API
- MongoDB with official Go driver
- JWT auth (
golang-jwt) - bcrypt for password hashing
- CORS, environment-based configuration (
dotenvstyle)
- Vercel – frontend hosting
- Render – backend hosting
- MongoDB Atlas – managed database
-
Go ≥ 1.22 (install the latest stable)
-
Node.js ≥ 18 and npm
-
A MongoDB connection string (Atlas or local)
Departments are seeded automatically on backend start if the collection is empty.
1.1 Clone the repo
git clone https://github.com/<your-user>/<your-repo>.git
cd <your-repo>
1.2 Create env files
Backend (backend/.env)
PORT=5000
MONGO_URI=<your-mongodb-uri>
JWT_SECRET=<a-long-random-secret>
# Optional in local (CORS already allows localhost:5173)
# CLIENT_URL=http://localhost:5173
Frontend (frontend/.env)
VITE_API_URL=http://localhost:5000/api
1.3 Install dependencies
Backend
cd backend
go mod download
Frontend
cd frontend
npm install
Two terminals:
Terminal A – Backend
cd backend
go run main.go
# → http://localhost:5000
Terminal B – Frontend
cd frontend
npm run dev
# → http://localhost:5173
Then open http://localhost:5173 in your browser and log in with one of the demo users.
You don’t need to reinstall anything unless dependencies changed.
Backend
cd backend
go run main.go
Frontend
cd frontend
npm run dev
Most common (after pulling, or when you added/removed imports):
cd backend
go mod tidy # cleans up go.mod/go.sum (adds missing, drops unused)
go mod download # (optional) pre-download modules
Add a new dependency:
go get github.com/some/lib@latest
go mod tidy
Update all to latest minor/patch:
go get -u ./...
go mod tidy
Fix checksum / sum mismatches:
go clean -modcache
go mod tidy
go mod download
Verify everything is consistent:
cd backend
go mod verify
Rule of thumb: whenever go.mod or go.sum changes, go mod tidy is usually all you need. For new deps, do go get … then go mod tidy.
-
CORS (local): Already whitelisted for
http://localhost:5173andhttp://127.0.0.1:5173.CLIENT_URLis not required locally. -
CORS (prod): When deployed, set
CLIENT_URLon the backend to your Vercel URL, and setVITE_API_URLon the frontend to your backend’s/apibase. -
Ports: Backend defaults to
:5000; Frontend (Vite) defaults to:5173. -
Mongo: Use Atlas or a local MongoDB; just point
MONGO_URIto the right place. -
Auto seed:
Departmentsindexes + seed run automatically on backend start if empty.
-
🔐 Auth & History
- Protected routes always check JWT + role.
- Hitting
/(login) while already authenticated redirects to the correct dashboard (/superadmin,/admin,/hr, or/employee).
-
👥 Multi-Department Users
- Same email can have multiple department accounts.
- Switching departments refreshes your token and user context; an overlay shows which department you’re moving into.
-
🧍 Employee Status Consistency
- Statuses are stored in a separate collection with timestamps.
- Company Summary and People detail lists are derived from the latest status per user, with resigned users excluded from “active” counts.
-
📊 Analytics Context
- All charts (department, client, activity, company) respect the selected period (7d/30d/6m/12m).
- “Active / Not Active” for clients & activities is defined by non-zero hours in the last 30 days (for the relevant view).










































