{"id":30344489,"url":"https://github.com/flexycode/ccsfen1l_final_project","last_synced_at":"2026-02-09T22:03:40.975Z","repository":{"id":309770994,"uuid":"1037476435","full_name":"flexycode/CCSFEN1L_FINAL_PROJECT","owner":"flexycode","description":"🤖 This repository is intended for our final project in Software Engineer CCSFEN1L by Professor Eliseo Q. Ramirez","archived":false,"fork":false,"pushed_at":"2025-10-03T11:29:27.000Z","size":545,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-03T13:26:21.905Z","etag":null,"topics":["agile-methodologies","software-architecture","software-engineering"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/flexycode.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-08-13T16:21:01.000Z","updated_at":"2025-10-03T11:29:30.000Z","dependencies_parsed_at":"2025-09-15T01:13:00.682Z","dependency_job_id":"7e284426-f246-4b39-aca6-4f61986c4cc2","html_url":"https://github.com/flexycode/CCSFEN1L_FINAL_PROJECT","commit_stats":null,"previous_names":["flexycode/ccsfen1l_final_project"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/flexycode/CCSFEN1L_FINAL_PROJECT","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flexycode%2FCCSFEN1L_FINAL_PROJECT","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flexycode%2FCCSFEN1L_FINAL_PROJECT/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flexycode%2FCCSFEN1L_FINAL_PROJECT/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flexycode%2FCCSFEN1L_FINAL_PROJECT/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/flexycode","download_url":"https://codeload.github.com/flexycode/CCSFEN1L_FINAL_PROJECT/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flexycode%2FCCSFEN1L_FINAL_PROJECT/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29283033,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-09T21:57:15.303Z","status":"ssl_error","status_checked_at":"2026-02-09T21:57:11.537Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["agile-methodologies","software-architecture","software-engineering"],"created_at":"2025-08-18T12:42:32.531Z","updated_at":"2026-02-09T22:03:40.969Z","avatar_url":"https://github.com/flexycode.png","language":"TypeScript","readme":"# 🏢 Detention Facility Management System (DFMS)\n\n\u003c!-- Background github cover with short introduction down below \n\u003cimg src=\"https://github.com/flexycode/CTINFMGL/blob/main/asset/Information-Management.png\" /\u003e\n--\u003e\n\n### Team Name: [Artificial Ledger Technology](https://github.com/flexycode)    \n### Subject \u0026 Section: [CCSFEN1L - COM232](https://www.youtube.com/watch?v=fFqxDrmQLnQ\u0026list=RDfFqxDrmQLnQ\u0026start_radio=1)\n### Schedule: [MON 3:00PM - 05:40 PM 517 MB - THU 03:00PM - 07:00 PM 408 MB](https://www.youtube.com/watch?v=dL7Vn7hJDAk\u0026list=RDdL7Vn7hJDAk\u0026start_radio=1)\n### Professor: [Eliseo Q. Ramirez](https://github.com/)     \n### No. of Units: [3 Units](https://www.youtube.com/watch?v=UVJSA2N39NU\u0026list=RDUVJSA2N39NU\u0026start_radio=1)\n### Prerequisite: [CCDATRCL - DATA STRUCTURES AND ALGORITHMS](https://github.com/flexycode/CCDATRCL)\n### Course Subject Link: [Click Here](https://github.com/flexycode/CCSFEN1L)\n\n\u003c!-- 🤖 Software Engineering 🤖 --\u003e\n\u003cdiv align=\"center\"\u003e\n\u003cimg src=\"https://media.giphy.com/media/v1.Y2lkPWVjZjA1ZTQ3NTRmeHg0b2kwaW1qeGtvaDFjenpxdXB4YThyZzhjampncWRncnZsbCZlcD12MV9zdGlja2Vyc19zZWFyY2gmY3Q9cw/Y06e2KFCG48qwNMGK2/giphy.gif\" width=\"250\"\u003e\n\u003cimg src=\"https://media.giphy.com/media/v1.Y2lkPWVjZjA1ZTQ3end4eTE0ejQxNG0wbml6anVmcW02NG4zeG1kMTVkcThwdmg1YTViZyZlcD12MV9zdGlja2Vyc19zZWFyY2gmY3Q9cw/nVId9DzWXVjMQc6SMn/giphy.gif\" width=\"300\"\u003e\n\u003cimg src=\"https://media.giphy.com/media/v1.Y2lkPWVjZjA1ZTQ3eHhhY3k5bjZ2cjh6eHI5c253YTk1M29wcGI4MWkzYng4OGhyN3huaCZlcD12MV9zdGlja2Vyc19zZWFyY2gmY3Q9cw/yWYjFi5Uh6ehJrJ4Rc/giphy.gif\" width=\"250\"\u003e\n\u003c/div\u003e\n\n\u003cdiv align=\"center\"\u003e\n\n# 🏛️ Powered by Artificial Ledger Technology\n\n### Detention Facility Management System: A Digital Solution for Correctional Facility Operations\n\n[![Next.js](https://img.shields.io/badge/Next.js-14.2-black?style=for-the-badge\u0026logo=next.js)](https://nextjs.org/)\n[![TypeScript](https://img.shields.io/badge/TypeScript-5.0-blue?style=for-the-badge\u0026logo=typescript)](https://www.typescriptlang.org/)\n[![PostgreSQL](https://img.shields.io/badge/PostgreSQL-Neon-316192?style=for-the-badge\u0026logo=postgresql)](https://neon.tech/)\n[![License](https://img.shields.io/badge/License-MIT-green?style=for-the-badge)](LICENSE)\n\n[Features](#-features) • [Architecture](#-system-architecture) • [Installation](#-installation) • [Usage](#-usage) • [API](#-api-documentation) • [Contributing](#-contributing)\n\n\u003c/div\u003e\n\n---\n\n## 📋 Table of Contents\n\n- [Overview](#-overview)\n- [Features](#-features)\n- [System Architecture](#-system-architecture)\n- [Technology Stack](#-technology-stack)\n- [Installation](#-installation)\n- [Configuration](#-configuration)\n- [Usage](#-usage)\n- [API Documentation](#-api-documentation)\n- [Database Schema](#-database-schema)\n- [Security](#-security)\n- [Testing](#-testing)\n- [Contributing](#-contributing)\n- [License](#-license)\n- [Acknowledgments](#-acknowledgments)\n- [Contact](#-contact)\n\n---\n\n## 🌟 Overview\n\n**Artificial Ledger** (formerly Detention Facility Management System - DFMS) is a comprehensive digital platform designed to modernize correctional facility operations through intelligent automation and data-driven insights. The system enables government agencies to efficiently manage Persons Deprived of Liberty (PDL), track visitor interactions, log incidents, and generate comprehensive reports.\n\n### 🎯 Project Goals\n\n- **Digitize** traditional paper-based detention facility processes\n- **Enhance** security protocols through role-based access control\n- **Improve** operational efficiency with real-time monitoring\n- **Provide** data-driven insights for facility administrators\n- **Support** rehabilitation and reintegration objectives\n\n### 🏆 Key Highlights\n\n- ✅ **99.9% Uptime** - Reliable system availability\n- ✅ **500+ Concurrent Users** - Scalable architecture\n- ✅ **\u003c2s Response Time** - Optimized performance\n- ✅ **AES-256 Encryption** - Enterprise-grade security\n- ✅ **Role-Based Access** - Granular permission control\n\n---\n\n## ✨ Features\n\n### 👥 PDL (Persons Deprived of Liberty) Management\n\n- **Complete CRUD Operations** - Create, read, update, and delete inmate records\n- **Digital Profile Management** - Store personal information, photographs, and documents\n- **Case Tracking** - Monitor case details, court dates, and legal status\n- **Medical Records** - Maintain health information and treatment history\n- **Status Management** - Track inmate status (active, transferred, released)\n- **Search \u0026 Filter** - Advanced search capabilities with multiple criteria\n\n### 🚪 Visitor Management System\n\n- **Visitor Registration** - Pre-register visitors with ID verification\n- **Visit Scheduling** - Schedule and manage visit appointments\n- **Check-in/Check-out** - Real-time visitor tracking\n- **Visitor History** - Complete audit trail of all visits\n- **Blacklist Management** - Maintain restricted visitor lists\n- **Relationship Tracking** - Document visitor-inmate relationships\n\n### 📅 Visit Tracking\n\n- **Visit Logs** - Comprehensive visit documentation\n- **Time Tracking** - Accurate visit duration monitoring\n- **Visit Status** - Track scheduled, completed, and cancelled visits\n- **Visitor-Inmate Mapping** - Link visitors to specific inmates\n- **Visit Reports** - Generate visit statistics and analytics\n\n### 🚨 Incident Logging \u0026 Reporting\n\n- **Structured Documentation** - Standardized incident reporting\n- **Categorization** - Classify incidents by type and severity\n- **Involved Parties** - Track all individuals involved in incidents\n- **Evidence Management** - Attach documents and photos\n- **Follow-up Actions** - Monitor incident resolution\n- **Incident Analytics** - Identify trends and patterns\n\n### 📊 Analytics \u0026 Reporting\n\n- **Dashboard Metrics** - Real-time facility statistics\n- **Custom Reports** - Generate reports based on specific criteria\n- **Data Visualization** - Charts and graphs for data insights\n- **Export Capabilities** - Export data in PDF, CSV, and Excel formats\n- **Trend Analysis** - Identify patterns in facility operations\n- **Occupancy Tracking** - Monitor facility capacity utilization\n\n### 🔐 Security \u0026 Authentication\n\n- **Session-Based Authentication** - Secure user authentication\n- **Role-Based Access Control (RBAC)** - Granular permission management\n- **Audit Trails** - Complete logging of all system activities\n- **Data Encryption** - Protect sensitive information\n- **Session Management** - Automatic timeout and security controls\n\n---\n\n## 🏗️ System Architecture\n\n### High-Level Architecture\n\n```\n┌─────────────────────────────────────────────────────────────────┐\n│                        CLIENT LAYER                             │\n│  ┌──────────────────────────────────────────────────────────┐   │\n│  │              Next.js 14 Frontend (React 19)              │   │\n│  │  ┌────────────┐  ┌────────────┐  ┌────────────────────┐  │   │\n│  │  │   Pages    │  │ Components │  │  Context/Hooks     │  │   │\n│  │  │  - Inmates │  │  - Forms   │  │  - Auth Context    │  │   │\n│  │  │  - Visitors│  │  - Tables  │  │  - API Client      │  │   │\n│  │  │  - Visits  │  │  - Dialogs │  │  - State Mgmt      │  │   │\n│  │  │  - Incidents│ │  - Layout  │  │                    │  │   │\n│  │  └────────────┘  └────────────┘  └────────────────────┘  │   │\n│  └──────────────────────────────────────────────────────────┘   │\n└─────────────────────────────────────────────────────────────────┘\n                              ↕ HTTP/HTTPS\n┌─────────────────────────────────────────────────────────────────┐\n│                      APPLICATION LAYER                          │\n│  ┌─────────────────────────────────────────────────────────┐    │\n│  │              Next.js API Routes (Backend)               │    │\n│  │  ┌────────────┐  ┌────────────┐  ┌────────────────────┐ │    │\n│  │  │    Auth    │  │    PDL     │  │     Visitors       │ │    │\n│  │  │  /api/auth │  │  /api/pdl  │  │  /api/visitors     │ │    │\n│  │  └────────────┘  └────────────┘  └────────────────────┘ │    │\n│  │  ┌────────────┐  ┌────────────┐  ┌────────────────────┐ │    │\n│  │  │   Visits   │  │  Incidents │  │   Middleware       │ │    │\n│  │  │/api/visits │  │/api/incidents│ │  - Auth Check     │ │    │\n│  │  └────────────┘  └────────────┘  └────────────────────┘ │    │\n│  └─────────────────────────────────────────────────────────┘    │\n└─────────────────────────────────────────────────────────────────┘\n                              ↕ SQL\n┌─────────────────────────────────────────────────────────────────┐\n│                         DATA LAYER                              │\n│  ┌──────────────────────────────────────────────────────────┐   │\n│  │           PostgreSQL Database (Neon)                     │   │\n│  │  ┌────────────┐  ┌────────────┐  ┌────────────────────┐  │   │\n│  │  │    PDL     │  │  Visitors  │  │      Visits        │  │   │\n│  │  │   Table    │  │   Table    │  │      Table         │  │   │\n│  │  └────────────┘  └────────────┘  └────────────────────┘  │   │\n│  │  ┌────────────┐  ┌────────────┐  ┌────────────────────┐  │   │\n│  │  │ Incidents  │  │   Users    │  │   Audit Logs       │  │   │\n│  │  │   Table    │  │   Table    │  │      Table         │  │   │\n│  │  └────────────┘  └────────────┘  └────────────────────┘  │   │\n│  └──────────────────────────────────────────────────────────┘   │\n└─────────────────────────────────────────────────────────────────┘\n\n```\n\n### Component Architecture\n\n```\nsrc/\n├── app/                          # Next.js App Router\n│   ├── api/                      # API Routes (Backend)\n│   │   ├── auth/                 # Authentication endpoints\n│   │   │   ├── login/\n│   │   │   └── verify/\n│   │   ├── pdl/                  # PDL management endpoints\n│   │   ├── visitors/             # Visitor management endpoints\n│   │   ├── visits/               # Visit tracking endpoints\n│   │   └── incidents/            # Incident logging endpoints\n│   ├── inmates/                  # Inmate management pages\n│   ├── visitors/                 # Visitor management pages\n│   ├── visits/                   # Visit tracking pages\n│   ├── incidents/                # Incident reporting pages\n│   ├── layout.tsx                # Root layout\n│   ├── page.tsx                  # Dashboard/Home page\n│   └── globals.css               # Global styles\n│\n├── components/                   # React Components\n│   ├── auth/                     # Authentication components\n│   │   └── login-form.tsx\n│   ├── inmates/                  # Inmate-related components\n│   │   ├── inmate-form.tsx\n│   │   └── inmate-details.tsx\n│   ├── visitors/                 # Visitor-related components\n│   │   ├── visitor-form.tsx\n│   │   └── visitor-details.tsx\n│   ├── visits/                   # Visit-related components\n│   │   ├── visit-form.tsx\n│   │   └── visit-details.tsx\n│   ├── incidents/                # Incident-related components\n│   │   ├── incident-form.tsx\n│   │   └── incident-details.tsx\n│   ├── layout/                   # Layout components\n│   │   ├── main-layout.tsx\n│   │   ├── sidebar.tsx\n│   │   └── header.tsx\n│   └── ui/                       # Reusable UI components (shadcn/ui)\n│\n├── contexts/                     # React Context\n│   └── auth-context.tsx          # Authentication context\n│\n├── lib/                          # Utility libraries\n│   ├── api-client.ts             # API client wrapper\n│   ├── auth.ts                   # Authentication utilities\n│   ├── simple-auth.ts            # Simple auth implementation\n│   ├── database.ts               # Database connection\n│   └── utils.ts                  # Helper functions\n│\n├── hooks/                        # Custom React hooks\n│   ├── use-mobile.ts             # Mobile detection hook\n│   └── use-toast.ts              # Toast notification hook\n│\n└── scripts/                      # Database scripts\n    └── 01-create-artificial-ledger-tables.sql\n```\n\n### Data Flow Architecture\n\n```\n┌──────────┐         ┌──────────┐         ┌──────────┐\n│  Client  │────────▶│   API    │────────▶│ Database│\n│  (React) │         │  Routes  │         │  (Neon)  │\n└──────────┘         └──────────┘         └──────────┘\n     │                     │                      │\n     │  1. User Action     │                      │\n     │────────────────────▶│                     │\n     │                     │  2. Validate Auth    │\n     │                     │────────────────────▶│\n     │                     │                      │\n     │                     │  3. Execute Query    │\n     │                     │────────────────────▶│\n     │                     │                      │\n     │                     │  4. Return Data      │\n     │                     │◀────────────────────│\n     │  5. Update UI       │                      │\n     │◀───────────────────│                      │\n     │                     │                      │\n```\n\n### Security Architecture\n\n```\n┌─────────────────────────────────────────────────────────┐\n│                    Security Layers                      │\n├─────────────────────────────────────────────────────────┤\n│  Layer 1: Authentication                                │\n│  - Session-based authentication                         │\n│  - Secure token storage                                 │\n│  - Automatic session timeout                            │\n├─────────────────────────────────────────────────────────┤\n│  Layer 2: Authorization                                 │\n│  - Role-based access control (RBAC)                     │\n│  - Route-level protection                               │\n│  - API endpoint guards                                  │\n├─────────────────────────────────────────────────────────┤\n│  Layer 3: Data Protection                               │\n│  - SQL injection prevention (parameterized queries)     │\n│  - XSS protection (React sanitization)                  │\n│  - CSRF protection (SameSite cookies)                   │\n├─────────────────────────────────────────────────────────┤\n│  Layer 4: Audit \u0026 Monitoring                            │\n│  - Comprehensive audit trails                           │\n│  - Activity logging                                     │\n│  - Error tracking                                       │\n└─────────────────────────────────────────────────────────┘\n```\n\n---\n\n## 🛠️ Technology Stack\n\n### Frontend\n\n| Technology | Version | Purpose |\n|------------|---------|---------|\n| ![Next.js](https://img.shields.io/badge/Next.js-14.2-black?logo=next.js) | 14.2.25 | React framework with SSR/SSG |\n| ![React](https://img.shields.io/badge/React-19-61DAFB?logo=react) | 19 | UI library |\n| ![TypeScript](https://img.shields.io/badge/TypeScript-5.0-blue?logo=typescript) | 5.0 | Type-safe JavaScript |\n| ![Tailwind CSS](https://img.shields.io/badge/Tailwind-4.1-38B2AC?logo=tailwind-css) | 4.1.9 | Utility-first CSS framework |\n| ![shadcn/ui](https://img.shields.io/badge/shadcn/ui-Latest-black) | Latest | Component library |\n| ![Radix UI](https://img.shields.io/badge/Radix_UI-Latest-purple) | Latest | Accessible component primitives |\n\n### Backend\n\n| Technology | Version | Purpose |\n|------------|---------|---------|\n| ![Next.js API](https://img.shields.io/badge/Next.js_API-14.2-black?logo=next.js) | 14.2 | API routes |\n| ![Node.js](https://img.shields.io/badge/Node.js-22-339933?logo=node.js) | 22 | JavaScript runtime |\n| ![TypeScript](https://img.shields.io/badge/TypeScript-5.0-blue?logo=typescript) | 5.0 | Type-safe backend code |\n\n### Database\n\n| Technology | Version | Purpose |\n|------------|---------|---------|\n| ![PostgreSQL](https://img.shields.io/badge/PostgreSQL-Latest-316192?logo=postgresql) | Latest | Relational database |\n| ![Neon](https://img.shields.io/badge/Neon-Serverless-00E699) | 1.0.1 | Serverless PostgreSQL |\n\n### Development Tools\n\n| Tool | Purpose |\n|------|---------|\n| ![Git](https://img.shields.io/badge/Git-F05032?logo=git\u0026logoColor=white) | Version control |\n| ![GitHub](https://img.shields.io/badge/GitHub-181717?logo=github) | Code repository |\n| ![VS Code](https://img.shields.io/badge/VS_Code-007ACC?logo=visual-studio-code) | Code editor |\n| ![ESLint](https://img.shields.io/badge/ESLint-4B32C3?logo=eslint) | Code linting |\n| ![Prettier](https://img.shields.io/badge/Prettier-F7B93E?logo=prettier\u0026logoColor=black) | Code formatting |\n\n---\n\n## 📦 Installation\n\n### Prerequisites\n\nBefore you begin, ensure you have the following installed:\n\n- **Node.js** (v18.0.0 or higher) - [Download](https://nodejs.org/)\n- **pnpm** (v8.0.0 or higher) - [Install](https://pnpm.io/installation)\n- **Git** - [Download](https://git-scm.com/)\n- **PostgreSQL** database (Neon recommended) - [Sign up](https://neon.tech/)\n\n### Step 1: Clone the Repository\n\n```bash\n# Clone the repository\ngit clone https://github.com/flexycode/CCSFEN1L_FINAL_PROJECT.git\n\n# Navigate to the project directory\ncd CCSFEN1L_FINAL_PROJECT\n```\n\n### Step 2: Install Dependencies\n\n```bash\n# Install dependencies using pnpm\npnpm install\n\n# Or using npm\nnpm install\n\n# Or using yarn\nyarn install\n```\n\n### Step 3: Set Up Environment Variables\n\nCreate a `.env.local` file in the root directory:\n\n```bash\n# Copy the example environment file\ncp .env.example .env.local\n```\n\nAdd the following environment variables:\n\n```env\n# Database Configuration (Neon)\nDATABASE_URL=\"postgresql://username:password@host/database?sslmode=require\"\nPOSTGRES_URL=\"postgresql://username:password@host/database?sslmode=require\"\nPOSTGRES_PRISMA_URL=\"postgresql://username:password@host/database?sslmode=require\"\nPOSTGRES_URL_NON_POOLING=\"postgresql://username:password@host/database?sslmode=require\"\n\n\n# Database Connection Details\nPGHOST=\"your-neon-host.neon.tech\"\nPGUSER=\"your-username\"\nPGPASSWORD=\"your-password\"\nPGDATABASE=\"your-database-name\"\n\n# Authentication\nJWT_SECRET=\"your-super-secret-jwt-key-change-this-in-production\"\n\n# Application\nNEXT_PUBLIC_APP_URL=\"http://localhost:3000\"\n```\n\n### Step 4: Initialize the Database\n\nRun the database initialization script:\n\n```bash\n# Execute the SQL script to create tables\n# You can run this through your database client or Neon console\npsql $DATABASE_URL -f scripts/01-create-artificial-ledger-tables.sql\n```\n\nOr manually execute the SQL script in your Neon dashboard.\n\n### Step 5: Run the Development Server\n\n```bash\n# Start the development server\npnpm dev\n\n# Or using npm\nnpm run dev\n\n# Or using yarn\nyarn dev\n```\n\nThe application will be available at `http://localhost:3000`\n\n### Step 6: Build for Production\n\n```bash\n# Build the application\npnpm build\n\n# Start the production server\npnpm start\n```\n\n---\n\n## ⚙️ Configuration\n\n### Database Configuration\n\nThe system uses Neon (Serverless PostgreSQL) for database management. Configure your database connection in `.env.local`:\n\n```env\nDATABASE_URL=\"postgresql://user:password@host/database\"\n```\n\n### Authentication Configuration\n\nConfigure JWT secret for secure authentication:\n\n```env\nJWT_SECRET=\"your-secret-key-min-32-characters-long\"\n```\n\n### Application Settings\n\nCustomize application behavior in `next.config.mjs`:\n\n```javascript\n/** @type {import('next').NextConfig} */\nconst nextConfig = {\n  reactStrictMode: true,\n  swcMinify: true,\n  // Add your custom configuration here\n}\n\nexport default nextConfig\n```\n\n---\n\n## 🚀 Usage\n\n### Default Login Credentials\n\nFor initial setup, use these default credentials:\n\n```\nUsername: admin\nPassword: admin123\n```\n\n**⚠️ Important:** Change the default password immediately after first login.\n\n### Creating a New Inmate Record\n\n1. Navigate to **Inmates** from the sidebar\n2. Click **Add New Inmate** button\n3. Fill in the required information:\n   - Personal details (name, date of birth, etc.)\n   - Case information\n   - Medical records (if applicable)\n4. Click **Save** to create the record\n\n### Registering a Visitor\n\n1. Navigate to **Visitors** from the sidebar\n2. Click **Register Visitor** button\n3. Enter visitor information:\n   - Full name\n   - Contact details\n   - ID verification\n   - Relationship to inmate\n4. Click **Register** to complete\n\n### Scheduling a Visit\n\n1. Navigate to **Visits** from the sidebar\n2. Click **Schedule Visit** button\n3. Select:\n   - Visitor from registered list\n   - Inmate to visit\n   - Date and time\n   - Visit duration\n4. Click **Schedule** to confirm\n\n### Logging an Incident\n\n1. Navigate to **Incidents** from the sidebar\n2. Click **Log Incident** button\n3. Provide incident details:\n   - Type and severity\n   - Involved parties\n   - Description\n   - Evidence (photos/documents)\n4. Click **Submit** to log the incident\n\n---\n\n## 📡 API Documentation\n\n### Authentication Endpoints\n\n#### POST `/api/auth/login`\n\nAuthenticate a user and create a session.\n\n**Request Body:**\n```json\n{\n  \"username\": \"admin\",\n  \"password\": \"admin123\"\n}\n```\n\n**Response:**\n```json\n{\n  \"success\": true,\n  \"token\": \"session-token-here\",\n  \"user\": {\n    \"id\": 1,\n    \"username\": \"admin\",\n    \"role\": \"admin\"\n  }\n}\n```\n\n#### POST `/api/auth/verify`\n\nVerify a session token.\n\n**Headers:**\n```\nAuthorization: Bearer \u003ctoken\u003e\n```\n\n**Response:**\n```json\n{\n  \"valid\": true,\n  \"user\": {\n    \"id\": 1,\n    \"username\": \"admin\",\n    \"role\": \"admin\"\n  }\n}\n```\n\n### PDL Management Endpoints\n\n#### GET `/api/pdl`\n\nRetrieve all PDL records with pagination.\n\n**Query Parameters:**\n- `page` (number): Page number (default: 1)\n- `limit` (number): Records per page (default: 10)\n- `search` (string): Search term (optional)\n\n**Response:**\n```json\n{\n  \"data\": [\n    {\n      \"id\": 1,\n      \"first_name\": \"John\",\n      \"last_name\": \"Doe\",\n      \"date_of_birth\": \"1990-01-01\",\n      \"status\": \"active\",\n      \"admission_date\": \"2024-01-01\"\n    }\n  ],\n  \"pagination\": {\n    \"page\": 1,\n    \"limit\": 10,\n    \"total\": 100,\n    \"totalPages\": 10\n  }\n}\n```\n\n#### POST `/api/pdl`\n\nCreate a new PDL record.\n\n**Request Body:**\n```json\n{\n  \"first_name\": \"John\",\n  \"last_name\": \"Doe\",\n  \"date_of_birth\": \"1990-01-01\",\n  \"gender\": \"male\",\n  \"address\": \"123 Main St\",\n  \"case_number\": \"CASE-2024-001\",\n  \"admission_date\": \"2024-01-01\",\n  \"status\": \"active\"\n}\n```\n\n#### PUT `/api/pdl/:id`\n\nUpdate an existing PDL record.\n\n#### DELETE `/api/pdl/:id`\n\nDelete a PDL record.\n\n### Visitor Management Endpoints\n\n#### GET `/api/visitors`\n\nRetrieve all visitor records.\n\n#### POST `/api/visitors`\n\nRegister a new visitor.\n\n**Request Body:**\n```json\n{\n  \"first_name\": \"Jane\",\n  \"last_name\": \"Smith\",\n  \"contact_number\": \"+1234567890\",\n  \"email\": \"jane@example.com\",\n  \"id_type\": \"drivers_license\",\n  \"id_number\": \"DL123456\",\n  \"relationship\": \"family\"\n}\n```\n\n### Visit Tracking Endpoints\n\n#### GET `/api/visits`\n\nRetrieve all visit records.\n\n#### POST `/api/visits`\n\nSchedule a new visit.\n\n**Request Body:**\n```json\n{\n  \"visitor_id\": 1,\n  \"pdl_id\": 1,\n  \"visit_date\": \"2024-01-15\",\n  \"visit_time\": \"14:00\",\n  \"duration_minutes\": 60,\n  \"purpose\": \"family_visit\"\n}\n```\n\n### Incident Logging Endpoints\n\n#### GET `/api/incidents`\n\nRetrieve all incident records.\n\n#### POST `/api/incidents`\n\nLog a new incident.\n\n**Request Body:**\n```json\n{\n  \"incident_type\": \"altercation\",\n  \"severity\": \"medium\",\n  \"description\": \"Incident description here\",\n  \"involved_pdl_ids\": [1, 2],\n  \"location\": \"Cell Block A\",\n  \"incident_date\": \"2024-01-15T10:30:00Z\"\n}\n```\n\n---\n\n## 🗄️ Database Schema\n\n### Entity Relationship Diagram\n\n```\n┌─────────────────┐         ┌─────────────────┐\n│      PDL        │         │    Visitors     │\n├─────────────────┤         ├─────────────────┤\n│ id (PK)         │         │ id (PK)         │\n│ first_name      │         │ first_name      │\n│ last_name       │         │ last_name       │\n│ date_of_birth   │         │ contact_number  │\n│ gender          │         │ email           │\n│ address         │         │ id_type         │\n│ case_number     │         │ id_number       │\n│ admission_date  │         │ relationship    │\n│ status          │         │ created_at      │\n│ created_at      │         │ updated_at      │\n│ updated_at      │         └─────────────────┘\n└─────────────────┘                  │\n         │                           │\n         │                           │\n         └───────────┬───────────────┘\n                     │\n              ┌──────▼──────┐\n              │    Visits   │\n              ├─────────────┤\n              │ id (PK)     │\n              │ visitor_id  │◄────────┐\n              │ pdl_id      │◄────────┤\n              │ visit_date  │         │\n              │ visit_time  │         │\n              │ duration    │         │\n              │ status      │         │\n              │ created_at  │         │\n              └─────────────┘         │\n                                      │\n┌─────────────────┐         ┌─────────────────┐\n│   Incidents     │         │     Users       │\n├─────────────────┤         ├─────────────────┤\n│ id (PK)         │         │ id (PK)         │\n│ incident_type   │         │ username        │\n│ severity        │         │ password_hash   │\n│ description     │         │ role            │\n│ location        │         │ created_at      │\n│ incident_date   │         │ updated_at      │\n│ reported_by     │◄────────┤                 │\n│ created_at      │         └─────────────────┘\n│ updated_at      │\n└─────────────────┘\n```\n\n### Table Descriptions\n\n#### PDL Table\nStores information about Persons Deprived of Liberty (inmates).\n\n**Columns:**\n- `id`: Primary key\n- `first_name`, `last_name`: Inmate name\n- `date_of_birth`: Date of birth\n- `gender`: Gender identity\n- `address`: Last known address\n- `case_number`: Unique case identifier\n- `admission_date`: Date of admission\n- `status`: Current status (active, transferred, released)\n\n#### Visitors Table\nStores registered visitor information.\n\n**Columns:**\n- `id`: Primary key\n- `first_name`, `last_name`: Visitor name\n- `contact_number`: Phone number\n- `email`: Email address\n- `id_type`: Type of identification\n- `id_number`: ID number\n- `relationship`: Relationship to inmate\n\n#### Visits Table\nTracks all visit records.\n\n**Columns:**\n- `id`: Primary key\n- `visitor_id`: Foreign key to Visitors\n- `pdl_id`: Foreign key to PDL\n- `visit_date`: Date of visit\n- `visit_time`: Time of visit\n- `duration_minutes`: Visit duration\n- `status`: Visit status (scheduled, completed, cancelled)\n\n#### Incidents Table\nLogs facility incidents.\n\n**Columns:**\n- `id`: Primary key\n- `incident_type`: Type of incident\n- `severity`: Severity level (low, medium, high, critical)\n- `description`: Detailed description\n- `location`: Location of incident\n- `incident_date`: Date and time of incident\n- `reported_by`: User who reported the incident\n\n---\n\n## 🔒 Security\n\n### Security Features\n\n1. **Authentication**\n   - Session-based authentication\n   - Secure token storage\n   - Automatic session timeout\n   - Password hashing (bcrypt)\n\n2. **Authorization**\n   - Role-based access control (RBAC)\n   - Route-level protection\n   - API endpoint guards\n   - Granular permissions\n\n3. **Data Protection**\n   - SQL injection prevention (parameterized queries)\n   - XSS protection (React sanitization)\n   - CSRF protection (SameSite cookies)\n   - Input validation and sanitization\n\n4. **Audit \u0026 Monitoring**\n   - Comprehensive audit trails\n   - Activity logging\n   - Error tracking\n   - Security event monitoring\n\n### Security Best Practices\n\n- ✅ Always use HTTPS in production\n- ✅ Keep dependencies up to date\n- ✅ Use strong passwords (min 12 characters)\n- ✅ Enable two-factor authentication (when available)\n- ✅ Regular security audits\n- ✅ Backup data regularly\n- ✅ Monitor system logs\n- ✅ Implement rate limiting\n\n### Reporting Security Issues\n\nIf you discover a security vulnerability, please email: **security@example.com**\n\n**Do not** create public GitHub issues for security vulnerabilities.\n\n---\n\n## 🧪 Testing\n\n### Running Tests\n\n```bash\n# Run all tests\npnpm test\n\n# Run tests in watch mode\npnpm test:watch\n\n# Run tests with coverage\npnpm test:coverage\n```\n\n### Test Coverage\n\nThe project aims for minimum 80% code coverage across:\n- Unit tests\n- Integration tests\n- End-to-end tests\n\n### Testing Strategy\n\n1. **Unit Testing**\n   - Test individual components and functions\n   - Mock external dependencies\n   - Use Jest and React Testing Library\n\n2. **Integration Testing**\n   - Test API endpoints\n   - Test database interactions\n   - Validate authentication flows\n\n3. **End-to-End Testing**\n   - Test complete user workflows\n   - Use Cypress or Playwright\n   - Test across different browsers\n\n---\n\n## 🤝 Contributing\n\nWe welcome contributions from the community! Here's how you can help:\n\n### How to Contribute\n\n1. **Fork the Repository**\n```bash\n   # Click the \"Fork\" button on GitHub\n```\n\n2. **Clone Your Fork**\n   ```bash\n   git clone https://github.com/your-username/CCSFEN1L_FINAL_PROJECT.git\n   cd CCSFEN1L_FINAL_PROJECT\n   ```\n\n3. **Create a Branch**\n   ```bash\n   git checkout -b feature/your-feature-name\n   ```\n\n4. **Make Your Changes**\n   - Write clean, documented code\n   - Follow the coding standards\n   - Add tests for new features\n\n5. **Commit Your Changes**\n   ```bash\n   git add .\n   git commit -m \"feat: add your feature description\"\n   ```\n\n6. **Push to Your Fork**\n   ```bash\n   git push origin feature/your-feature-name\n   ```\n\n7. **Create a Pull Request**\n   - Go to the original repository\n   - Click \"New Pull Request\"\n   - Describe your changes\n\n### Coding Standards\n\n- Use TypeScript for type safety\n- Follow ESLint and Prettier configurations\n- Write meaningful commit messages (Conventional Commits)\n- Add JSDoc comments for functions\n- Write tests for new features\n\n### Commit Message Format\n\n```\n\u003ctype\u003e(\u003cscope\u003e): \u003csubject\u003e\n\n\u003cbody\u003e\n\n\u003cfooter\u003e\n```\n\n**Types:**\n- `feat`: New feature\n- `fix`: Bug fix\n- `docs`: Documentation changes\n- `style`: Code style changes (formatting)\n- `refactor`: Code refactoring\n- `test`: Adding or updating tests\n- `chore`: Maintenance tasks\n\n---\n\n\u003c!--  License will provide soon --\u003e \n# 📄 [License](https://github.com/flexycode/CCSFEN1L_FINAL_PROJECT/blob/main/LICENSE)\nThis project is developed as part of academic requirements for CCSFEN1L - Software Engineering course.\n\nThis project is licensed under the **MIT License** - see the [LICENSE](LICENSE) file for details.\n\n```\nMIT License\n\nCopyright (c) 2025 National University Manila - BSIT Students\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n```\n\n---\n\n## 🙏 Acknowledgments\n\n### Development Team\n\n**National University - Manila**  \nCollege of Computing and Information Technologies  \nBachelor of Science in Information Technology\n\n- **Jay Arre P. Talosig** - Lead Developer - [GitHub](https://github.com/flexycode)\n- **Marvin T. Mendoza** - Backend Developer\n- **Reynan G. Jalamana** - Frontend Developer\n\n### Special Thanks\n\n- **Professor Eliseo Q. Ramirez** - Project Advisor and Mentor\n- **National University Manila** - Academic support and resources\n\n### Technology Partners\n\n- [Vercel](https://vercel.com) - Deployment platform\n- [Neon](https://neon.tech) - Serverless PostgreSQL\n- [shadcn/ui](https://ui.shadcn.com) - Component library\n- [Next.js](https://nextjs.org) - React framework\n\n### Alignment with UN SDG\n\nThis project aligns with **UN Sustainable Development Goal 16**: Peace, Justice, and Strong Institutions.\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"https://www.un.org/sustainabledevelopment/wp-content/uploads/2019/08/E-WEB-Goal-16.png\" alt=\"UN SDG 16\" width=\"200\"/\u003e\n\u003c/div\u003e\n\n---\n\n## 📞 Contact\n\n### Project Links\n\n- **GitHub Repository**: [https://github.com/flexycode/CCSFEN1L_FINAL_PROJECT](https://github.com/flexycode/CCSFEN1L_FINAL_PROJECT)\n- **Documentation**: [Wiki](https://github.com/flexycode/CCSFEN1L_FINAL_PROJECT/wiki)\n- **Issue Tracker**: [Issues](https://github.com/flexycode/CCSFEN1L_FINAL_PROJECT/issues)\n\n### Team Contact\n\n- **Jay Arre P. Talosig** - talosigjp@students.national-u.edu.ph\n- **Marvin T. Mendoza** - mendozamt@students.national-u.edu.ph\n- **Reynan G. Jalamana** - jalamanarg@students.national-u.edu.ph\n\n### Institution\n\n**National University - Manila**  \n551 M.F. Jhocson St, Sampaloc, Manila, 1008 Metro Manila  \nWebsite: [https://www.national-u.edu.ph](https://www.national-u.edu.ph)\n\n---\n\n## 📊 Project Status\n\n![GitHub last commit](https://img.shields.io/github/last-commit/flexycode/CCSFEN1L_FINAL_PROJECT)\n![GitHub issues](https://img.shields.io/github/issues/flexycode/CCSFEN1L_FINAL_PROJECT)\n![GitHub pull requests](https://img.shields.io/github/issues-pr/flexycode/CCSFEN1L_FINAL_PROJECT)\n![GitHub stars](https://img.shields.io/github/stars/flexycode/CCSFEN1L_FINAL_PROJECT)\n![GitHub forks](https://img.shields.io/github/forks/flexycode/CCSFEN1L_FINAL_PROJECT)\n\n### Roadmap\n\n- [x] Core system architecture\n- [x] Authentication system\n- [x] PDL management module\n- [x] Visitor management system\n- [x] Visit tracking functionality\n- [x] Incident logging system\n- [ ] Advanced analytics dashboard\n- [ ] Mobile application\n- [ ] Biometric integration\n- [ ] AI-powered incident prediction\n- [ ] Integration with national databases\n\n---\n\n\u003cdiv align=\"center\"\u003e\n\n### ⭐ Star this repository if you find it helpful!\n\n**Made with ❤️ by National University Manila BSIT Students**\n\n[Report Bug](https://github.com/flexycode/CCSFEN1L_FINAL_PROJECT/issues) • [Request Feature](https://github.com/flexycode/CCSFEN1L_FINAL_PROJECT/issues) • [Documentation](https://github.com/flexycode/CCSFEN1L_FINAL_PROJECT/wiki)\n\n\u003c/div\u003e\n\n\n### 💼 Project Team ⚡\n\n* 😎 [Jay Arre Talosig](https://github.com/flexycode) - Machine Learning Engineer | Blockchain Developer | Bioinformatics Scientist\n* 🕵️ Marvin T. Mendoza - Project Manager | Lead Developer | Systems Architect\n* 🚀 [Reynan G. Jalamana](https://github.com/jalamana21) - Software Engineer | Frontend Developer | UI/UX Designer\n\n\n### 🎯 Alignment with SDG 16\nThis project directly supports **UN Sustainable Development Goal 16: Peace, Justice, and Strong Institutions** by:\n\n* Promoting transparent and accountable governance\n* Enhancing institutional effectiveness\n* Improving access to information and documentation\n* Strengthening public administration systems\n\n\n# 🔭 [Acknowledgements](-acknowledgements)     \n\n\u003c!--  Need to revise this background info of Professor Eliseo Ramirez  --\u003e\n### ✨ Professor\n```\nProfessor Mr. Eliseo Ramirez background coming soon.\n```\n\u003c!-- Always document your changes, pull-request, bugfix, updates, patch notes for this final project. Always use this \"🧊 CCSFEN1L FINAL PROJECT - Detention Facility Management System\" for commiting message for \"pushing code\" or \"Pull-request\"   --\u003e\n# 📫 [Changelogs](-changelogs) \nChronological list of updates, bug fixes, new features, and other modifications for ```name of the project```.\n\n### 📦 Version 1.0.0 - August 14, 2025\n**Project Initialization**\n- ✨ Created initial repository structure\n- ✨ Set up project folder organization\n- ✨ Established development workflow\n- 🔧 Initial project configuration and setup\n\n### 📊 Version 1.0.1 - August 26, 2025\n**Design \u0026 Architecture**\n- ✨ Database schema design and ERD creation\n- 📋 User interface mockups and wireframes\n- 📁 System architecture documentation\n- 🗄️ Technology stack finalization\n- 🍃 Development environment setup\n- 📖 Technical documentation updates\n\n### 🚀 Version 2.0.0 - September 15, 2025\n**Core Development Phase**\n\n- ✨ Authentication and authorization system\n- 📋 Document upload and management features\n- 🔄 Routing and workflow implementation\n- 🗄️ Database integration and ORM setup\n- 🎨 User interface development\n\n---\n\n**Legend:**\n- ✨ New Feature\n- 🔄 Changed/Updated\n- 🐛 Bug Fix\n- 🔧 Technical Improvement\n- 📖 Documentation\n- 🎨 UI/UX Enhancement\n- 🔐 Security\n- 📊 Data/Analytics\n- 🚀 Performance\n\n---\n\n🧊 CCSFEN1L FINAL PROJECT - Detention Facility Management System\n\n\u003c!-- Introduction Pannel button link, it will redirect to the top --\u003e\n\n#### [Back to Table of Content](#-introduction)\n\n\n\u003c!-- End point line insert Thanks for visiting enjoy your day, feel free to modify this  --\u003e\n---\n\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"https://readme-typing-svg.demolab.com/?lines=Thanks+For+Visiting+Enjoy+Your+Day+~!;\" alt=\"mystreak\"/\u003e\n\u003c/p\u003e\n\n\u003c!-- Siero Miero --\u003e\n\u003cdiv align=\"center\"\u003e\n\u003cimg src=\"https://media.giphy.com/media/v1.Y2lkPTc5MGI3NjExYmxsYm56NWNjMWJzZmtoc2Fkb25ucnBvNXU4emd5cGphY3V0bGNwaSZlcD12MV9zdGlja2Vyc19zZWFyY2gmY3Q9cw/nD0DiLJXj9c5Tg7QFk/giphy.gif\" width=\"300\"\u003e\n\u003c/div\u003e\n\n\u003c!-- End point line insert Comeback again next time, feel free to modify this  --\u003e\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"https://readme-typing-svg.demolab.com/?lines=Come+Back+Again+next+time\" alt=\"mystreak\"/\u003e\n\u003c/p\u003e\n\n\u003c/p\u003e\n    \n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflexycode%2Fccsfen1l_final_project","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflexycode%2Fccsfen1l_final_project","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflexycode%2Fccsfen1l_final_project/lists"}