2025-10-08
admin
Diperbarui 2025-10-11

Aplikasi Absensi Wajah: Presensi Karyawan Lebih Mudah & Akurat

Kelola kehadiran karyawan dengan mudah dan modern! Aplikasi presensi wajah berbasis web dengan fitur lengkap: laporan real-time, manajemen karyawan, dan integrasi kamera. Siap tingkatkan efisiensi perusahaan Anda?
Aplikasi Absensi Wajah: Presensi Karyawan Lebih Mudah & Akurat

📱 Aplikasi Manajemen Presensi Karyawan

Aplikasi presensi karyawan modern dengan teknologi Face Recognition menggunakan Flask, Tailwind CSS, dan Face Recognition API.

✨ Fitur Utama

  • 🎯 Face Recognition - Presensi otomatis menggunakan pengenalan wajah
  • 📊 Dashboard Real-time - Monitoring presensi karyawan secara langsung
  • 👥 Manajemen Karyawan - CRUD data karyawan lengkap
  • 📸 Camera Integration - Check in/out langsung dari browser
  • 📈 Laporan Presensi - Rekap dan analisis kehadiran
  • 🌙 Dark Theme - Tampilan modern dengan dark mode
  • 📱 Mobile Responsive - Optimized untuk semua device
  • 🔒 Secure - Autentikasi dan authorization

🎨 Teknologi

  • Backend: Python Flask
  • Database: SQLite (SQLAlchemy ORM)
  • Frontend: HTML, Tailwind CSS
  • Icons: Font Awesome 6
  • Face API: Custom Face Recognition API

📋 Prerequisites

  • Python 3.8+
  • Face Recognition API running di http://localhost:8192
  • Browser dengan dukungan WebRTC (untuk kamera)

🚀 Instalasi

  1. Clone repository
git clone <repository-url>
cd attendance-app
  1. Install dependencies
pip install -r requirements.txt
  1. Konfigurasi API

Edit app.py dan sesuaikan:

FACE_API_URL = 'http://localhost:8192/api/v1'
FACE_API_KEY = 'your-api-key-here'
  1. Jalankan aplikasi
python app.py
  1. Akses aplikasi
http://localhost:5000

🔑 Login Default

  • Username: admin
  • Password: admin123

📁 Struktur Folder

attendance-app/
├── app.py                 # Main application
├── requirements.txt       # Dependencies
├── templates/            # HTML templates
│   ├── base.html
│   ├── login.html
│   ├── dashboard.html
│   ├── check_in.html
│   ├── check_out.html
│   ├── employees.html
│   ├── add_employee.html
│   └── attendance_report.html
├── uploads/              # Uploaded photos
└── instance/
    └── attendance.db     # SQLite database

💡 Cara Penggunaan

1. Tambah Karyawan Baru

  1. Login ke aplikasi
  2. Klik menu "Karyawan"
  3. Klik tombol "Tambah Karyawan"
  4. Isi form data karyawan
  5. Upload foto wajah (opsional)
  6. Klik "Simpan Karyawan"

2. Registrasi Wajah

Jika belum upload foto saat menambah karyawan:

  1. Buka halaman "Karyawan"
  2. Cari karyawan yang belum registrasi
  3. Klik "Register Face"
  4. Upload foto wajah yang jelas

3. Check In (Presensi Masuk)

  1. Klik menu "Check In"
  2. Izinkan akses kamera
  3. Posisikan wajah di tengah frame
  4. Klik "Ambil Foto & Check In"
  5. Sistem akan mengenali wajah dan mencatat presensi

4. Check Out (Presensi Keluar)

  1. Klik menu "Check Out"
  2. Izinkan akses kamera
  3. Posisikan wajah di tengah frame
  4. Klik "Ambil Foto & Check Out"
  5. Sistem akan mencatat waktu keluar

5. Lihat Laporan

  1. Klik menu "Laporan"
  2. Pilih rentang tanggal
  3. Filter berdasarkan status (opsional)
  4. Klik "Filter"
  5. Export ke Excel (jika diperlukan)

🔧 Konfigurasi Face Recognition API

Aplikasi ini terintegrasi dengan Face Recognition API. Pastikan API berjalan dengan endpoint:

  • Health Check: GET /api/v1/health
  • Process Image: POST /api/v1/process
  • Add Face: POST /api/v1/faces/add
  • Get Faces: GET /api/v1/faces

Header Required:

X-API-Key: your-api-key

Format Info Karyawan:

{
  "employee_id": "EMP001",
  "department": "IT",
  "position": "Software Engineer"
}

🎯 Status Presensi

  • Present (Hijau): Hadir tepat waktu (< 09:00)
  • Late (Kuning): Terlambat (≥ 09:00)
  • Absent (Merah): Tidak hadir

📊 Database Schema

Employee

  • id (Primary Key)
  • employee_id (Unique)
  • name
  • department
  • position
  • join_date
  • phone
  • email
  • face_registered (Boolean)
  • created_at

Attendance

  • id (Primary Key)
  • employee_id (Foreign Key)
  • check_in (DateTime)
  • check_out (DateTime)
  • photo_in
  • photo_out
  • status (Present/Late/Absent)
  • confidence (Float)
  • notes
  • created_at

User

  • id (Primary Key)
  • username (Unique)
  • password
  • role (admin/hr/employee)

🔐 Security Notes

⚠️ PENTING untuk Production:

  1. Ganti SECRET_KEY dengan key yang aman
  2. Gunakan password hashing (bcrypt/argon2)
  3. Implementasi HTTPS
  4. Rate limiting untuk API
  5. Input validation & sanitization
  6. CSRF protection
  7. Session management yang aman

🎨 Kustomisasi

Warna Theme

Edit di templates/base.html:

tailwind.config = {
    theme: {
        extend: {
            colors: {
                dark: {
                    bg: '#0f172a',    // Background
                    card: '#1e293b',   // Card background
                    border: '#334155', // Border color
                }
            }
        }
    }
}

Logo & Branding

Ganti icon di navigation:

<i class="fas fa-fingerprint text-blue-500"></i>
<span>Presensi Pro</span>

📝 Development

Menambah Fitur Baru

  1. Buat route di app.py
  2. Tambah template HTML di templates/
  3. Update navigation di base.html
  4. Test functionality

Database Migration

Jika ada perubahan model:

with app.app_context():
    db.drop_all()  # Hati-hati! Hapus data
    db.create_all()

🐛 Troubleshooting

Camera tidak berfungsi

  • Pastikan browser memiliki permission untuk kamera
  • Gunakan HTTPS atau localhost
  • Check browser compatibility

Face API tidak terhubung

  • Pastikan API berjalan di port 8192
  • Cek API key sudah benar
  • Verify endpoint URL

Database error

  • Hapus file attendance.db dan restart
  • Check file permissions

📞 Support

Untuk bantuan dan pertanyaan:

📄 License

MIT License - Free to use and modify

🙏 Credits

  • Flask Framework
  • Tailwind CSS
  • Font Awesome
  • Face Recognition API

Dibuat dengan ❤️ untuk sistem presensi modern

blog teknologi programming admin

Artikel Terkait