No description
  • JavaScript 65.3%
  • CSS 17.3%
  • HTML 16.9%
  • Dockerfile 0.5%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-11-29 02:58:46 +02:00
node_modules feat: auditor proposal upsert plus admin email notifications 2026-10-15 05:17:39 +02:00
public export 2026-11-29 02:58:46 +02:00
.dockerignore feat: flush stats footer to viewport bottom, auto-increment version badge 2026-10-15 03:37:35 +02:00
.gitignore chore: ignore backups and compose.yaml 2026-10-15 02:39:18 +02:00
AGENTS.md docs: session learnings - verification patterns, mkdir spin, deploy notes 2026-10-15 05:23:19 +02:00
database.sqlite Update .dockerignore, Dockerfile, PentN10_ocr_result.html, and 2987 more files 2026-06-19 02:57:23 +02:00
db.js feat: auditor proposal upsert plus admin email notifications 2026-10-15 05:17:39 +02:00
DBREADME.md feat: auditor proposal upsert plus admin email notifications 2026-10-15 05:17:39 +02:00
docker-compose.yml compose 2026-07-03 20:06:13 +02:00
Dockerfile Update Dockerfile and docker-compose.yml 2026-06-23 08:53:04 +02:00
find_duplicates.js Update .dockerignore, Dockerfile, PentN10_ocr_result.html, and 2987 more files 2026-06-19 02:57:23 +02:00
importer.js Update .dockerignore, Dockerfile, PentN10_ocr_result.html, and 2987 more files 2026-06-19 02:57:23 +02:00
mailer.js feat: auditor proposal upsert plus admin email notifications 2026-10-15 05:17:39 +02:00
package-lock.json feat: auditor proposal upsert plus admin email notifications 2026-10-15 05:17:39 +02:00
package.json feat: auditor proposal upsert plus admin email notifications 2026-10-15 05:17:39 +02:00
README.md feat: add dedup improvements, database backup/restore, and comprehensive docs 2026-06-22 03:02:22 +02:00
server.js db backuup and resize 2026-11-29 02:13:14 +02:00
test_import.js Update .dockerignore, Dockerfile, PentN10_ocr_result.html, and 2987 more files 2026-06-19 02:57:23 +02:00

AuditGate

Access Control User Audit Tool - Import, browse, and audit security log credentials from physical access keypads.

Features

  • HTML Report Import - Automatically parse and import access control logs from HTML files
  • Dashboard - Overview of all imported records with statistics
  • Browse & Search - Navigate by floor/zone, filter by file, search by name or ID
  • Export - Download data as CSV or Excel (XLSX) files
  • Deduplication - Find and remove duplicate entries by ID number or user name
  • Admin Controls - Edit and delete individual records (admin only)
  • OAuth Authentication - Configurable OAuth2 SSO with role-based access (admin/user)
  • Database Backup/Restore - Download backups and restore from previous snapshots
  • Dark/Light Theme - Toggle between themes with system preference detection

Tech Stack

  • Backend: Node.js 20, Express 5.2.1, SQLite3 6.0.1
  • Frontend: Vanilla JavaScript, HTML5, CSS3
  • HTML Parsing: Cheerio 1.2.0
  • Export: SheetJS (XLSX via CDN)
  • Deployment: Docker multi-stage build

Quick Start

Local Development

# Install dependencies
npm install

# Start the server
node server.js

# Open in browser
http://localhost:3000

Docker

# Build and run with docker-compose
docker-compose up --build

# Or build manually
docker build -t auditgate .
docker run -p 3000:3000 auditgate

Environment Variables

Variable Default Description
PORT 3000 Server port
DB_PATH ./database.sqlite SQLite database path
IMPORT_DIR ./Import HTML files import directory
COOKIE_SECRET random Session cookie signing key
BYPASS_AUTH false Set to true to skip OAuth

Project Structure

auditgate/
├── server.js          # Express server, auth, API routes
├── db.js              # SQLite setup with promisified helpers
├── importer.js        # HTML parsing and import logic
├── public/            # Frontend files
│   ├── index.html     # SPA main page
│   ├── app.js         # Frontend JavaScript
│   └── style.css      # Styles with dark/light themes
├── Import/            # HTML report files
│   └── {floor}/
│       └── {zone}/
│           └── *.html
├── Dockerfile         # Multi-stage Docker build
├── docker-compose.yml # Docker Compose config
└── package.json       # Node.js dependencies

Import Directory Structure

HTML files should be organized in a folder hierarchy:

Import/
├── Penthouse/
│   ├── North/
│   │   ├── report1.html
│   │   └── report2.html
│   └── South/
│       └── report3.html
└── GroundFloor/
    └── Zone1/
        └── report4.html
  • Top-level folder = Floor (e.g., "Penthouse", "GroundFloor")
  • Sub-folder = Zone (e.g., "North", "South", "Zone1")
  • HTML files = Access control reports to parse

API Endpoints

Authentication

  • GET /api/me - Get current session info
  • GET /login - Redirect to OAuth flow
  • GET /login/callback - OAuth callback handler
  • GET /logout - Clear session

Settings (Admin)

  • GET /api/settings - Get OAuth configuration
  • POST /api/settings - Update settings
  • GET /api/user-roles - List user role mappings
  • POST /api/user-roles - Add/update user role
  • DELETE /api/user-roles - Remove user role

Data

  • GET /api/navigation - Get floor/zone tree
  • GET /api/stats - Get dashboard statistics
  • GET /api/files - List files in a zone
  • GET /api/records - Get records with pagination/search
  • GET /api/imported-files - List all imported files

Admin Operations

  • PUT /api/records/:id - Update a record
  • DELETE /api/records/:id - Delete a record
  • POST /api/import - Trigger import scan

Deduplication

  • GET /api/duplicates - Find duplicate groups
  • POST /api/deduplicate - Delete selected duplicates

Backup/Restore

  • GET /api/backup - Download database backup
  • POST /api/restore - Restore from backup

Authentication

First-Time Setup

  1. When OAuth is disabled (default), you're automatically logged in as admin
  2. To enable OAuth:
    • Go to Settings > OAuth Configuration
    • Enter your OAuth provider credentials
    • Enable OAuth and save

Role-Based Access

  • Admin - Full access: edit/delete records, manage users, run imports, backup/restore
  • User - Read-only: browse data, export, search

The first user to log in via OAuth automatically becomes an admin.

Deduplication

The deduplication wizard helps remove duplicate entries:

  1. Select a floor/zone
  2. Click "Deduplicate"
  3. Choose criteria: ID Number or User Name
  4. Review each duplicate group
  5. Select which records to keep
  6. Click "Apply & Close" to delete unwanted duplicates

Backup & Restore

Creating a Backup

  1. Go to Settings > Database Backup
  2. Click "Download Backup"
  3. Save the .sqlite file

Restoring from Backup

  1. Go to Settings > Database Restore
  2. Click "Select Backup File"
  3. Choose your .sqlite backup file
  4. Click "Restore Database"
  5. Confirm the action (current database is auto-backed up)

Development

Running Tests

# Test import functionality
node test_import.js

# Find duplicates in database
node find_duplicates.js

Code Style

  • CommonJS modules (not ES modules)
  • Async/await with promisified SQLite helpers
  • No TypeScript or linting configured

License

ISC