Skip to content

PanSketo/PrintHub-iOS-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

165 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ–จ๏ธ PrintHub

Self-hosted filament inventory & Bambu Lab printer control for iPhone

iOS Swift Node.js Docker License

No cloud subscription. No vendor lock-in. Your data stays on your hardware.


๐Ÿ“‹ Table of Contents


โœจ Features

๐Ÿ“ฆ Filament Inventory

  • ๐Ÿ“ท Barcode scanning โ€” camera scan auto-fills brand, SKU, colour, and fetches a spool image
  • ๐Ÿงต Full spool tracking โ€” brand, type (PLA / PETG / ABS / TPU / ASA / PA / PC / โ€ฆ), colour, weight, price, notes
  • ๐ŸŽจ Colour picker โ€” preset swatches + full colour wheel with hex display
  • ๐Ÿ” Filter & search โ€” by brand, colour, type, or stock status (In Stock / Low / Empty)
  • ๐Ÿ–ผ๏ธ Spool images โ€” auto-fetched and mirrored to your server for offline use
  • ๐Ÿ” Restock detection โ€” scanning a duplicate SKU prompts a restock instead of adding a duplicate

โš–๏ธ Weight & Cost Tracking

  • ๐Ÿ“ Two weight update methods โ€” enter grams directly, or measure the gap from the spool rim to estimate remaining weight
  • ๐Ÿ’ถ Cost per print โ€” automatically calculated from price-per-gram ร— grams used
  • ๐Ÿ“ˆ Price history โ€” log and chart price changes per filament over time
  • ๐Ÿ’ฐ Spend analytics โ€” total spend, cost per gram, cost per print

๐Ÿ—‚๏ธ Print Logging

  • ๐Ÿ“ Log print jobs โ€” name, duration, grams used, success/fail, multi-filament support
  • โšก Auto weight deduction โ€” remaining weight updated automatically on save
  • ๐Ÿ“œ Print history per spool โ€” full job list with weight, cost, and duration
  • ๐ŸŒ Global print log โ€” all jobs across all spools in one view, with total weight used, filament length, and total cost

๐Ÿ–จ๏ธ Printer Control (Bambu Lab)

  • ๐Ÿ“ก Live printer status โ€” progress bar, layer count, elapsed time, finish time, temperatures
  • โ–ถ๏ธ Start prints remotely โ€” browse your printer's SD card and USB drive, tap any .3mf file to start
  • โธ๏ธ Pause / Resume / Stop โ€” full in-app print control
  • ๐ŸŒก๏ธ Temperature control โ€” tap nozzle or bed tile to set a target temperature
  • ๐Ÿ’ก Chamber light toggle โ€” turn the LED on/off from the dashboard
  • ๐Ÿ”€ AMS slot mapping โ€” map AMS 2 Pro slots to spools for automatic weight deduction
  • ๐Ÿ–ฅ๏ธ Multi-printer support โ€” add multiple printer profiles, switch between them instantly

๐Ÿ“‚ File Management

  • ๐Ÿ’พ SD card browser โ€” navigate the full directory tree on your printer's internal storage
  • ๐Ÿ—‘๏ธ Multi-select delete โ€” long press a file to get a context menu; select multiple files and delete in bulk
  • ๐ŸŽฌ Timelapse viewer โ€” browse, stream full-screen, save to Photos, or delete recordings

๐Ÿ  Dashboard

  • ๐Ÿƒ Customisable cards โ€” drag to reorder, show/hide sections
  • ๐Ÿ“Š Stats cards โ€” total spools (by kg), weight remaining, low stock count, total spend
  • ๐Ÿ“‰ Charts โ€” filament type breakdown, spend by brand, price trends
  • ๐Ÿ›’ Shopping list โ€” auto-generated from low-stock spools
  • ๐Ÿ“ธ Live camera feed โ€” MJPEG stream from your printer cam
  • ๐Ÿ• Recent prints โ€” quick glance at the latest activity

๐Ÿงฎ Print Cost Calculator

  • ๐Ÿ’ผ Full business cost model โ€” filament, electricity, printer depreciation, consumables, fixed overhead
  • ๐Ÿ“ Profit margin โ€” true margin as % of selling price
  • ๐Ÿ”ข Live breakdown โ€” see exactly what drives each cost
  • ๐Ÿ’พ All settings saved across app restarts

๐Ÿ”ง General

  • ๐ŸŽ™๏ธ Siri Shortcuts โ€” App Intents integration for inventory queries
  • ๐Ÿ“ค Export / Import โ€” full JSON backup of filaments and print jobs via share sheet
  • ๐Ÿ”” Push notifications โ€” alert when any spool drops below your low-stock threshold
  • ๐ŸชŸ Liquid Glass UI โ€” iOS 26 native design, graceful fallback on iOS 16โ€“25
  • ๐Ÿ‡ช๐Ÿ‡บ European number formatting โ€” dot thousands separator, comma decimal separator

โš™๏ธ Requirements

๐Ÿ–ฅ๏ธ Server

  • Any machine that can run Docker (Synology NAS, Raspberry Pi, home server, VPS, etc.)
  • Docker + Docker Compose installed
  • A Bambu Lab printer on your local network (X1 / P1 / A1 series with LAN mode enabled)

๐Ÿ“ฑ iOS

  • iPhone running iOS 16.0 or later
  • A way to install unsigned IPAs: Signulous (recommended) or Sideloadly

๐Ÿš€ Setup

Step 1 โ€” ๐Ÿ–ฅ๏ธ Server

1. Clone the repo on your server

git clone https://github.com/PanSketo/PrintHub-iOS-app.git
cd PrintHub-iOS-app

2. Create your environment file

cp NAS-Backend/.env.example .env

Edit .env and fill in your values:

API_KEY=your_long_random_secret_key
PRINTER_IP=192.168.1.x
PRINTER_SERIAL=XXXXXXXXXXXXXXXX
PRINTER_ACCESS_CODE=XXXXXXXX
BASE_URL=http://your-server-ip:3456
Variable Description
API_KEY Any strong random string โ€” you'll enter this in the app
PRINTER_IP Your Bambu printer's local IP address
PRINTER_SERIAL Shown on the printer screen under Settings โ†’ Device
PRINTER_ACCESS_CODE Shown on the printer screen under Settings โ†’ Network
BASE_URL Your server's address (local IP or DDNS hostname)

3. Start the containers

sudo docker-compose up -d
sudo docker-compose logs --tail=20

A successful start shows:

๐Ÿ–จ๏ธ  PrintHub Backend running on port 3456
๐Ÿ“ Database: /data/filaments.db
๐Ÿ”‘ API Key configured: YES โœ…

4. Verify it's working

Open http://YOUR_SERVER_IP:3456/api/health in a browser โ€” it should return {"status":"ok",...}.

5. Remote access (optional)

Forward port 3456 on your router to your server's local IP. Use a DDNS hostname for a stable remote URL.


Step 2 โ€” ๐Ÿ“ฆ Build the iOS App

No Mac required โ€” use GitHub Actions (free).

  1. Fork this repo to your GitHub account
  2. Go to Actions โ†’ Build PrintHub IPA โ†’ Run workflow โ†’ Run workflow
  3. Wait ~10 minutes
  4. Download PrintHub.ipa from the Artifacts section when the build goes green โœ…

Step 3 โ€” ๐Ÿ“ฒ Install the App

Signulous (recommended โ€” no expiry, no re-signing)

  1. Upload the .ipa to signulous.com
  2. Install directly to your iPhone

Sideloadly (free, requires re-signing every 7 days with a free Apple ID)

  1. Download Sideloadly on your Mac or PC
  2. Connect your iPhone, drag the .ipa in, sign with your Apple ID
  3. On iPhone: Settings โ†’ General โ†’ VPN & Device Management โ†’ trust your Apple ID

Step 4 โ€” ๐Ÿ First Launch

  1. Open PrintHub on your iPhone
  2. Enter your Server URL and API Key when prompted
  3. Tap Test Connection โ†’ โœ…
  4. Tap Continue โ€” you're in!

To add more printers later: Settings โ†’ Printers โ†’ Add Printer


๐Ÿ”„ Updating the Server

cd /volume2/docker/filament-backend
git pull origin main
sudo docker-compose down && sudo docker-compose up -d

๐Ÿ› ๏ธ Troubleshooting

โŒ Cannot connect to server
  • Check the container is running: sudo docker-compose ps
  • Test locally first: http://YOUR_SERVER_IP:3456/api/health
  • Make sure port 3456 isn't blocked by a firewall
โŒ Print files tab shows an error
  • Verify PRINTER_IP and PRINTER_ACCESS_CODE in your .env
  • The printer must be powered on and on the same network as the server
  • LAN mode must be enabled on the printer
โŒ Timelapse list is empty
  • Timelapses only appear after the first timelapse is recorded
  • Enable timelapse recording in Bambu Studio or Bambu Handy before starting a print
โŒ GitHub Actions build fails
  • Check the Actions log for the specific error
  • Most common cause: Xcode version โ€” the workflow auto-selects the latest available
โŒ Barcode scanning not working
  • Go to iPhone Settings โ†’ PrintHub โ†’ Camera โ†’ Allow
โŒ No push notifications
  • Go to iPhone Settings โ†’ PrintHub โ†’ Notifications โ†’ Allow All

๐Ÿงฐ Tech Stack

Layer Technology
๐Ÿ“ฑ iOS app Swift + SwiftUI + AVKit + Photos + App Intents
๐Ÿ”ข Minimum iOS 16.0
๐Ÿ–ฅ๏ธ Backend Node.js + Express + SQLite (better-sqlite3)
๐Ÿ“ก Printer communication MQTT over TLS + implicit FTPS port 990
๐Ÿ” MQTT bridge Node.js Docker sidecar
๐Ÿ” Barcode lookup UPC Item DB + Open Food Facts
โš™๏ธ CI/CD GitHub Actions

๐Ÿ“ Project Structure

PrintHub-iOS-app/
โ”œโ”€โ”€ ๐Ÿ“ฑ iOS/
โ”‚   โ””โ”€โ”€ FilamentInventory/
โ”‚       โ”œโ”€โ”€ Models/          # Data models
โ”‚       โ”œโ”€โ”€ Services/        # NAS API client, inventory store, notifications
โ”‚       โ”œโ”€โ”€ Intents/         # Siri Shortcuts
โ”‚       โ”œโ”€โ”€ Extensions/      # Shared utilities (number formatting, etc.)
โ”‚       โ””โ”€โ”€ Views/           # All SwiftUI views
โ”œโ”€โ”€ ๐Ÿ–ฅ๏ธ NAS-Backend/
โ”‚   โ”œโ”€โ”€ server.js            # Express REST API + SQLite + FTP proxy
โ”‚   โ”œโ”€โ”€ docker-compose.yml   # Docker setup
โ”‚   โ”œโ”€โ”€ .env.example         # Environment variable template
โ”‚   โ””โ”€โ”€ mqtt-bridge/
โ”‚       โ””โ”€โ”€ bridge.js        # Bambu Lab MQTT โ†’ server bridge
โ””โ”€โ”€ โš™๏ธ .github/workflows/
    โ””โ”€โ”€ build-ipa.yml        # GitHub Actions IPA builder

๐Ÿ“„ License

MIT โ€” use it, fork it, adapt it for your own setup.


Built with โค๏ธ by Pantelis Tzelesis

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors