SILO · SYSTEM ATLAS

The shape of
the system.

One single-file program runs the whole laydown yard — receiving, sign-out, assets, sync, integrity, and reporting. This is everything it does, drawn to scale. Each band of color below is one subsystem, sized by how much code it takes.

← 10,968 lines of logic, by subsystem727 functions total
01 Storage & data layer 63402 Domain & lookups 94203 Universal barcode lookup 20404 Core UI & scan engine 84905 Views & screens 3,02106 Scanner & camera 79907 App glue, I/O, settings 4,519
727
functions & operations
13,000
lines in the bundle
889 KB
one portable file
7
subsystems
7
data collections
4
storage tiers
59
console commands
42
settings & keys
311
in-app messages
A

The seven subsystems

The program is built as seven modules that bundle into the one file. Two of them — Views and App glue — carry roughly two-thirds of the code. Bars are scaled to the largest module.

01

Storage & data layer

Where every record lives and how it is written.

Holds the four storage tiers and the DB facade. It picks the best store available, reads and writes the seven data collections, batches writes in transactions, and stamps every record with a timestamp. Writes are never destructive — upsert plus surgical deletes.

lines634
functions55
houses APIAdapter · CONFIG · DB · FileSystemAdapter · IDBAdapter · LocalAdapter · Sites · SupabaseAdapter
02

Domain & lookups

The rules of the yard — what moves, where it sits, how stock changes.

Home of the Stock engine (receive, sign-out, move, pass-through), the location picker, the shelf/bay layout model, item-frequency, and product/barcode resolution. Nothing changes stock without going through here.

lines942
functions100
houses Freq · Layout · LocPicker · Locations · Stock
03

Universal barcode lookup

Identify a barcode the catalog has not seen.

Optional. Resolves an unknown UPC/EAN/GTIN against public databases or an endpoint you paste, and auto-fills a description and manufacturer so it can be linked to a part. Off until enabled.

lines204
functions10
houses UniversalLookup
04

Core UI & scan engine

The hands-on receive-and-scan loop.

Smart input fields, the scan-and-receive handling, and the scaffolding the main screens are built on. This is the loop a tech runs all day.

lines849
functions56
houses SMART_FIELDS
05

Views & screens

Everything you look at and tap.

The largest surface: inventory, the item modal, sign-out and asset views, sales orders, the layout/shelf viewer, diagnostics, the identity and chain-of-custody panels, and the transaction UI.

lines3,021
functions172
houses CONTAINERS · Diag · Identity · PG · ROLE_LABELS · SZ · Tx
06

Scanner & camera

Turning a camera or wired scanner into input.

Camera scanning, the bay-scan flow, the dedicated scanner tab, the Bluetooth/HID wedge listener, and reset. It converts a lens or a hardware trigger into a clean barcode the rest of the app can act on.

lines799
functions38
houses
07

App glue, I/O, settings

The connective tissue — sync, reports, console, settings, startup.

The biggest module by far. The operator console, import and export, printed reports, two-way OneDrive sync, the NTI catalog tools, the optional assist subsystem, settings wiring, and the boot sequence that ties it all together.

lines4,519
functions309
houses AI · ASSET_STATUS · Cons · FIELD_LABELS · FileSync · KV · PRIORITY · ReportsAuto
B

By utility & modus operandi

The same code seen by what it is for, and the rule each part follows. These cut across the modules above.

Storage & persistence

mod 01
Four tiers, one facade
FileSystem › IndexedDB › localStorage (Supabase retired from the customer path). DB._write, putItem/putHistory/putProduct/putAsset, purgeIds, clearCollection.
MODUS Picks the best store on the device; writes are upsert + surgical delete, never delete-all.

Stock engine

mod 02
Every quantity change
add (receive), consume (sign-out / install), transfer (move), signOutPassthrough (never-stocked).
MODUS Same-location match or a new line; material sign-out is a give, not a loan. Never bypassed.

NTI catalog

mod 02 / 07
The NTI↔Oracle map
_ntiNext, _ntiByPN, assignNTINumbers, openNTIWizard, runNTIMigration, exportNTIMap, importNTIMapFile, exportCatalogXLSX, resetNTIDatabase, confirmPartsImport.
MODUS NTI keys travel; Oracle/customer data stays on the device and OneDrive, stripped from anything shared.

OneDrive sync

mod 07
Two-way, lossless
FileSync.push (read-merge-write), pull (last-write-wins + tombstones), markDirty, noteDelete, _deepStrip / _deepHydrate.
MODUS Local-first; the shared file carries NTI only and rehydrates Oracle fields on the way back in.

