Skip to main content

Components

Laravel API (server/)

ModuleResponsibility
app/ModelsEloquent definitions and relationships.
app/Http/Controllers/Api/V1Versioned REST controllers. Thin; delegate to services.
app/Http/RequestsFormRequest classes — validation and policy-based authorization.
app/Http/ResourcesResponse shaping.
app/Services/AttendancePunchIngestService, AttendanceProcessor, AttendanceRecalculator, AttendanceLocker.
app/Services/RosterRoster build, locum insertion, conflict detection.
app/Services/FlagsRed-flag rule evaluation and policy (allow / block / require approval).
app/Services/GeoGeo-fence haversine checks and violation detection.
app/Services/DevicesDevice registration, approval, fingerprint validation.
app/Services/ExportCSV / XLSX / PDF generators (queued jobs).
app/JobsQueue jobs invoked from services.
app/PoliciesPer-resource authorization.
app/FilamentSystemAdmin back-office panel resources.
routes/api.phpAll public REST routes, versioned under /api/v1.

React Web UI (ui/)

AreaResponsibility
src/app/routes.tsxRoute table with role guards.
src/app/layouts/AppShell.tsxRole-aware shell (sidebar, topbar, tenant switcher).
src/features/authLogin, token storage, token refresh.
src/features/orgsOrganization and unit CRUD.
src/features/employeesEmployee CRUD, transfers, category.
src/features/shiftsShift CRUD and unit assignment.
src/features/rosterMonthly roster grid editor.
src/features/attendanceDaily + monthly views, edit, export.
src/features/leaveLeave inbox for managers, request form for employees.
src/features/reportsFilter panel, preview, export.
src/lib/apiAxios instance + generated types from OpenAPI.
src/lib/authToken persistence, refresh, role introspection.

Flutter Mobile App (app/)

LayerResponsibility
lib/core/networkDio client, interceptors, retry, offline queue.
lib/core/storageSecure storage for tokens, device ID, offline punches.
lib/core/geoGeolocator wrapper, permission flow, distance calc.
lib/core/deviceDevice fingerprinting (platform + model + install ID).
lib/features/authLogin, OTP, device registration.
lib/features/attendanceCheck-in/out, status, offline buffer.
lib/features/leaveLeave request and status.
lib/features/regularizationCorrection request.
lib/features/profileEmployee profile, shift for today.

Telegram Bot (post-MVP)

  • Laravel webhook at /telegram/webhook.
  • Maintains employee_telegram_links table.
  • Commands: /login, /in, /out, /status, /leave.
  • Re-uses PunchIngestService — Telegram is just another channel.

Background Workers (Horizon)

QueuePurpose
punchesProcess raw punches into attendance rows.
recalcRecalculate attendance after regularization or roster change.
notificationsPush + email + Telegram notifications.
exportsLong-running CSV / XLSX / PDF generation.
auditWrite audit logs asynchronously when safe.

Datastores

  • MySQL 8 — primary OLTP store.
  • Redis — queues (Horizon), cache (policy decisions, roster lookups), rate limiters.
  • S3-compatible object storage — export artefacts, employee photos.