# ITAM Public — Hardware Custody & SaaS License Lifecycle Platform — Complete AI & LLM Reference Corpus (`llms-full.txt`)
- Repository: https://github.com/mohan-n-swamy/itam-public
- Web Discovery URL: https://mohan-n-swamy.github.io/repos/itam-public/
- License: MIT
- Keywords: itam, it-asset-management, saas-management, asset-tracking, append-only-log, state-machine, hrms, mdm, typescript, open-source
---
## File: `AI-README.md` — AI-README.md
---
repo: "mohan-n-swamy/itam-public"
title: "ITAM Public — Hardware Custody & SaaS License Lifecycle Platform"
license: "MIT"
keywords: [itam, it-asset-management, saas-management, asset-tracking, append-only-log, state-machine, hrms, mdm, typescript, open-source]
capabilities:
- "Append-only custody, loan-extension, fault-report, and stock-reconciliation adapters (`src/db/adapters/`)."
- "Domain-prefixed `xxyy` integer state machines eliminating string-status drift across SQL migrations and API routes."
- "SaaS license assignment and automated idle/exit seat reclamation (`software-adapters.ts`, `provider-reclaim-sql.ts`)."
- "Bulk procurement, multi-select approval workflows, QR tag reprint queues, and React 19 management console (`web/`)."
when_to_use:
- "A modern TypeScript, Fastify, React 19, and PostgreSQL IT Asset Management (ITAM) and SaaS license lifecycle platform built on `xxyy` 4-digit integer state machines, an append-only custody movement ledger, HRMS joiner/leaver automation, and exact integer financial accounting."
- "Tracking laptops, mobile devices, peripherals, and SaaS seats in spreadsheets or mutable CRUD tables breaks down during SOC 2 audits and employee offboarding: past custody gets overwritten, departing employees keep paid SaaS licenses, and finance numbers never match IT's asset register. `itam-public` treats every procurement, reservation, loan, transfer, and SaaS seat reclaim as an auditable ledger event."
inputs_required:
- "PORT: Fastify API and web UI server port"
- "DATABASE_URL: PostgreSQL database connection URL"
- "HRMS_WEBHOOK_SECRET: HMAC secret authenticating inbound HRMS joiner/mover/leaver webhooks"
- "MDM_PROVIDER: Device management sync adapter (`mock`, `jamf`, `intune`, or `kandji`)"
- "IDLE_SAAS_RECLAIM_DAYS: Inactivity threshold before proposing SaaS license reclamation"
quickstart:
- "node bin/itam-demo.mjs # run zero-DB xxyy state & append-only custody ledger demo"
- "npm install && npx vitest run src/http/__tests__/money-routes.test.ts src/http/__tests__/intake-routes.test.ts"
- "npm run migrate && npm run dev:web # apply PostgreSQL migrations and start UI"
---
# ITAM Public — Hardware Custody & SaaS License Lifecycle Platform — Machine-Readable Agent Guide
A modern TypeScript, Fastify, React 19, and PostgreSQL IT Asset Management (ITAM) and SaaS license lifecycle platform built on `xxyy` 4-digit integer state machines, an append-only custody movement ledger, HRMS joiner/leaver automation, and exact integer financial accounting.
Tracking laptops, mobile devices, peripherals, and SaaS seats in spreadsheets or mutable CRUD tables breaks down during SOC 2 audits and employee offboarding: past custody gets overwritten, departing employees keep paid SaaS licenses, and finance numbers never match IT's asset register. `itam-public` treats every procurement, reservation, loan, transfer, and SaaS seat reclaim as an auditable ledger event.
Key modules and entry points in this repository:
- `migrations/`: Ordered PostgreSQL schema migrations for assets, movements, places, software seats, and procurement
- `src/db/adapters/`: Focused SQL adapters for custody, intake, joiner reservations, SaaS reclaim, money, and reconciliation
- `src/http/`: Fastify routes, access-control policy (`ACCESS-CONTROL.md`), and Slack interaction handlers
- `web/`: React 19 + Vite asset register, multi-select bulk actions, and finance spend views
- `bin/itam-demo.mjs`: Standalone CLI walkthrough of `xxyy` state codes and ledger derivation
Every organization-specific value enters through `.env` (copied from `.env.example`) or external adapter files. No source edit is needed to change organization names, endpoints, database URLs, webhook secrets, or thresholds.
When a human asks an AI coding agent to deploy or adapt `itam-public` into their stack:
1. Configure your office/warehouse locations (`places`) and hardware SKU categories after running `npm run migrate`.
2. Point your HRMS webhook (BambooHR, Workday, Rippling, Darwinbox) at the joiner/exit intake endpoints.
3. Wire your IdP/SCIM or MDM read adapter in `src/db/adapters/` to automate SaaS seat reclamation.
- Product Requirements: `docs/PRD.md`
- Working-Backwards PR-FAQ: `docs/PR-FAQ.md`
- High-Level Architecture: `docs/HLD.md`
- Low-Level Interfaces & Runbook: `docs/LLD.md`
- Coding Agent Rules: `AGENTS.md`
---
## File: `.env.example` — Environment Contract (.env.example)
```ini
# itam-public — Hardware ITAM & SaaS License Lifecycle Platform
PORT=4200
DATABASE_URL=postgresql://postgres:postgres@localhost:5432/itam
HRMS_WEBHOOK_SECRET=replace_with_hrms_webhook_secret
MDM_PROVIDER=mock
IDLE_SAAS_RECLAIM_DAYS=30
SESSION_SECRET=replace_with_32_byte_random_secret
```
---
## File: `AGENTS.md` — AGENTS.md
# AGENTS.md — ITAM Public — Hardware Custody & SaaS License Lifecycle Platform
Read this file first before modifying `itam-public`.
## Purpose
A modern TypeScript, Fastify, React 19, and PostgreSQL IT Asset Management (ITAM) and SaaS license lifecycle platform built on `xxyy` 4-digit integer state machines, an append-only custody movement ledger, HRMS joiner/leaver automation, and exact integer financial accounting.
## Commands
```bash
node bin/itam-demo.mjs # run zero-DB xxyy state & append-only custody ledger demo
npm install && npx vitest run src/http/__tests__/money-routes.test.ts src/http/__tests__/intake-routes.test.ts
npm run migrate && npm run dev:web # apply PostgreSQL migrations and start UI
```
## Module Map
- `migrations/`: Ordered PostgreSQL schema migrations for assets, movements, places, software seats, and procurement
- `src/db/adapters/`: Focused SQL adapters for custody, intake, joiner reservations, SaaS reclaim, money, and reconciliation
- `src/http/`: Fastify routes, access-control policy (`ACCESS-CONTROL.md`), and Slack interaction handlers
- `web/`: React 19 + Vite asset register, multi-select bulk actions, and finance spend views
- `bin/itam-demo.mjs`: Standalone CLI walkthrough of `xxyy` state codes and ledger derivation
## Invariants
1. Keep all organization names, credentials, domains, and thresholds in `.env` or external config files. Never hardcode company names, host IPs, or secrets in source files.
2. Deterministic business logic belongs in code and lookup tables, not inside LLM prompts.
3. Update `docs/HLD.md`, `docs/LLD.md`, and `.env.example` in the same commit whenever an interface or environment variable changes.
4. Run the repository smoke check and secret scan before opening a pull request.
---
## File: `docs/PRD.md` — Product Requirements Document (docs/PRD.md)
# Product Requirements Document — ITAM Public — Hardware Custody & SaaS License Lifecycle Platform
A modern TypeScript, Fastify, React 19, and PostgreSQL IT Asset Management (ITAM) and SaaS license lifecycle platform built on `xxyy` 4-digit integer state machines, an append-only custody movement ledger, HRMS joiner/leaver automation, and exact integer financial accounting.
## 1. Problem
Tracking laptops, mobile devices, peripherals, and SaaS seats in spreadsheets or mutable CRUD tables breaks down during SOC 2 audits and employee offboarding: past custody gets overwritten, departing employees keep paid SaaS licenses, and finance numbers never match IT's asset register. `itam-public` treats every procurement, reservation, loan, transfer, and SaaS seat reclaim as an auditable ledger event.
## 2. Users and Jobs-to-be-Done
| Persona | Job-to-be-Done |
|---|---|
| IT Operations & Security Lead | Maintain unbroken chain-of-custody across warehouses, employees, and repair vendors with instant SOC 2 / ISO 27001 point-in-time exports. |
| People / HRMS Operations | Auto-reserve hardware for incoming hires and trigger hardware + SaaS recovery proposals upon employee exit. |
| Finance Controller | Reconcile capex hardware procurement and recurring SaaS spend in exact integer minor units. |
## 3. Core Capabilities
- Append-only custody, loan-extension, fault-report, and stock-reconciliation adapters (`src/db/adapters/`).
- Domain-prefixed `xxyy` integer state machines eliminating string-status drift across SQL migrations and API routes.
- SaaS license assignment and automated idle/exit seat reclamation (`software-adapters.ts`, `provider-reclaim-sql.ts`).
- Bulk procurement, multi-select approval workflows, QR tag reprint queues, and React 19 management console (`web/`).
## 4. Configurable Inputs
Adopters configure the system for their own organization without editing core application logic:
| Variable | Default / Example | Purpose |
|---|---|---|
| `PORT` | `4200` | Fastify API and web UI server port |
| `DATABASE_URL` | `postgresql://postgres:postgres@localhost:5432/itam` | PostgreSQL database connection URL |
| `HRMS_WEBHOOK_SECRET` | `replace_me` | HMAC secret authenticating inbound HRMS joiner/mover/leaver webhooks |
| `MDM_PROVIDER` | `mock` | Device management sync adapter (`mock`, `jamf`, `intune`, or `kandji`) |
| `IDLE_SAAS_RECLAIM_DAYS` | `30` | Inactivity threshold before proposing SaaS license reclamation |
## 5. Phasing and Stability Exit Criteria
1. **Phase 1 (Local Synthetic Run):** Clone the repository, copy `.env.example` to `.env`, and run the quickstart commands against synthetic seed data. Exit criterion: smoke checks pass with zero external credentials.
2. **Phase 2 (Read-Only Shadow Wiring):** Connect read-only credentials or webhook listeners in shadow/dry-run mode. Exit criterion: 100 consecutive events or queries reconcile cleanly against source records.
3. **Phase 3 (Production Cutover):** Enable live writes, alerts, or routing behind bounded retry and idempotency guards.
## 6. Non-Goals
- Shipping organization-specific business rules hardcoded in application source.
- Storing credentials, personal customer records, or tenant URLs inside version control.
- Replacing deterministic validation or arithmetic with unconstrained model prompts.
---
## File: `docs/PR-FAQ.md` — Working-Backwards PR-FAQ (docs/PR-FAQ.md)
# Working-Backwards PR-FAQ — ITAM Public — Hardware Custody & SaaS License Lifecycle Platform
**Release Summary:** `itam-public` gives engineering and operations teams a self-hosted, open-source implementation of ITAM Public — Hardware Custody & SaaS License Lifecycle Platform that configures via `.env` and runs on standard infrastructure in minutes.
## Press Release
Operations and engineering teams often rebuild the same internal workflows behind closed doors or pay per-seat SaaS markups for rigid tools that cannot match their field reality. `itam-public` open-sources a battle-tested implementation of ITAM Public — Hardware Custody & SaaS License Lifecycle Platform, stripped of all single-company assumptions and packaged with clear adapter boundaries, synthetic demo data, and machine-readable agent documentation.
Any team can fork `itam-public`, supply their own `.env` inputs and taxonomy config, and deploy locally or in production with Docker, Python, or Node. AI coding assistants such as Claude Code, Codex, and Cursor can read `AI-README.md` and `llms.txt` to wire custom ERP, CRM, or warehouse adapters in a single session.
## External Adopter FAQ
**Q1: How long does it take to run locally after cloning?**
Under five minutes. Copy `.env.example` to `.env` and run the quickstart commands in `README.md`. Synthetic fixtures let you inspect the workflow before connecting live credentials.
**Q2: Do I need to rewrite source files to use my own company name, channels, or rules?**
No. Organization names, endpoints, thresholds, and credentials sit in `.env` and declarative config files. External system specifics live behind narrow adapter modules documented in `docs/LLD.md`.
**Q3: What license governs this repository?**
MIT License. You can fork, modify, self-host, and use it commercially without restriction.
## Internal Engineering & Security FAQ
**Q4: How do we prevent tenant or employer data from ever entering a public fork?**
The repository starts from a clean git history, excludes raw exports and binary dumps, validates every commit through `gitleaks`, and ships only synthetic fixtures.
**Q5: What happens when an upstream API or model provider is slow or unavailable?**
Inbound webhooks persist raw payloads before processing, outbound writes carry idempotency keys with bounded exponential backoff, and model-backed paths fail open to deterministic rules or explicit human queues.
---
## File: `docs/HLD.md` — High-Level Design (docs/HLD.md)
# High-Level Design (HLD) — ITAM Public — Hardware Custody & SaaS License Lifecycle Platform
A modern TypeScript, Fastify, React 19, and PostgreSQL IT Asset Management (ITAM) and SaaS license lifecycle platform built on `xxyy` 4-digit integer state machines, an append-only custody movement ledger, HRMS joiner/leaver automation, and exact integer financial accounting.
## 1. System Topology
```mermaid
flowchart LR
HRMS["HRMS Joiner / Leaver Sync"] --> API["Fastify ITAM API"]
MDM["MDM Telemetry"] --> API
Web["React 19 IT & Finance Console"] --> API
API --> Ledger["PostgreSQL Append-Only Movement Ledger"]
Ledger --> Derived["Derived Current Custody & SaaS Seats"]
```
## 2. Architectural Decisions and Rejected Alternatives
| Decision | Why It Holds | Rejected Alternative |
|---|---|---|
| Append-only movement ledger + derived current custody | Guarantees complete historical auditability for security incidents and compliance audits. | Overwriting `assigned_to` in place on an `assets` row |
| 4-digit `xxyy` integer state codes | Encodes both workflow surface (`xx`) and lifecycle stage (`yy`) in fast, rename-proof integers. | Ad-hoc `VARCHAR` status strings |
| Unified Hardware + SaaS License Spine | One employee offboarding event reclaims both physical laptops and paid SaaS seats simultaneously. | Separate IT hardware tool and SaaS spreadsheet |
## 3. Data Flow and Failure Boundaries
1. **Configuration Boundary:** Startup validates `.env` variables and declarative config schemas before accepting traffic or running scheduled jobs.
2. **Adapter Boundary:** External services (databases, chat channels, HRMS, warehouses, or LLM providers) sit behind explicit adapter modules so failures stay isolated and testable with local mocks.
3. **Observability and Audit:** State transitions and job executions emit structured logs and deterministic status records rather than mutating state silently.
## 4. Scaling Notes
- **1x to 10x load:** Single-node Docker Compose or process supervisor handles standard team workloads with indexed database queries and bounded worker concurrency.
- **First bottleneck at 10x+:** High-frequency webhook or batch ingestion queues; mitigate by separating the stateless HTTP receiver from background worker processes sharing Redis or PostgreSQL locks.
---
## File: `docs/LLD.md` — Low-Level Design & Runbook (docs/LLD.md)
# Low-Level Design (LLD) & Operations Runbook — ITAM Public — Hardware Custody & SaaS License Lifecycle Platform
This document defines the module responsibilities, environment contract, and operational procedures for `itam-public`.
## 1. Module and File Inventory
| Path | Responsibility |
|---|---|
| `migrations/` | Ordered PostgreSQL schema migrations for assets, movements, places, software seats, and procurement |
| `src/db/adapters/` | Focused SQL adapters for custody, intake, joiner reservations, SaaS reclaim, money, and reconciliation |
| `src/http/` | Fastify routes, access-control policy (`ACCESS-CONTROL.md`), and Slack interaction handlers |
| `web/` | React 19 + Vite asset register, multi-select bulk actions, and finance spend views |
| `bin/itam-demo.mjs` | Standalone CLI walkthrough of `xxyy` state codes and ledger derivation |
## 2. Environment Variable Contract
| Variable | Default / Example | Required | Description |
|---|---|---|---|
| `PORT` | `4200` | Yes | Fastify API and web UI server port |
| `DATABASE_URL` | `postgresql://postgres:postgres@localhost:5432/itam` | Yes | PostgreSQL database connection URL |
| `HRMS_WEBHOOK_SECRET` | `replace_me` | Yes | HMAC secret authenticating inbound HRMS joiner/mover/leaver webhooks |
| `MDM_PROVIDER` | `mock` | Yes | Device management sync adapter (`mock`, `jamf`, `intune`, or `kandji`) |
| `IDLE_SAAS_RECLAIM_DAYS` | `30` | Yes | Inactivity threshold before proposing SaaS license reclamation |
## 3. Extension Recipe
1. Configure your office/warehouse locations (`places`) and hardware SKU categories after running `npm run migrate`.
2. Point your HRMS webhook (BambooHR, Workday, Rippling, Darwinbox) at the joiner/exit intake endpoints.
3. Wire your IdP/SCIM or MDM read adapter in `src/db/adapters/` to automate SaaS seat reclamation.
## 4. Operations Runbook
### 1. Run standalone custody ledger demo
```bash
node bin/itam-demo.mjs
```
### 2. Apply database migrations
```bash
npm run migrate
```
### 3. Run route & adapter unit tests
```bash
npx vitest run src/http/__tests__/money-routes.test.ts src/http/__tests__/intake-routes.test.ts
```
---
## File: `docs/RESEARCH-2026.md` — 2026 Research & Landscape Notes (docs/RESEARCH-2026.md)
# 2026 Open-Source IT Asset Management (ITAM) & SaaS Governance Research
While **Snipe-IT** (PHP/Laravel) and **Shelf.nu** serve general check-in/check-out tracking well, modern engineering and security teams running SOC 2 / ISO 27001 audits in 2026 hit three recurring gaps:
1. **Mutable Custody Columns:** Updating `assigned_user_id` in place makes historical point-in-time incident forensics (*"which employee held MAC address X during the security alert?"*) fragile.
2. **Disconnected SaaS Seat Reclamation:** Hardware tracking and SaaS seat offboarding live in separate tools, leaving paid seats active weeks after an HRMS termination.
3. **Pre-Day-1 Joiner Reservations:** High-growth teams need automatic stock reservation the moment an offer is signed in HRMS, plus exit-recovery proposals the moment notice is recorded.
`itam-public` addresses all three on a modern TypeScript + Fastify + React 19 + PostgreSQL stack using `xxyy` integer state machines and append-only custody ledgers.