Chain of custody

mod 05 / 07
Tamper-evident history
_sha256hex, _histCanon, _chainStamp, initHistoryChain, verifyIntegrity, historyRoot, runIntegrityCheck, resealHistory.
MODUS Each event is SHA-256-linked to the one before it; one root hash stands for the whole log. NTI-only payload.

Identity & roles

mod 05
Who can do what
Identity.load/set/clear/can, guardWrite, guardAdmin, identitySave, identitySignOut.
MODUS Admin / Lead / Tech / Read-only. Every change is stamped with a name; roles gate the sensitive tools.

Scanner & camera

mod 06
Camera or wired trigger
handleScannedBarcode, handleScannerTabCode, bay-scan flow, camera start/stop, the HID wedge listener, reset.
MODUS A lens or a hardware scanner becomes a clean code the rest of the app resolves and acts on.

Views & rendering

mod 05
Read state, paint, repaint
The render* family, modals, and screens for inventory, items, assets, sign-outs, sales orders, and the shelf viewer.
MODUS Reads the in-memory collections and repaints on every change.

Reports & export

mod 07
Read-only snapshots
export* (Excel / XLSX / CSV), print* (labels, pick lists, inventory reports), the reports-folder export.
MODUS Generates shareable, read-only snapshots; printing and Excel for the night shift.

Diagnostics & self-healing

mod 05
Detect, then fix safely
Diag, renderDiagnostics, and the one-tap fixes for duplicates, orphans, zero lines, barcode collisions, and accountability gaps.
MODUS Flags or moves data into a catch-bin; never deletes as a side effect.

Operator console

mod 07
59 commands
Cons, runConsoleCmd, consolePaste.
MODUS A command line into the live database for diagnostics, sync probes, and operations.

Assist (optional)

mod 07
Off until armed
AI.activate/off/level/_call/converse. Five modes from Local-only to Max.
MODUS Console-armed and hidden by default; Local-only makes no external calls. Paste a key for more.

Transactions

mod 05
Batch & reversible
Tx.run, Tx._commit, txUndo, txRedo.
MODUS Groups related writes into one reversible unit; the console can undo or redo them.
C

Every function

The complete index — all 727 named functions and methods, grouped by the module they live in. This is the raw extent of the program in one view.

01

Storage & data layer

55 functions
_delete_h_loadFSDirHandle_loadXlsHandle_migrateFromLocalStorage_save_saveFSDirHandle_saveXlsHandle_sbApply_sbLoadLayout_sbSaveLayout_sbSubscribe_sbUpdateUI_writeaddaddNewSiteallbulkSaveProductsbulkUpsertclearCollectioncopyToSitecurrentdeleteSitefiltergetDBhealinitloadonSiteSelectorChangepickFolderpurgeIdsputputAssetputHankObjectputHistoryputItemputProductputRequestputSOreconnectremoveremoveRequestremoveSOrenamerenameSiterenderSelectorrenderSiteMgmtreplaceAllsaveAllsbConnectsbDisconnectsbPushLocaltagtryRestoreupdateHistory
02

Domain & lookups

100 functions
_applyCheckModeUI_attachTabComplete_createHankFromMismatch_dirNeg_dispatchQty_exactScanMatch_getSearchLimit_getSearchSort_guessUnit_hankAddVariant_hankCodeNext_hankForPN_hankLookup_hankPickerSelect_hankRemoveVariant_hankResolve_hide_levenshtein_mergeKey_mismatchCreateNew_mismatchSelect_nearMatches_normalizeLoc_onBay_onShelf_openHankEditor_parseBoxQty_pnStr_prodFields_prodMatches_qtyMul_qtyMulField_qtyTot_renderHankEditVariants_scoreProduct_searchProds_searchTokens_shelfCheckStats_show_showHankPicker_showMismatchModal_sortProds_tabComplete_textMatches_updaddaddLaydownLabeladdShelfbuildchaincheckStampItemconsolidateAllItemsdeleteHankObjecteditHankObjectensureRoomescHtmlfindExistingStockformatTimegetAllRoomsgetBayNamesgetBuildinggetLaydownRoomgetLevelNamesgetMoveOptionsgetOrCreateProductgetSOStatsgetScreenBayOrdergetShelfLocKeysgetShelfOptionsgetValueinitkeeplinkBarcodeToProductloadlookupBarcodelookupByMktPnlookupByOraclePNlookupByPartNumberlookupScanCodematchmergeTargetnewCheckSessionnewHankObjectnowopenHankObjectsrecordrefreshremoveShelfrenderHankObjectListsavesaveHankObjectsetCheckColorsuggesttoasttoggleCheckModetoggleRecheckFlagupdateSOFilterupdateShelfupdateTopbaruuid
03

Universal barcode lookup

10 functions
_aiEndpoint_custom_openFoodFacts_upcItemDbinitUniversalLookupSettingsloadlookupsaveshowFieldsuniversalLookupFill
04

Core UI & scan engine

56 functions
_fieldSuggestions_fillFromVariant_gotoShelfFromScan_syncBundleDescaddBulkBarcodeapplyBarcodebulkCaptureOnecanUseLiveCameracheckRequestMatchcreateProductFromLinkexpandAndReceiveBundlefileToImagefillFromProductgetLocForPrefixgetScanFormatshandleScannedBarcodeinitSmartFieldsinstantCreateProductlinkBarcodeAndClosemakePartGroupFromConflictonCascadeBayonCascadeLvlonCascadeShelfonOraclePNInputopenCaptureCameraopenCaptureFileopenDefineBundleModalopenLinkModalpickSmartOptpopulateCascadeDropdownsreceiveBulkreceiveItemremoveBulkBarcoderenderBulkChipsrenderBundleEditorrenderBundlePanelrenderLinkSearchrenderSmartDdresetSingleFormresolveConflictsaveBundleDefinitionscanImageFilesetsetBulkReceiveAtsetContainerTypesetReceiveAtshowProductBannershowProductConflictshowScreenstartBulkCameraScanstopScannerswitchTabtoggleBundlePaneltoggleCustomLoctoggleScanneruseCaptureMode
05

Views & screens

172 functions
_afterShelfQtyChange_armGhostBuster_barcodeSVG_chainStamp_commit_computeInventoryRows_csEstimate_csLines_csShelves_csUnits_deleteMultiSel_diagSevColor_doPlaceMove_drainUnlabeled_drawMapPicker_ensureUnlabeledBin_histCanon_identityRefresh_inBox_integrityRefresh_isUnassigned_lmCenter_lmRect_locToCell_lpScopeChange_mapPickerPickLoc_mapPickerTap_openLabelSheet_openPrintDoc_openStorageHTML_refreshShelfListIfOpen_removeShelfItem_runCountSheets_sha256hex_shelfCenter_snap_startGroupMove_tryPlaceDefault_unselRerender_updateShelfPosEditoraddItemPhotoaddSOLineadjustShelfItemQtyapplyShelfPosauditClearShelfbayDragStartbayDropbyc2gcancenterOnLandmarkcenterOnShelfclampclearclearUnselSelectedcloseMapPickercloseModalconfirmReceiveMoreconfirmSignOutconvertLegacyOutcurrentdeleteItemFromModaldeleteSelectedLandmarkdeleteSelectedShelfdiagFixdispatchItemdrawLandmarkdrawShelfevGexportLayoutfindShelffixAllShelfIssuesfixShelfIssueg2cguardAdminguardWritehexRgbhistoryRoothitLandmarkhitTestidentitySaveidentitySignOutimportLayoutJSONinitHistoryChaininitLayoutEditorlinkItemBarcodeloadmergeDuplicatesnamenextLabelnudgeShelfonCvDownonCvMoveonCvUponMoveElementSelectonPlaceElementChangeopenItemModalopenMapPickeropenSOCreatoropenScannerForBayopenShelfAtLocopenShelfCellopenShelfValidationopenShelfVieweropenSignoutSheetPickeropenUnassignedViewpopulateMoveElementDropdownprintAssetRosterprintCountSheetsprintForemanReportprintInventoryListprintInventoryReceivingReportprintShelfLabelsprintSignedOutReportprintSignoutSheetsprintStockByLocationquadquickAddItemquickAddOraclePNreceiveMoreremapOrphansremoveItemBarcoderemoveItemPhotoremoveSOLineremoveZeroQtyrenderBayPanelrenderDiagnosticsrenderInventoryrenderLayoutrenderRMSplitsrenderReportsrenderSOBodyrenderSOCardrenderSOLinesrenderSOViewerrenderShelfListrenderUnassignedrepairLayoutresealHistoryrolerunrunIntegrityCheckrunLabelPrintrunSelfHealsaveItemEditssaveSOselectShelfFromListsetsetEditorModesetItemFlagsetShelfItemQtysetShelfViewFiltershowItemOnMapsizeCanvassnapAnglesnapShelfToGridtoggleAdvancedSettingstoggleBayOrdertoggleDispatchtoggleEditItemtoggleLayoutEditToolstoggleSOCardtoggleShelfListPaneltoggleSignOuttoggleUnseltxRedotxUndounselToggleAllupdateSelBtnsvalidateShelvesverifyIntegrityviewItemPhoto
06

