Skip to content

Repository files navigation

CB Employee Hub

CB Employee Hub is the native iOS employee operations app for Chicky Bites. Its production system of record is the linked InsForge PostgreSQL project. The older Express/SQLite application remains in this repository only as the migration source and historical reference; it is not the production client.

Implemented production scope

  • Multi-branch employee and role management.
  • InsForge Auth registration, email verification, sign-in, and employee invite linking.
  • Dynamic branch coordinates, 50-metre geofence, approved public IP ranges, and IP_OR_GPS attendance rules.
  • Employee-specific live face enrollment and matching, server-authoritative IP/GPS attendance validation, and audited manager overrides.
  • Sick, urgent, and normal leave requests, approvals, and editable paid/entitlement policies.
  • PKR compensation history, employee-specific joining dates, pay/cutoff dates, working-week schedules, scheduled-day proration, maker-checker payroll approval, payslip records, and payment tracking.
  • Private leave-document and payslip storage with organization/employee RLS.
  • Native Liquid Glass on iOS 26 with an iOS 17–25 material fallback.

Open and run the iOS app

  1. Open ios/ChickyBitesAttendance.xcodeproj in Xcode.
  2. Select the ChickyBitesAttendance scheme and an iOS 17+ simulator or device.
  3. Build and run. The public InsForge URL and anonymous client key are already configured; the administrative key is server-only.
  4. The designated owner email is the only account permitted to claim the initial owner membership. Employees register with their assigned email and claim the one-time code generated by an administrator.

Before real attendance, the owner must configure the Main Branch coordinates and at least one approved public IP in Branch Settings. Leave paid status/entitlements and every employee's salary, pay day, cutoff day, and working week should also be confirmed before the first payroll run.

Backend operations

The repository is linked to InsForge project 929bfc90-513b-4c13-84e5-71b8fc8c40d1. Versioned SQL is under migrations/, and the trusted attendance endpoint is functions/attendance-action.ts.

npx @insforge/cli db migrations list
npx @insforge/cli functions list

Do not embed an InsForge administrative key in iOS. Database changes must be made as migrations and checked into the repository.

Legacy web application (migration source only)

A modern web-based attendance platform for Chicky Bites with:

  • Secure admin authentication (session-based)
  • Admin-only control panel
  • Employee lifecycle management (add/update/delete)
  • Attendance tracking (present, absent, leave)
  • Leave request and approval workflow (admin-managed)
  • Biometric attendance
    • Face recognition (enroll/verify/remove profile)
  • Separate operational modes
    • Attendance Mode (kiosk-style daily operations)
    • Biometric Management (admin-only)

Tech Stack

  • Node.js + Express + EJS
  • SQLite (better-sqlite3)
  • Session auth (express-session)
  • Client-side face detection (face-api.js)

Setup

  1. Install dependencies:
npm install
  1. Configure environment:
cp .env.example .env
  1. Start the app:
npm start
  1. Open:
  • http://localhost:3000

Deploy on Render

This project includes /render.yaml for one-click Blueprint deployment.

1. Push project to GitHub

Render deploys from a Git repository.

git add .
git commit -m "Prepare Render deployment"
git branch -M main
git remote add origin <your-github-repo-url>
git push -u origin main

2. Create service from Blueprint

  1. In Render Dashboard, click New -> Blueprint.
  2. Connect your GitHub repo.
  3. Render reads render.yaml and creates the web service with a persistent disk.

3. Set required environment variables

In Render service settings, define:

  • ADMIN_EMAIL (your admin login email)
  • ADMIN_PASSWORD (strong password)
  • KIOSK_PIN (optional, for kiosk access)

Already configured by render.yaml:

  • NODE_ENV=production
  • DB_PATH=/var/data/chickybites.db (persistent SQLite path)
  • SESSION_SECRET (auto-generated)

Session storage in production uses SQLite-backed sessions (not MemoryStore), so login sessions survive restarts on the persistent disk.

At startup, the app now logs the active DB path and warns if production DB_PATH is not under /var/data. It also performs a one-time safe migration from legacy ./chickybites.db to the configured DB_PATH when the target file is missing.

4. Deploy and open

After the first deploy completes, open your Render URL and sign in with the admin credentials set above.

Note: If you change ADMIN_PASSWORD later in Render, restart/redeploy the service to sync the existing admin login hash.

Default Admin Login

  • Email: admin@chickybites.com
  • Password: ChangeMe@123

Change this immediately in production.

Biometric Notes

  • Face recognition:
    • Uses browser camera + face-api.js descriptor extraction.
    • Requires decent lighting and front-facing image capture.

Access Model

  • Only admin can sign in.
  • Optional kiosk attendance access via KIOSK_PIN.
  • Employee records do not have web login accounts.
  • Admin manages all employee data, including biometric and facial data.

Production Hardening Checklist

  • Use HTTPS and secure cookies (secure: true)
  • Rotate SESSION_SECRET
  • Add CSRF protection
  • Add login rate limiting and account lockouts
  • Add audit dashboard and immutable attendance logs
  • Add encrypted biometric template storage and retention policy
  • Replace local SQLite with managed DB for scale

Project Structure

  • /server.js - Routes, auth flow, and biometric API endpoints
  • /db.js - SQLite schema and data access functions
  • /middleware/auth.js - Auth + role middleware
  • /services/biometric.js - Face descriptor normalization + matching helpers
  • /views - EJS pages
  • /public - CSS and browser-side biometric JS
  • /assets/logo.png - Chicky Bites logo
  • /ios/ChickyBitesAttendance.xcodeproj - Native SwiftUI iPhone/iPad app

Previous native-app notes

The first scaffold used the web server. It has now been replaced by the native InsForge integration described above. Legacy browser face descriptors are intentionally not reused. An authorized manager enrolls each employee from the iOS Team screen using three live samples. Attendance requires a blink-and-turn liveness check, an on-device AdaFace IR-18 embedding, server-side matching against that employee's private template, and a short-lived one-use proof bound to the employee, branch, account, and device. Raw photos and video are not stored.

About

Chicky Bites Employee Attendence system

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages