IT Asset Management System for Windows Server 2019+.
Current release: v4.5.9
- Software Inventory — Track software assets with metadata, ownership, lifecycle state and operational details.
- License Management — Monitor license compliance, expiry dates, seat counts and linked software records.
- Vendor Management — Manage vendor contact data and block unsafe deletes when dependent software or contracts exist.
- Contract Management — Create, edit, delete and review vendor contracts from the
/contractsdashboard module. - Budget Management — Track departmental/category budgets from the
/budgetsmodule; remaining budget is calculated server-side. - Software Assignments — Assign software to users from the
/assignmentsmodule and track active/revoked usage. - Cost Tracking — Track software costs by department, category, billing cycle and date.
- Dashboard and Reports — Overview cards, charts and report APIs for assets, compliance and cost views.
- Alerts — Track expiring licenses and compliance issues.
- Import/Export — Full JSON export/restore including vendors, software, licenses, costs, alerts, contracts, budgets, assignments and users.
- Windows Deployment — PowerShell installer, update flow, PM2/NSSM service option and Windows-safe build wrapper.
- Dashboard route:
/contracts - API routes:
/api/contractsand/api/contracts/[id] - Supports list, create, edit and delete.
- Tracks contract number, title, vendor, start/end/renewal dates, value, payment terms, renewal terms, status and notes.
- Vendor deletion is blocked cleanly while dependent contracts exist.
- Dashboard route:
/budgets - API routes:
/api/budgetsand/api/budgets/[id] - Supports list, create, edit and delete.
- Tracks name, department, category, budget amount, spent amount, fiscal year, date range and notes.
remainingAmountis calculated by the API frombudgetAmount - spentAmount; clients do not submit it.- Fiscal year/date validation prevents inconsistent budget periods.
- Dashboard route:
/assignments - API routes:
/api/assignmentsand/api/assignments/[id] - Supports list, create, edit and delete.
- Links software to a user identifier, department, assignment date, revocation date, status and notes.
userIdis intentionally a plain string for the current internal/LAN deployment model.- Software deletion is blocked cleanly while dependent assignments exist.
- Vendor/software/license/cost/alert/contract/budget/assignment mutations return controlled validation errors instead of accidental
500responses. - Foreign-key delete conflicts are reported cleanly.
- Vendor update diagnostics include detailed error information when a write fails.
- Fake/unfinished dashboard actions were replaced with real API calls or removed from active UI surfaces.
install.ps1 -Updatestops the running SAM process before replacing files and rebuilding.- Stale
.nextoutput is removed during update to avoid mixed old/new Next.js assets. install.ps1andstart.ps1repair SQLite data-directory ACLs/read-only attributes to avoidattempt to write a readonly databaseerrors after elevated installs or backups.- Relative SQLite
DATABASE_URLvalues are normalized to the installeddata/sam.dbpath.
- Frontend: Next.js 14, React, Tailwind CSS, shadcn/ui
- Backend: Next.js API Routes
- Database: SQLite via Prisma ORM
- Auth: Custom JWT cookie route plus NextAuth dependency compatibility
- Runtime: Node.js on Windows, optionally managed by PM2 or NSSM
Run PowerShell as Administrator:
irm https://raw.githubusercontent.com/Schrotti77/sam-windows/main/install.ps1 | iexgit clone https://github.com/Schrotti77/sam-windows.git C:\SAM
cd C:\SAM
.\install.ps1cd C:\SAM
.\install.ps1 -SetupService# Standard install to C:\SAM
.\install.ps1
# Custom directory
.\install.ps1 -InstallDir "D:\Apps\SAM"
# Custom port
.\install.ps1 -Port 8080
# Install as Windows Service / auto-start on boot
.\install.ps1 -SetupService
# Update existing installation
.\install.ps1 -Update -InstallDir C:\SAM
# Combined: update + service
.\install.ps1 -Update -InstallDir C:\SAM -SetupService
# Skip Node.js check if already installed
.\install.ps1 -SkipNodeCheck
# Skip firewall configuration
.\install.ps1 -SkipFirewallPowerShell uses single-dash switches. Use
-Update, not--Update.
# Start production mode
.\start.ps1
# Start development mode with hot reload
.\start.ps1 -Dev
# Stop
.\stop.ps1npm i -g pm2
pm2 start ecosystem.config.js
pm2 save
pm2 status- URL: http://localhost:3000
- Default Login: john@doe.com / johndoe123
# Install as auto-starting service
.\install.ps1 -SetupService
# Manage service
net start SAM
net stop SAM
# Or via NSSM
nssm start SAM
nssm stop SAM
nssm restart SAMGET /api/software— list software inventoryPOST /api/software— create softwareGET /api/software/[id]— get one software itemPUT /api/software/[id]— update softwareDELETE /api/software/[id]— delete software when no dependent records block itGET /api/vendors— list vendorsPOST /api/vendors— create vendorPUT /api/vendors/[id]— update vendorDELETE /api/vendors/[id]— delete vendor when no dependent software/contracts block itGET /api/licenses/POST /api/licenses— license list/createPUT /api/licenses/[id]/DELETE /api/licenses/[id]— license update/deleteGET /api/costs/POST /api/costs— cost list/createPUT /api/costs/[id]/DELETE /api/costs/[id]— cost update/deleteGET /api/alerts/POST /api/alerts— alert list/createPUT /api/alerts/[id]/DELETE /api/alerts/[id]— alert update/deletePOST /api/alerts/[id]/resolve— mark alert resolved
GET /api/contracts/POST /api/contracts— contract list/createGET /api/contracts/[id]/PUT /api/contracts/[id]/DELETE /api/contracts/[id]— contract read/update/deleteGET /api/budgets/POST /api/budgets— budget list/createGET /api/budgets/[id]/PUT /api/budgets/[id]/DELETE /api/budgets/[id]— budget read/update/deleteGET /api/assignments/POST /api/assignments— assignment list/createGET /api/assignments/[id]/PUT /api/assignments/[id]/DELETE /api/assignments/[id]— assignment read/update/delete
GET /api/dashboard/stats— dashboard statisticsGET /api/dashboard/compliance— compliance overviewGET /api/dashboard/costs— cost/report dataGET /api/export— full JSON exportPOST /api/import— restore/import from a SAM exportPOST /api/login— custom JWT login, setsauth-tokencookiePOST /api/logout— logoutGET /api/me— current userPOST /api/signup— user registration
The JSON export format is currently version 3.1 and includes:
- users
- vendors
- software
- licenses
- costs
- alerts
- contracts
- budgets
- assignments
Import supports ID remapping between vendors/software and dependent records. The importer handles contracts, budgets and assignments, normalizes older budget date shapes and avoids duplicate budget/assignment records on repeated imports where possible.
SAM is normally deployed as an internal Windows/LAN tool. API write protection is therefore opt-in for hardened deployments:
$env:SAM_REQUIRE_AUTH="true"
.\start.ps1When SAM_REQUIRE_AUTH=true, protected API mutations and import/export require a valid auth-token cookie from /api/login. When it is not set to true, API writes are allowed for internal deployments.
Security notes:
- Change the default password after first login.
- Generate a strong
NEXTAUTH_SECRETfor production. - Keep SAM behind your LAN/VPN/reverse-proxy controls; do not expose it directly to the public internet without a hardened auth/reverse-proxy setup.
- See
SECURITY.mdfor detailed security guidance.
SAM uses SQLite; no external database server is required.
- Production install path:
C:\SAM\data\sam.db - Configured through
DATABASE_URLin.env - Installer/start scripts normalize relative SQLite paths and repair writable ACLs for
dataandsam.db*files. - The seed script is idempotent: running
node scripts\seed.jsrepeatedly updates demo records instead of duplicating them. - Demo dates are generated relative to the current date so dashboard monthly costs and renewal/expiration examples stay useful.
On Windows, prefer the wrapper:
.\build.cmdbuild.cmd uses a temporary subst drive mapping to avoid Windows path-casing issues such as C:\SAM vs C:\sam, which can otherwise cause Next/React build failures. install.ps1 and start.ps1 call the wrapper automatically.
After install and before handoff:
npm run verify:installAfter the app is running:
$env:SMOKE_BASE_URL="http://localhost:3000"
npm run verify:runningFocused checks:
npm run test:db
npm run test:vendor-update
npm run test:reports
npm run test:crud
npm run test:contracts
npm run test:contracts-ui
npm run test:budgets
npm run test:budgets-ui
npm run test:assignments
npm run test:assignments-ui
npm run test:import-export
npm run test:api-auth
npm run test:seedBuild/type checks:
npx tsc --noEmit
.\build.cmdThe installer writes detailed logs to C:\SAM\logs\install.log:
- Commands, output and errors are logged with timestamps.
- Update runs stop the old process, clean stale build output and regenerate Prisma/client assets.
- Database ACL repair warnings are logged but do not stop installation unless a later required step fails.
To view the log:
notepad C:\SAM\logs\install.logC:\SAM\
├── app/ # Next.js 14 App Router
│ ├── (dashboard)/ # Dashboard pages: software, vendors, contracts, budgets, assignments, reports
│ ├── api/ # API routes
│ ├── login/ # Login page
│ └── register/ # Registration page
├── components/ # React components
├── lib/ # Utilities, auth, database, validators
├── prisma/ # Database schema
├── data/ # Production SQLite database files
├── scripts/ # Seed, smoke and regression scripts
├── logs/ # Installation and service logs
├── install.ps1 # Automated installer/update script
├── start.ps1 # Start script
├── stop.ps1 # Stop script
└── build.cmd # Windows-safe build wrapper
- User — Accounts: email, password, role
- Vendor — Software vendors and contact details
- Software — Software assets and metadata
- License — License tracking: seats, expiry, compliance
- Contract — Vendor contracts: value, dates, terms, status
- SoftwareCost — Cost entries: billing, department, category
- Budget — Department/category budgets with fiscal-year tracking
- ComplianceAlert — Alerts: severity, resolved status
- SoftwareAssignment — User-to-software assignments
- Windows Server 2019 or Windows 10/11
- PowerShell 5.1+
- Node.js 18+; Node.js 22 LTS recommended
- npm 9+
- 2 GB RAM minimum
- Port 3000 by default; configurable with
-Port
# Manual backup
Copy-Item C:\SAM\data\sam.db C:\SAM\data\sam-backup-$(Get-Date -Format yyyyMMdd).dbFor restore/migration between SAM instances, prefer the built-in JSON export/import flow when the application is running.
- Check the installation log:
C:\SAM\logs\install.log - Ensure PowerShell is running as Administrator.
- Verify Node.js >= 18 is installed:
node --version - Verify npm is available:
npm --version - If updating, make sure the command uses
-Update, not--Update.
cd C:\SAM
npx prisma generate
npx prisma db push
node scripts\seed.jsIf writes fail with attempt to write a readonly database, run:
cd C:\SAM
.\start.ps1start.ps1 repairs the data ACL/read-only state before launching. A full update also performs the same repair:
cd C:\SAM
.\install.ps1 -Update -InstallDir C:\SAMcd C:\SAM
Remove-Item .next -Recurse -Force -ErrorAction SilentlyContinue
.\build.cmdnetstat -ano | findstr :3000
.\stop.ps1# Dev mode with hot reload
cd C:\SAM
npm run dev
# Production build on Windows
.\build.cmd
# Database changes
npx prisma db push
npm run db:seed- ROADMAP.md — Improvement suggestions and planned features
- CHANGELOG.md — Version history
- SECURITY.md — Security guidance and hardening
Current: v4.5.9