Scanner & camera

38 functions
_itemHdrbayPhotoCapturebayPhotoScanbayStartScanclearScanSessionconfirmScannerCreateReceiveconfirmScannerMoveconfirmScannerReceiveMoreconfirmScannerReceiveNewconfirmScannerSignOutconfirmScannerTakeNowcreateImageFromFiledeleteBarcodeFromSystemhhandleScannerTabCodeonScannerInputopenProductViewopenRelinkBarcodepopulateScannerTargetLocrelinkAsNewrelinkBarcoderenderRelinkSearchscanAllBarcodesFromImagescannerTakeNowsetScannerModeshowScannerLastFoundshowScannerLookupshowScannerMoveshowScannerReceiveshowScannerResetshowScannerSignOutshowScannerTabNotFoundstartScannerTabstopBayScannerstopScannerTabunlinkBarcodeEverywhereupdateScannerTargetBadgeuseScannerTabPhoto
07

App glue, I/O, settings

309 functions
_aiRefineImport_applyLaptopToggleUI_armLiveExcelResume_armSyncResume_assetEffStatus_assetHistPush_assetsForSite_bayIdTypePlaceholder_bayLocDisplay_bayNewItemForm_bayPkgSummary_bayRecvForm_buildWorkbook_call_clean_clickKey_codeTag_consoleBroadcast_consoleInitBC_consoleRunJS_consoleSubscribe_dashActivityClick_dashFilterSignedOut_dashKpi_deepHydrate_deepStrip_detectColumns_deviceId_doFulfill_doImportJSON_evalJS_exec_extractPlan_fromShared_fulfillPickTotal_getKnownDestinations_getReqDm_histTypeOf_idbHandleGet_idbHandlePut_isCorp_liAutoMap_liBuild_liGridFromText_liLoadGrid_liPreview_logPush_matchRequestsToInventory_maybeInstallNudge_migrateShelfItems_migrateToLocal_newer_ntiByPN_ntiCacheClear_ntiFmt_ntiInitCounter_ntiNext_ntiProd_openFulfillPicker_parseReqPasteRow_parseRowWithMap_persistSoon_pkgOptions_pkgUnit_populateDestDropdowns_prio_prioRank_push_quickCheckItem_refreshVisible_relTime_remote_render_renderAssistCard_renderConsoleToggles_renderImportGaps_renderImportPreview_reportFilteredItems_reportGroupKey_runActions_runUrlCommand_saveFolderExtra_say_showSOsForDest_sys_toShared_txDelta_ui_updateChatBadge_visible_watchDoAdd_watchLoc_watchPopulateLocs_watchStatus_wbFromSheets_wireBayRecvSoDd_writeAllReports_writeWBacknowledgeDMactivateactiveaddItemToDMapplyFieldScanapplyRoomConfigapplyThemearmedassignNTINumbersassistDeactivateassistImportassistSaveKeyautoMapColumnbayCreateNewPartbayMoveStackHerebayReceiveCatalogProductbayReceiveNewbayReceiveProductbulkAttachToSOcapchatEnsureNamechatGetNamechatLoadChannelchatOpenchatRenderMessageschatScrollBottomchatSendchatSetNamechatSubscribechatSwitchChannelcheckInAssetclearclearAllDataclearCatalogOnlyclearHistoryOnlyclearKeyclearReqSelectedclearStockOnlyclickStatsRankedcloseFieldScancloseWatchModecolsconfirmAssetSignOutconfirmBayAddconfirmBayNewItemconfirmBayReceiveconfirmCheckScanconfirmFulfillPickconfirmPartsImportconfirmPutInBayconfirmResumeLiveExcelconfirmTakeFromBayconsoleKeyconsolePasteconversedeleteAssetdeleteRequestdetectDelimiterdownloadReportCSVdownloadReportXLSXdownloadReqTemplateearmarkRequesteditReqQtyeventexportCSVexportCatalogXLSXexportJSONexportNTIMapexportReportsFolderexportXLSXfieldfillfulfillReqItemgethhandleImportFilehandlerhistToggleimportJSONimportJSONFileimportNTIMapFileimportReqPasteimportSOLineIteminfoinitinitKeyboardWedgeinstallAppinvisScanReadyitemRowkeylevelliveExcelSupportedliveExcelSynclocImportAIlocImportCommitlocImportFilelocImportParselogmarkDirtyminsmodelnoteDeleteoffononBayDescInputonBayOracleInputonBaySearchonGridResizeonMappingChangeopenAddRequestopenAssetDetailopenAssetEditopenConsoleopenDMDetailopenFieldScanopenHelpopenLocImportopenNTIWizardopenPartsImportopenReportBuilderopenRequestPasteopenRequestSearchopenRoomConfigopenShelfPropsopenTakeBayItemopenWatchModeparseCSVLineparseImportDatapasteReqDmChangepickpreviewReqPasteprintFullReportprintLabelsprintPickListprocessBayScanResultspullpushreconnectToFolderredrawrefocusScannerInputrelinkItemsToNTIrenderAssetsrenderClickStatsrenderDMDetailrenderDashboardrenderHistoryrenderReqSearchResultsrenderRequestsreqDmNewreqDmSelChangereqFileSelectedresetClickStatsresetNTIDatabaserestoreresumeresumeLiveExcelrunrunConsoleCmdrunCustomReportrunNTIMigrationsaveAssetsaveNewRequestsaveShelfPropssaveShowsectionselectBayOracleProdselectBayPutItemselectDataFolderselectReqItemsetsetAssetStatussetDMPrioritysetHistFiltersetKeysetLevelsetProgressshowBayNotFoundshowBayScanFoundshowReqHelpsignOutAssetstartstartBayMovestartLiveExcelstatusstopstopLiveExcelstopTimerssupportedswitchImportModeswitchSOSubModeticktoggleConsoleCattoggleConsolePausetoggleConsoleVerbosetoggleImportHeadertoggleLaptopModetoggleReportsAutotoggleReqItemExpandtoggleThemeupdateLiveExcelUIupdateReportPreviewupdateSOTableStatusupdateScanModeUIupdateStorageUIuseBrowserStoragewatchAddNamedwatchCamerawatchScanwireSORAttachDdswriteLiveExcel
D

