Skip to content

Latest commit

 

History

8 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HRIS & Attendance Management System

Sistem manajemen SDM & absensi karyawan: data karyawan, absensi (check-in/out + selfie/geofence), izin/cuti/sakit + approval, payroll & slip gaji, dan BPJS.

Monorepo dua aplikasi:

Folder Aplikasi Stack
backend/ REST API Go + Fiber, PostgreSQL (Neon) + GORM, JWT
mobile/ Aplikasi karyawan Flutter / Dart, Dio (JWT interceptor)

Arsitektur: modular monolith, layered per modul Handler → Service → Repository → Database. API REST/JSON dengan prefix /api/v1.


Struktur repo

Absensi/
├── backend/                 # Go Fiber API
│   ├── cmd/
│   │   ├── api/main.go       # entrypoint server
│   │   └── seed/main.go      # seeder data demo
│   ├── internal/
│   │   ├── auth/ employee/ attendance/ leave/ payroll/ bpjs/ face/
│   │   ├── middleware/       # jwt.go, role.go (RBAC)
│   │   ├── models/           # model GORM
│   │   ├── database/         # koneksi + pool + migrasi
│   │   ├── seed/             # seeder + normalisasi data
│   │   └── router/           # registrasi route
│   └── .env                  # konfigurasi (tidak di-commit)
├── mobile/                  # Flutter app
│   └── lib/
│       ├── api/              # Dio client + model
│       ├── screens/          # UI (home, attendance, leaves, payroll, profile)
│       ├── widgets/          # komponen bersama (AppCard, PrimaryButton, ...)
│       └── theme.dart        # token warna & tipografi
└── docs/                    # spesifikasi & ADR (lokal, tidak di-commit)

Catatan: semua file .md selain README.md diabaikan git (spec PRD.md/DESIGN.md/AGENTS.md & docs/ bersifat lokal).


Backend

Prasyarat

  • Go 1.22+
  • PostgreSQL (proyek ini pakai Neon — DB remote)

Konfigurasi (backend/.env)

APP_ENV=development
PORT=3000
DATABASE_URL=postgres://user:pass@HOST/db?sslmode=require
JWT_SECRET=ganti-secret-ini
ACCESS_TOKEN_DURATION=15m
REFRESH_TOKEN_DURATION=168h

JWT_SECRET wajib dari env, jangan commit. Untuk Neon, disarankan pakai host pooled (...-pooler.neon.tech) agar koneksi lebih hangat.

Jalankan

cd backend
go run ./cmd/api      # server di http://localhost:3000
go run ./cmd/seed     # (opsional) isi data demo

Migrasi tabel jalan otomatis saat startup (AutoMigrate). Koneksi memakai connection pool + SkipDefaultTransaction agar hemat round-trip ke DB remote.

Modul & aturan bisnis inti

  • Absensi — check-in 1x/hari; check-out hanya setelah check-in; working_minutes dihitung saat check-out. Selfie + geofence (radius kantor); face embedding on-device diverifikasi server bila karyawan sudah enroll.
  • Izin/Cuti — status Pending → Approved/Rejected/Cancelled. Employee boleh cancel saat masih Pending. Approval: MANAGER lalu HR.
  • Payroll — Gross = Basic + Allowance + Overtime + Bonus, Net = Gross − Deduction. Draft → publish; karyawan hanya melihat yang published. Slip dibuat HR/admin.

Mobile

Prasyarat

  • Flutter SDK (JDK 17 — Gradle 8.10.2; jangan flutter upgrade tanpa perlu)

Jalankan

cd mobile
flutter pub get
flutter run

Base URL API

Otomatis per target:

  • Android emulator → http://10.0.2.2:3000 (alias host)
  • Web / desktop / iOS simulator → http://localhost:3000
  • Device fisik → set manual ke IP LAN lewat Api.i.setBaseUrl(...)

Token JWT disimpan di device; GET response di-cache agar tetap tampil saat offline.


Autentikasi

  • Access token 15–30 menit, refresh token 7–30 hari. Header Authorization: Bearer <token>.
  • Payload JWT: sub, employee_id, role, iat, exp. Refresh via POST /api/v1/auth/refresh.
  • Password di-hash bcrypt (tidak pernah plaintext). Query parameterized (anti SQL injection). RBAC via middleware setelah validasi JWT.

Role (RBAC)

SUPER_ADMIN · HR · MANAGER · EMPLOYEE

  • POST /employees → SUPER_ADMIN, HR
  • POST /attendance/check-in → EMPLOYEE
  • Buat/terbitkan slip gaji → HR, SUPER_ADMIN
  • Approval izin/cuti → MANAGER lalu HR

API /api/v1

Grup Endpoints
Auth POST /auth/login · POST /auth/logout · POST /auth/refresh · GET /auth/me
Employees GET/POST /employees · GET/PUT/DELETE /employees/:id
Attendance POST /attendance/check-in · POST /attendance/check-out · GET /attendance · GET /attendance/history
Leave GET/POST /leaves · GET/PUT /leaves/:id · POST /leaves/:id/approve · POST /leaves/:id/reject
Payroll GET/POST /payrolls · GET /payrolls/:id · POST /payrolls/:id/publish · GET/POST /payroll-periods
BPJS GET/POST /bpjs · GET/PUT /bpjs/:id

Format respons

{ "success": true,  "message": "Success", "data": {} }
{ "success": false, "message": "Validation error", "errors": { "email": ["Email is required"] } }

Roadmap

MVP — auth+JWT, manajemen karyawan & role, absensi check-in/out + riwayat, izin + approval, payroll dasar + slip gaji.

Pasca-MVP — GPS/geofencing lanjutan, face recognition, push/email notification, payroll lanjutan, multi-branch/company.

About

Aplikasi Absensi Ladang Lima

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages