Windows Installer Developer Guide
This guide explains how to build:
server.exeandencrypt.exe(backend binaries)build_config.exe(config packer utility)Inventory_Installer.exe(UI installer)backend_Installer.exe(full bootstrap installer)
1. Prerequisites
Install these on your Windows build machine:
- Flutter SDK (with Windows desktop support)
- Node.js 18+
- npm
- Inno Setup 6
- Visual C++ Redistributable package file (
vc_redist.x64.exe) - PostgreSQL offline installer file (
postgresql-18.3-2-windows-x64.exe) for full backend installer
Official links:
- Flutter install: https://docs.flutter.dev/get-started/install/windows/desktop
- Node.js: https://nodejs.org/en/download
- Inno Setup: https://jrsoftware.org/isdl.php
- VC++ redistributable: https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist
- PostgreSQL downloads: https://www.enterprisedb.com/downloads/postgres-postgresql-downloads
2. Build Backend EXE Files
From project root:
cd backend
npm install
npm install --save-dev pkg
npx pkg .\server.js --targets node18-win-x64 --output .\server.exe
npx pkg .\build_config.js --targets node18-win-x64 --output .\build_config.exe
npx pkg .\encrypt.js --targets node18-win-x64 --output .\encrypt.exe
Expected output in backend/:
server.exebuild_config.exeencrypt.exe
2.1 build_config.exe Guide
Purpose:
- Creates
sysConfig.encfrom values insidebackend\build_config.js.
How to use:
- Edit
rawConfiginbackend\build_config.jswith real values. - Build executable:
cd backend
npx pkg .\build_config.js --targets node18-win-x64 --output .\build_config.exe
- Run:
.\build_config.exe
Expected output:
backend\sysConfig.enc
Notes:
- Do not ship
build_config.jswith real secrets. - Ship only
sysConfig.encin installer payload.
2.2 encrypt.exe Guide
Purpose:
- Encrypts
config.jsonintoconfig.encusing logic frombackend\encrypt.js.
How to use:
- Ensure
backend\config.jsonexists. - Build executable:
cd backend
npx pkg .\encrypt.js --targets node18-win-x64 --output .\encrypt.exe
- Run:
.\encrypt.exe
Expected output:
backend\config.enc
Notes:
- In your current installer flow,
backend.issrunsencrypt.exeduring install. config.jsonis temporary and should be deleted after encryption.
3. Build Flutter Windows Release
From project root:
flutter clean
flutter pub get
flutter build windows --release
Expected UI build output folder:
build\windows\x64\runner\Release\
4. Prepare Installer Input Files
Make sure these files are present before compiling installer scripts:
build\windows\x64\runner\Release\*backend\server.exebackend\build_config.exe(optional utility, not required at runtime)backend\encrypt.exebackend\license.keybackend\sysConfig.enc(generated by your config flow)backend\run_hidden.vbsinstaller\app_icon.icoinstaller\vc_redist.x64.exeinstaller\postgresql-18.3-2-windows-x64.exe
5. Update .iss Source Paths
Current scripts use hard-coded paths like D:\inventory\....
Before building, open these files and replace Source: paths with your machine paths:
installer\inventory_fsetup.issinstaller\backend.iss
Recommended: keep one stable build root (example: D:\inventory) to avoid frequent edits.
6. Compile Inventory Installer (UI + Optional Backend)
Compile:
"C:\Program Files (x86)\Inno Setup 6\ISCC.exe" "installer\inventory_fsetup.iss"
Expected output:
Inventory_Installer.exe(as defined byOutputBaseFilename)
7. Compile Backend Bootstrap Installer
This installer runs prerequisites and then runs Inventory_Installer.exe.
Compile:
"C:\Program Files (x86)\Inno Setup 6\ISCC.exe" "installer\backend.iss"
Expected output:
backend_Installer.exe(as defined byOutputBaseFilename)
8. What Each Installer Does
inventory_fsetup.iss:
- Installs UI for Server and Client modes
- Installs backend files only for Server mode
- Creates desktop/start-menu shortcuts
- Adds firewall rule for port
3000 - Registers backend auto-start (
run_hidden.vbs)
backend.iss:
- Installs VC++ runtime and PostgreSQL (if missing)
- Creates database/user with secure random credentials
- Generates encrypted config at install time
- Runs
Inventory_Installer.exesilently
9. Validation Checklist
After installation on a clean Windows machine:
- App launches from desktop shortcut.
server.exeis running (Server mode).- API responds on
http://127.0.0.1:3000/health. - Windows Firewall rule for port
3000exists. - Reboot test confirms backend auto-start.
- Uninstall removes app files and cleanup logic works.
10. Troubleshooting
ISCC.exe not found:- Check Inno Setup install path or add
ISCC.exetoPATH.
- Check Inno Setup install path or add
Source file not foundduring compile:- One or more
Source:paths in.issstill point to old location.
- One or more
- App opens but backend fails:
- Verify
server.exe,license.key,sysConfig.enc,run_hidden.vbsare in install directory.
- Verify
- PostgreSQL install problems:
- Confirm installer file name matches
backend.issexactly.
- Confirm installer file name matches
11. Google Script Setup Guide
Use this when configuring:
const rawConfig = {
sheetId: "1hxxxxxxxxxxxxxxxxxxxxxxThE",
scriptUrl: "https://script.google.com/macros/s/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/exec",
emailId: "hxx@domain.com",
emailPass: "xxxx xxxx xxxx",
rootFolderId: "1Ipxxxxxxxxxxxxxxxxxxxxxxx0Ke"
};
11.1 Create Google Sheet
- Create a Google Sheet and copy its ID (
sheetId) from URL. - Create sheet tabs:
ClientsUpdate
Clientsis used for license/client records.Updateis used by app update check (latest_version, download URL, changelog, date).
11.2 Create Google Drive Root Folder
- Create a Drive folder that will hold all client folders/backups.
- Copy that folder ID as
rootFolderId.
11.3 Deploy Apps Script Web App
- Open script.google.com.
- New project -> paste script from
installer\scriptgoogle.txt. - Save project.
- Deploy -> New deployment -> Web app.
- Execute as: your account.
- Who has access: anyone with link (or your required policy).
- Deploy and copy Web App URL to
scriptUrl.
11.4 Set rawConfig and Generate sysConfig.enc
- Open
backend\build_config.js. - Replace
rawConfigvalues with realsheetId,scriptUrl,emailId,emailPass,rootFolderId. - Build and run:
cd backend
npx pkg .\build_config.js --targets node18-win-x64 --output .\build_config.exe
.\build_config.exe
- Output file:
backend\sysConfig.enc
sysConfig.enc is the file used at runtime by backend cloud sync features.
11.5 Quick Connectivity Test
After install, trigger any feature that syncs/checks cloud:
- update check
- client upsert
- backup upload
If scriptUrl/IDs are wrong, backend logs will show cloud communication errors.
12. license.key Guide
Purpose:
- Enables/validates application licensing in backend startup and API flows.
File handling:
- Keep
license.keyinbackend\license.keybefore packaging. inventory_fsetup.issincludes it in server component install.- At runtime it must exist in install directory beside
server.exe.
Packaging reference:
installer\inventory_fsetup.issincludes:Source: "...\backend\license.key"; DestDir: "{app}"
13. run_hidden.vbs Guide
Purpose:
- Launches
server.exesilently (no console window), using its own folder as working directory.
Behavior:
- Resolves script folder path.
- Sets current directory to that folder.
- Runs
server.exehidden.
File handling:
- Keep
backend\run_hidden.vbswith backend payload. inventory_fsetup.isscopies it to{app}for Server install type.- It is used for:
- startup registry entry
- scheduled task
INVINS_Server - post-install backend start
14. Where The Related Code Is Found
Google Script and config:
- Google Apps Script source:
installer\scriptgoogle.txt
- Raw secure cloud config template:
backend\build_config.js(rawConfig)
- Runtime decrypt for
sysConfig.enc:backend\utils\configManager.js
Backend cloud integration:
- Main Google Script caller:
backend\modules\driveService.js
- Client sync trigger logic:
backend\modules\sheetService.js
- Update-check endpoint (uses
check_update):backend\controllers\public\updateController.js
- Config upload/download to Drive:
backend\modules\updownconfig.js
Installer and startup:
- Server/client installer:
installer\inventory_fsetup.iss
- Bootstrap installer:
installer\backend.iss
- Silent launcher script:
backend\run_hidden.vbs