How ralphacoba/staffsync-hr works
1. This repository is a Base44-backed React single-page application for workforce operations: attendance/biometrics, scheduling, employees, and payroll. The architecture is split between a Vite front end in src/ and a Base44 backend definition in base44/.
2. The front end is the presentation and interaction layer. src/main.jsx, src/App.jsx, and src/pages/* define routed application screens such as Dashboard, Employees, Schedule, Payroll, BiometricAttendance, and DTRReview. ProtectedRoute and AuthContext indicate authentication-gated access to most of the app.
3. Domain functionality is organized by feature area under src/components/. The main clusters are:
- biometric/ for log import, manual entry, settings, review tables, and punch history
- employees/ for employee CRUD and CSV import
- schedule/ for shifts, templates, and shift CSV import
- payroll/ for deductions, tax/overtime settings, holiday/service charge management, payroll summaries, audit logs, and remittance reporting
- dashboard/ for high-level operational widgets
This organization maps closely to the backend entities.
4. The Base44 backend data model lives in base44/entities/*.jsonc. The core persistent objects are Employee, Shift, ShiftTemplate, PunchEvent, TimeEntry, BiometricLog, BiometricSettings, PayrollRun, PayrollAuditLog, Deduction, Holiday, OvertimeSettings, TaxSettings, ServiceChargePool, DailyRevenue, and User. These entities form the system-of-record for operational data and payroll calculations.
5. Data flow starts from user interaction in the React UI, then goes through src/api/base44Client.js to the Base44 backend. That client is the main boundary between browser state and persisted application data. The app likely uses query-client.js for caching/refreshing server state, which is important because many screens appear to render live operational records.
6. There are two backend functions in base44/functions/, both focused on ingestion/synchronization:
- importBiometricLogs handles biometric log import, likely transforming raw attendance exports into stored logs/events.
- syncShiftFromShiftSync keeps shift data synchronized from an external or upstream shift source.
These functions represent server-side processing boundaries for bulk data import and integration logic.
7. Attendance processing is a multi-step subsystem. Biometric logs and punch events are captured, reviewed, and then turned into attendance records/time entries. The UI includes import and review components (BiometricImport, DTRImport, AttendanceReviewTable, PunchEventsTable, BiometricHistoryView, BiometricManualEntry), suggesting a workflow of ingest → inspect/clean → finalize into usable timekeeping data.
8. Scheduling is a separate but connected subsystem. Shift, ShiftTemplate, and the schedule UI indicate reusable templates and shift instances. ShiftCSVImport and the syncShiftFromShiftSync function imply that schedules can be loaded in bulk or synchronized from another system, then consumed by attendance and payroll logic.
9. Payroll is driven by the operational data above plus policy/configuration entities. Deductions, TaxSettings, OvertimeSettings, Holiday, and ServiceChargePool influence payroll calculations, while PayrollRun and PayrollAuditLog capture executed payroll periods and traceability. The payroll UI includes summary, employee breakdown, history, statutory remittance, and settings cards, which suggests a calculation-and-review workflow rather than a simple report page.
10. The dashboard is an aggregation layer rather than a source-of-truth layer. Widgets like attendance alerts, labor cost charts, recent payroll, and today’s schedule pull from multiple domains to provide operational visibility. This is the main cross-domain read path in the app.
11. Export/document generation is handled locally in src/utils/. generatePayslipPdf.js and exportAttendanceReport.js indicate that some reporting artifacts are generated on the client side from fetched domain data, rather than being fully delegated to the backend.
12. The UI stack is a reusable component system layered over domain screens. The many files in src/components/ui/ suggest a shared design-system approach, while Tailwind/PostCSS and Vite handle styling and build/runtime concerns. This means the architecture is primarily feature/domain-driven, with a common UI foundation beneath it.
13. Deployment and configuration are Base44-centric. The README shows required environment variables for VITE_BASE44_APP_ID and VITE_BASE44_APP_BASE_URL, so the app is configured to connect to a specific Base44 backend instance. That makes the backend platform part of the runtime boundary, even though the repository contains both client and schema/function definitions.
14. For an architecture diagram, the clearest decomposition is: browser UI and routing on the left, Base44 data model and server functions on the right, with the main business flows running through attendance import/review, schedule management, payroll calculation, and dashboard/reporting reads across shared entities.
Main entry points: base44Client.js Base44 client · AppLayout.jsx App layout · dashboard Dashboard widgets · PunchEvent.jsonc Attendance model
Components 26
Frontend
React SPA, routing, feature screens, and shared UI
- App entry · Vite startup and app mounting
src/main.jsx - Root app · Top-level routing and page composition
src/App.jsx - Auth context · Authentication and user session state
src/lib/AuthContext.jsx - Protected route · Access control for authenticated screens
src/components/ProtectedRoute.jsx - App layout · Global navigation and page chrome
src/components/layout/AppLayout.jsx - Dashboard page · Operational summary and cross-domain widgets
src/pages/Dashboard.jsx - Employees page · Employee management screen
src/pages/Employees.jsx - Schedule page · Shift planning and schedule management screen
src/pages/Schedule.jsx - Attendance page · Biometric attendance and review screen
src/pages/BiometricAttendance.jsx - DTR review · Daily time record review workflow
src/pages/DTRReview.jsx - Payroll page · Payroll calculation, settings, and reporting screen
src/pages/Payroll.jsx - Dashboard widgets · Attendance alerts, labor cost, recent payroll, and today schedule cards
src/components/dashboard - Biometric tools · Import, manual entry, review, history, and settings for attendance processing
src/components/biometric - Employee tools · Employee CRUD and CSV import components
src/components/employees - Schedule tools · Shift forms, templates, and CSV import components
src/components/schedule - Payroll tools · Deductions, settings, summaries, audit, and remittance components
src/components/payroll
Base44 Backend
Persistent entities and server-side ingestion/sync functions
- Attendance model · Biometric logs, punch events, and time entries
base44/entities/PunchEvent.jsonc - Schedule model · Shifts and reusable shift templates
base44/entities/Shift.jsonc - People model · Employees and user access records
base44/entities/Employee.jsonc - Payroll model · Payroll runs, audit logs, deductions, and policy settings
base44/entities/PayrollRun.jsonc - Settings model · Attendance, tax, overtime, holiday, and service charge configuration
base44/entities/BiometricSettings.jsonc - Import logs · Transforms raw biometric exports into stored attendance data
base44/functions/importBiometricLogs/entry.ts - Sync shifts · Synchronizes shifts from an upstream source
base44/functions/syncShiftFromShiftSync/entry.ts
Shared UI
Reusable UI primitives and client-side helpers
- Base44 client · Browser boundary to the Base44 backend
src/api/base44Client.js - Query client · Server-state caching and refresh coordination
src/lib/query-client.js - Reports utils · Client-side payroll and attendance document generation
src/utils
Connections 34
- App entry → Root app: starts · Bootstraps the SPA
- Root app → Auth context: uses · Reads session state for routing and access
- Root app → Protected route: guards · Wraps authenticated pages
- Protected route → App layout: renders · Places pages inside the shared shell
- App layout → Dashboard page: navigates to · Primary landing screen
- App layout → Employees page: navigates to · HR management screen
- App layout → Schedule page: navigates to · Scheduling screen
- App layout → Attendance page: navigates to · Attendance capture and review screen
- App layout → Payroll page: navigates to · Payroll operations screen
- App layout → DTR review: navigates to · DTR review screen
- Dashboard page → Dashboard widgets: composes · Aggregates cross-domain operational cards
- Attendance page → Biometric tools: uses · Attendance import and review workflow
- Employees page → Employee tools: uses · Employee maintenance workflow
- Schedule page → Schedule tools: uses · Shift planning workflow
- Payroll page → Payroll tools: uses · Payroll calculation and reporting workflow
- Biometric tools → Base44 client: reads/writes · Persists biometric data and settings
- Employee tools → Base44 client: reads/writes · Persists employee records
- Schedule tools → Base44 client: reads/writes · Persists shifts and templates
- Payroll tools → Base44 client: reads/writes · Loads payroll data and settings
- Dashboard widgets → Query client: refreshes via · Relies on cached server-state queries
- Base44 client → Attendance model: syncs · Biometric logs, punch events, and time entries
- Base44 client → Schedule model: syncs · Shift and template records
- Base44 client → People model: syncs · Employee and user records
- Base44 client → Payroll model: syncs · Payroll runs, deductions, and audit trail
- Base44 client → Settings model: syncs · Biometric and payroll policy settings
- Import logs → Attendance model: produces · Creates or updates attendance records from imports
- Sync shifts → Schedule model: produces · Keeps shifts aligned with upstream source
- Reports utils → Payroll model: exports · Builds payslips and attendance reports from fetched data
- Reports utils → Attendance model: exports · Uses attendance data for reporting artifacts
- Dashboard widgets → Attendance model: reads · Attendance alerts and operational stats
- Dashboard widgets → Schedule model: reads · Today schedule view
- Dashboard widgets → Payroll model: reads · Recent payroll and labor cost signals
- Payroll tools → Attendance model: depends on · Payroll calculations consume timekeeping data
- Payroll tools → Schedule model: depends on · Payroll and summaries use schedule context