How mochputrafs/otium works
Otium is an employee leave-management application. Its central workflow is leave entry and quota/availability checking, followed by leader verification and HRD approval, with history, cancellation/refund, and printable approval documents. Separate product areas cover role-based access, dashboards and calendar, and administration of users, divisions, leave types, holidays, and policies. The map reflects README-documented capabilities and source-index references; several UI-to-route connections are documented at feature level rather than verified in excerpts, so those links are marked dashed.
Main entry points: db.js PostgreSQL · leave-request-actions.js Leave submission and cancellation · auth.js Authentication and RBAC · route.js Availability and what-if
Components 33
Access and workspace
- Login
src/app/(auth)/login/page.jsx - Login form
src/components/auth/LoginFormCard.jsx - Login endpoint
src/app/api/auth/login/route.js - Authentication and RBAC
src/lib/auth.js - Session tokens
src/lib/jwt.js - Route protection
src/middleware.js - Workspace shell
src/components/layout/AppShellClient.jsx - Notifications
src/app/api/notifications/route.js - Server validation
src/lib/validators.js
Leave lifecycle
- Leave request form
src/components/leaves/LeaveRequestForm.jsx - Availability and what-if
src/app/api/leaves/check-availability/route.js - Leave submission and cancellation
src/actions/leave-request-actions.js - Leave history endpoint
src/app/api/leaves/route.js - Leave history
src/components/leaves/LeaveHistoryClient.jsx - Leave request data
src/lib/leave-request-data.js - Approval letter PDF
src/app/api/leaves/[id]/pdf/route.js - Date and quota calculations
src/lib/date-utils.js
Approval workflow
- Leader verification
src/components/approvals/LeaderVerificationClient.jsx - HRD final approval
src/components/approvals/HrdApprovalClient.jsx - Approval actions
src/actions/approval-actions.js - Approval endpoints
src/app/api/approvals - Approval workflow data
src/lib/approval-data.js
Calendar and insights
- Role dashboards
src/components/dashboard - Dashboard endpoint
src/app/api/dashboard/route.js - Dashboard queries
src/lib/dashboard-data.js - Company calendar
src/components/calendar/CompanyCalendarClient.jsx - Calendar endpoint
src/app/api/calendar/route.js - Calendar data
src/lib/calendar-data.js
Administration and policy
- Policy and capacity rules
src/lib/policy-data.js - Admin management
src/components/admin - Admin actions
src/actions
Other components
- Employee
- PostgreSQL
src/lib/db.js
Connections 42
- Employee → Login: signs in
README.md - Login → Login form: renders
- Login form → Login endpoint: submits credentials
- Login endpoint → Authentication and RBAC: authenticates
src/app/api/auth/login/route.js - Authentication and RBAC → Session tokens: creates and verifies
src/lib/auth.js - Route protection → Session tokens: verifies session
src/middleware.js - Authentication and RBAC → PostgreSQL: queries users
src/lib/auth.js - Employee → Leave request form: enters leave request
README.md - Leave request form → Availability and what-if: checks projection
- Availability and what-if → Policy and capacity rules: checks capacity and blackout
src/app/api/leaves/check-availability/route.js - Availability and what-if → Server validation: validates input
src/app/api/leaves/check-availability/route.js - Availability and what-if → PostgreSQL: queries leave and holiday data
src/app/api/leaves/check-availability/route.js - Leave request form → Leave submission and cancellation: submits request
- Leave submission and cancellation → Authentication and RBAC: checks identity
src/actions/leave-request-actions.js - Leave submission and cancellation → Policy and capacity rules: checks policy
src/actions/leave-request-actions.js - Leave submission and cancellation → PostgreSQL: writes atomically
src/actions/leave-request-actions.js - Leave history → Leave submission and cancellation: requests cancellation
src/components/leaves/LeaveHistoryClient.jsx - Leave history → Leave history endpoint: loads history
- Leave history endpoint → Leave request data: reads requests
src/app/api/leaves/route.js - Leave request data → PostgreSQL: queries leave records
src/lib/leave-request-data.js - Leave history → Approval letter PDF: opens printable letter
README.md - Approval letter PDF → Leave request data: loads request detail
src/app/api/leaves/[id]/pdf/route.js - Employee → Leader verification: leader verifies
README.md - Leader verification → Approval actions: submits verification
src/components/approvals/LeaderVerificationClient.jsx - HRD final approval → Approval actions: approves or rejects
src/components/approvals/HrdApprovalClient.jsx - Approval endpoints → Approval workflow data: routes approval requests
src/app/api/approvals/hrd/route.js - Approval actions → Authentication and RBAC: checks identity
src/actions/approval-actions.js - Approval actions → Approval workflow data: executes approval workflow
src/actions/approval-actions.js - Approval workflow data → Policy and capacity rules: checks capacity policy
src/lib/approval-data.js - Approval workflow data → PostgreSQL: reads and writes approvals
src/lib/approval-data.js - Employee → Company calendar: views team calendar
README.md - Company calendar → Calendar endpoint: loads calendar
- Calendar endpoint → Calendar data: loads calendar entries
src/app/api/calendar/route.js - Role dashboards → Dashboard endpoint: loads dashboard
- Dashboard endpoint → Dashboard queries: loads metrics
src/app/api/dashboard/route.js - Dashboard queries → PostgreSQL: queries metrics
src/lib/dashboard-data.js - Admin management → Admin actions: manages records
src/components/admin/AdminUsersClient.jsx - Admin management → Policy and capacity rules: manages leave policies
- Admin actions → PostgreSQL: persists administration data
src/actions/approval-actions.js - Workspace shell → Notifications: loads notifications
- Notifications → PostgreSQL: reads and updates notifications
src/app/api/notifications/route.js - Date and quota calculations → Leave request form: supports date calculations