SYS.ID: THEORIONGD
INNOVATE. BUILD. IMPACT.
BACK TO MASTER CATALOG
SPEC-ID: FENCEIN-ACCESSCONTROLDOM: [CYBERSECURITY & EDGE AI]DEVELOPMENT BUILD

FenceIn Enterprise OS

Workforce Access Control with ArcFace Biometrics & Dynamic Haversine Geofencing.

TECHNICAL SPECIFICATION SHEETREVISION: 2025
SYSTEM NAME:FenceIn Enterprise OS
VERIFIED MATURITY:DEVELOPMENT BUILD
DEVELOPMENT YEAR:2025
DOMAIN CATEGORY:Cybersecurity & Edge AI
COLLABORATORS:GRISH-SWIZZ
SYSTEM PERFORMANCE PARAMETERS:
Geofence Algorithm:Haversine Perimeter Validation
Vector Store:pgvector (512-dim Embeddings)
Encryption:AES-CBC Minutiae Obfuscation
TECH STACK:Next.jsReactNestJSpgvectorMongoDBAES-CBCWebSockets
SYSTEM ARCHITECTURE & TECHNICAL OVERVIEW

ARCHITECTURAL SPECIFICATION

Heavy industrial workforce management platform integrating ArcFace ONNX face biometrics and AES-CBC encrypted fingerprint minutiae matching. Validates physical attendance dynamically using Haversine coordinate geofencing rules and streaming telemetry over WebSockets.

ORIGINAL REPOSITORY DOCUMENTATION (README)
README DOCUMENT
FenceIn Platform

🛡️ FenceIn Enterprise OS

Unified Command & Control Architecture for Industrial Workforce Intelligence

TypeScript NestJS React PostgreSQL MongoDB Vite

FenceIn is an enterprise-grade Unified Command & Control Architecture designed for heavy industries, log-yards, classification hubs, and construction sites to securely orchestrate permanent employees and temporary contract workforces. By integrating multimodal biometrics (facial recognition + fingerprint verification), active geofencing, dual-database data partitioning, and real-time WebSocket syncing, FenceIn eliminates badging fraud, automates shift enforcement, and yields deep operational intelligence.


🚀 Platform Overview

FenceIn acts as a high-security operational command hub. The core architecture segregates high-throughput transaction processing from logging overhead, employing robust local biometrics running ONNX neural models directly on client/edge hardware without third-party cloud dependencies.


✨ Core Highlights & Architecture

1. Dual-Database Hybrid Storage

To keep relational identity pipelines performing under high loads, the platform partitions data:

  • PostgreSQL Relational Core: Houses high-integrity transactional schemas (Users, Tenants, Worker-Sites, Shifts, Kiosks) and is optimized with pgvector index tables for 512-dimensional facial cosine matching.
  • MongoDB Analytics Logs Engine: Asynchronously logs raw telemetry streams, biometric inference history cards, Sentry/health metrics, and daily analytical snapshots, keeping PostgreSQL lean.

2. Multimodal Local Biometrics Engine

  • Face Recognition: Features local UltraFace ONNX sessions for robust cropping, and ArcFace ONNX sessions yielding deterministic 512-dimensional vector embeddings. Includes variance traps (variance < 1e-4) to block static/mock bypass hacks.
  • Fingerprint Verification: Extracts keypoint minutiae via ORB keypoint mapping on the Python microservice. Encrypts templates deterministically via AES-256-CBC using keys derived from process JWT_SECRET through crypto.scryptSync. This allows safe exact-match duplicate checks while isolating fingerprint assets per tenant.

3. Active Geofencing & Trust Engine

  • Enforces perimeter checks by computing real-time coordinate distances against assigned Site radius bounds in meters using the Haversine formula. Geofence bounds breaches trigger automatic HIGH severity incidents.
  • Check-in trust scores are computed dynamically using a weighted composite formula: $$\text{finalTrustScore} = (F_{\text{conf}} \times 0.4) + (L_{\text{score}} \times 0.3) + (G_{\text{conf}} \times 0.2) + (D_{\text{trust}} \times 0.1)$$ If the liveness score falls below 0.5, the scan is rejected and logged as a CRITICAL spoof attempt.

4. SaaS Tenant Provisioning Pipeline

  • Organizations submit details via onboarding request forms (OrganizationRequest).
  • Platform administrators review and provision workspaces through atomic Prisma database transactions.
  • Provisioning automatically builds a Tenant context (slug, unique org code like OG001), creates a sequential SUPER_ADMIN profile (e.g. SA001), and forces first-login password updates (mustChangePassword: true) and biometric enrollments (biometricPending: true).

🔐 9-Tier Command & Control RBAC Matrix

FenceIn isolates data and privileges across 9 granular hierarchical tiers:

TierRole StringLevel ScopePrimary Capabilities
9PLATFORM_HEADPLATFORM CONTROLSystem-wide aggregates, signup requests review, tenant provisioning transactions, multi-tenant incident monitoring.
8PLATFORM_ADMINPLATFORM COMPLIANCEReviewing pending signup requests and auditing global security event logs.
7SUPER_ADMINTENANT COMMANDSingle tenant command dashboard, profile setups, manager allocations, CSV exports.
6ORG_ADMINORG CONFIGManaging organization profiles, site GPS geofences mapping, vendor registrations.
5HR_ADMINHR COMPLIANCEWorker credentials validation, govt IDs tracking, generating timesheet billing matrices.
4SUPERVISORSITE COMMANDCreating shift schedules, roster allocations, manual override check-ins, active geofence alerts.
3SECURITY_OFFICERGATE CONTROLBiometric gate kiosk monitors, face liveness reviews, active spoof alarm handling.
2VENDOR_MANAGERVENDOR SCOPEPre-registering sub-contractors and mapping workers under approved vendor contracts.
1WORKERTRACKINGScanning geofenced kiosks, tracking schedules, viewing IndexedDB sync logs cards.

🔑 Seeded Demo Credentials (Local Development)

The local databases are seeded with pre-configured accounts mapped to various roles for seamless testing:

Platform-Level Accounts (Global Scope)

Seeded User IDEmail addressPasswordInitial Role
PLT001godfrey.cs23@krct.ac.inFenceIN@PLTHeadPlatform Head (PLATFORM_HEAD)
PLT002grishnarayanan.cs23@krct.ac.inFenceIN@PLTHeadPlatform Head (PLATFORM_HEAD)
PLT003girijesh.cs23@krct.ac.inFenceIN@PLTHeadPlatform Head (PLATFORM_HEAD)

Tenant-Level Accounts (Seeded Tenant: SHIELD)

Seeded User IDEmail addressPasswordInitial Role
SA001superadmin@fencein.appadmin123Super Admin (SUPER_ADMIN)
OA001orgadmin@fencein.appadmin123Organization Admin (ORG_ADMIN)
HR001hr@fencein.appadmin123HR Admin (HR_ADMIN)
SV001supervisor@fencein.appadmin123Workforce Supervisor (SUPERVISOR)
SO001security@fencein.appadmin123Security Officer (SECURITY_OFFICER)
VM001vendor@fencein.appadmin123Vendor Manager (VENDOR_MANAGER)
WRK001worker@fencein.appadmin123Contractor / Worker (WORKER)

⚠️ Production Security Notice: Pre-configured passwords must be rotated immediately in public/production staging installations.


🏗️ Technical Stack

PWA Frontend Client

  • Core framework: React 19 + Vite + TypeScript
  • State manager: Zustand, TanStack Query
  • UX styling: Vanilla CSS + Tailwind CSS, Framer Motion animations
  • Local persistence: IndexedDB + Service Workers background sync

Backend REST API Gateway

  • Gateway: NestJS
  • SQL DB: PostgreSQL (using Prisma ORM and pgvector)
  • NoSQL DB: MongoDB (using native drivers for async analytical offloads)
  • Realtime: WebSockets (socket.io Gateway feeds)

Biometrics Processing Service

  • Processor Engine: Python 3 + FastAPI microservice
  • Computer Vision: OpenCV + ONNX Runtime (UltraFace RFB-320 + ArcFace models)
  • Minutiae mapping: ORB keypoint extraction

🚀 Getting Started

1. Clone & Pre-requisites

  • Node.js (v20+)
  • Docker or local setups for PostgreSQL and MongoDB
  • Python 3.10+
LANG: bash
git clone https://github.com/OrionGD/FenceIN.git
cd FenceIN

2. Backend Gateway Setup

LANG: bash
cd backend
npm install
cp .env.example .env
# Migrate schema models
npx prisma generate
npx prisma db push
# Seeding platform accounts triggers automatically during 'npm run dev' initialization
npm run dev

3. Biometrics Python Service Setup

LANG: bash
cd biometrics_service
python -m venv venv
venv\Scripts\activate     # Windows powershell
pip install -r requirements.txt
python download_models.py
uvicorn app:app --port 8000

4. Frontend Web App Setup

LANG: bash
cd frontend
npm install
cp .env.example .env.local
npm run dev

📂 Project Structure

LANG: text
FenceIN/
├── backend/                  # NestJS API Gateway
│   ├── src/
│   │   ├── platform/         # Platform dashboard & Provisioning transactions
│   │   ├── auth/             # Tenant checks & Auth session logic
│   │   ├── biometrics/       # AES template encrypter & Similarity checks
│   │   ├── attendance/       # Geofence boundary calculations & Trust score compiler
│   │   └── mongo/            # Secondary MongoDB analytical logging
│   └── prisma/               # PostgreSQL schema configurations
├── biometrics_service/       # Python CV Engine (FastAPI, OpenCV, ONNX models)
└── frontend/                 # React 19 PWA Client
    ├── src/
    │   ├── modules/          # Lazy-loaded, code-split sub-routes per role
    │   ├── store/            # Auth, sync, and dashboard Zustand stores
    │   └── components/       # Premium UI dashboard shells

Built for zero-trust industrial access control. 🏭🛡️