The accompanying files

The app ships as one file; everything else is source, tooling, and documentation around it.

The app
laydown-ims.html13,000 lines · 889 KBThe shipping single-file PWA. Open it and it runs — no install, no build, no network needed.
Modular source
laydown-ims/index.html920 linesShell + markup; loads the modules in order.
laydown-ims/css/styles.css187 linesAll styling.
laydown-ims/js/01-storage.js633 linesStorage & data layer.
laydown-ims/js/02-domain.js941 linesDomain & lookups (Stock engine).
laydown-ims/js/03-lookup.js203 linesUniversal barcode lookup.
laydown-ims/js/04-core.js848 linesCore UI & scan engine.
laydown-ims/js/05-views.js3,020 linesViews & screens.
laydown-ims/js/06-scanner.js798 linesScanner & camera.
laydown-ims/js/07-app.js4,518 linesApp glue, I/O, settings.
laydown-ims/build.py55 linesRebuilds the bundle from the modules and verifies it is byte-identical.
laydown-ims/supabase-*.sql4 files · 116 linesLegacy cloud schema (Supabase retired from the customer path).
Handoff docs
laydown-ims/README.md83 linesProject overview.
laydown-ims/AGENT.md65 linesBuild/agent notes (to be re-issued without assist references).
laydown-ims/PORTING-GUIDE.md103 linesPorting guide.
Standalone tools
hank-admin.html265 lines · 17 KBThe back-office admin console — users, devices, hashed passwords, access.
hank-ims-internals.html467 lines · 30 KBThe technical internals dossier.
Decks & guides
hank-ims-data-architecture.pptx9 slides · 398 KBThe board deck on the data architecture.
hetzner-vps-setup.md209 lines · 7 KBThe Hetzner VPS setup guide.
hank-tool-ims-rebuild-kit.zip479 KBFull rebuild kit — bundle, source, docs.
E

How it fits together

Where data flows. The catalog and operational data are kept deliberately apart, and integrity and identity run across everything.

Field clients
PhoneiPadGalaxy WatchLaptop
The application · SILO (one file)
01 Storage02 Domain · Stock03 Lookup04 Core scan05 Views06 Scanner07 App glue
Persistence — on the device
FileSystemIndexedDBlocalStorage
Off the device
OneDrive — the NTI↔Oracle catalogVPS (next) — operational data & login
Chain of custody — every event SHA-256-linked Identity & roles — every change has a name