Before building, ensure you have:
- Node.js and npm installed (for development)
- Bundled MongoDB downloaded
cd path\to\POS download-mongodb.bat
- api dependencies installed
cd api npm install
npm install
npm --prefix api install
npm run build # Windows installer into dist/No token is needed. Releases are public, so the updater reads them without credentials of any kind.
# Remove old build artifacts
Remove-Item -Path "dist" -Recurse -Force -ErrorAction SilentlyContinueEnsure these folders exist:
POS\
├── api\
│ ├── node_modules\ ✅ Must exist
│ ├── src\
│ ├── app.js
│ └── server.js
├── web\
│ └── public\
├── mongodb\
│ ├── bin\
│ │ └── mongod.exe ✅ Must exist
│ ├── data\
│ └── log\
└── nodejs\ (optional)
└── node.exe
npm run buildThis will create:
dist\
└── Posnic Setup 1.0.0.exe
Main App Files:
- main.js, server.js, preload.js
- HTML files (loading, install-wizard, hardware-manager)
- Manager scripts (mongodb-manager, hardware-manager, etc.)
- Setup scripts (.bat files)
Extra Resources:
api/- the API server and its node_modules, minus tests and dev scriptsfrontend/- the built web assets (this wasweb/in an older layout)mongodb/- the MongoDB server, fetched bydownload-mongodb.batrather than kept in git;npm run check:mongodbrefuses to build without itbrand-seed/- empty in a stock build; white-label installers are produced from a separate private repository
Node is not bundled: the API runs in-process on the Node inside Electron.
{
"asar": false, // No ASAR packaging (easier debugging)
"compression": "store", // No compression (faster)
"extraResources": [
"api with node_modules",
"web",
"mongodb",
"nodejs"
]
}Run the generated installer:
dist\Posnic Setup 1.0.0.exe
Check installed location (usually):
C:\Users\[Username]\AppData\Local\Programs\Posnic\
Verify resources folder:
C:\Users\[Username]\AppData\Local\Programs\Posnic\resources\
├── api\
├── web\
├── mongodb\
└── nodejs\
Launch from Start Menu or Desktop shortcut.
If issues occur, check:
C:\Users\[Username]\AppData\Roaming\Posnic\logs\
Error: Cannot find module
# Install api dependencies
cd api
npm installError: MongoDB not found
# Download MongoDB
download-mongodb.batCheck paths in logs:
- Look for "isPackaged: true"
- Verify "process.resourcesPath" points to correct location
- Check if api, mongodb folders exist in resources
MongoDB won't start:
- Check
resources\mongodb\bin\mongod.exeexists - Check
resources\mongodb\datafolder exists - Check Windows Defender isn't blocking
API Server won't start:
- Check
resources\api\node_modulesexists - Check
resources\api\server.jsexists - Verify MongoDB is running first
Causes:
- API server failed to start
- MongoDB not running
- web files missing
Debug:
- Open DevTools (Ctrl+Shift+I)
- Check Console for errors
- Check Network tab for failed requests
- Base Electron: ~150MB
- api + node_modules: ~100MB
- web: ~50MB
- MongoDB: ~300MB
- Node.js: ~70MB (if included)
- Total: ~620-670MB
- Slightly larger due to extracted files
- Total: ~700-750MB
The built installer is completely self-contained:
- ✅ No MongoDB installation needed
- ✅ No Node.js installation needed
- ✅ No external dependencies
- ✅ Works on any Windows 10/11 PC
- OS: Windows 10/11 (64-bit)
- RAM: 4GB minimum, 8GB recommended
- Disk: 1GB free space
- Network: Not required (works offline)
npm run build- No code signing
- No compression
- Faster build time
{
"compression": "maximum",
"asar": true
}- Smaller size
- Slower build time
- Harder to debug
-
Update version in package.json:
{ "version": "1.1.0" } -
Rebuild:
npm run build
-
New installer created:
dist\Posnic Setup 1.1.0.exe
- Build time: 5-10 minutes (depending on PC)
- First build is slower (downloads Electron)
- Subsequent builds are faster
- Build output is in
dist/folder - Old builds are automatically cleaned
Before distributing, verify:
- ✅ Installer runs without errors
- ✅ App starts and shows installation wizard
- ✅ MongoDB starts automatically
- ✅ API server starts on port 5000
- ✅ Can create first user
- ✅ Can login after setup
- ✅ Hardware manager works
- ✅ App closes cleanly
Build process 100% working! Self-contained installer ready for distribution! 🎉