nanoshell
v1.9.7
Published
Hyper-lightweight native multi-platform (Windows & Android) application framework. 17MB RAM, 120 FPS, Win32 & Android System WebView. No Electron. Created by Suman Biswas.
Maintainers
Readme
NanoShell ⚡ ([email protected])
Created & Engineered by Suman Biswas 👑
Hyper-lightweight Native Multi-Platform (Windows & Android) Application Framework & Runtime Engine
NanoShell is a hyper-lightweight, browser-free, open-source native multi-platform application framework & runtime engine designed for building ultra-fast desktop (.exe) and mobile (.apk) applications with standard HTML, CSS, and Vanilla JavaScript.
🚀 Performance Highlights
- Physical RAM Footprint: 17.0 MB (Windows) / ~25 MB (Android) (vs. 500 MB – 1.2 GB in Electron / React Native)
- Cold Boot Time: < 0.8 ms (Instant Snapshot Thaw)
- Frame Rate: 120 FPS Locked Hardware GPU Direct Rendering
- Executable / APK Size: ~850 KB (.exe) / ~1.5 MB (.apk) Native Binary (No embedded Chromium browser)
- Zero-Copy IPC: Direct native execution across Zig, Win32, and Android C-ABI
- Single Skillset: Build for Windows & Android using 100% standard HTML, CSS, and JS with zero hand-written C++ or Kotlin!
🚀 Quick Start Guides
🪟 1. Windows Quick Start (Desktop)
# Scaffold a new project (Select Windows Desktop)
npm create nanoshell my-desktop-app
cd my-desktop-app
# Run Development Mode (In-Window Hot Reloading on Ctrl+S)
npm start
# Build Standalone Windows Binary (.exe)
npm run build
# Package Windows Setup Installer (.exe via Inno Setup)
npm run package📱 2. Android Quick Start (Mobile)
# Scaffold a new project (Select Android Mobile)
npm create nanoshell my-mobile-app
cd my-mobile-app
# 1-Command Auto-Deploy Live to Connected USB Phone / Emulator
npm run dev:android
# Build Standalone Android Production Package (.apk)
npm run build:android🆕 What's New in v1.9.0
📱 Full Native Android Multi-Platform Support (.apk)
- Single Unified Codebase: Build both Windows
.exeand Android.apkfrom the exact same HTML, CSS, and JS code insrc/. - 1.5 MB APK Footprint: Uses Android's built-in System WebView for zero engine bloat.
⚡ 1-Command Auto-Deploy (npm run dev:android)
- Auto-Detect, Build & Launch: Auto-detects connected USB phones or emulators via ADB, compiles the APK, installs it, and launches it live on your screen in 15 seconds!
🎨 Out-of-the-Box Android Native JS API (window.NanoShell)
- Status & Nav Bar:
NanoShell.statusBar.setColor(),setStyle('light'|'dark'),NanoShell.navigationBar.setColor(). - Biometrics:
NanoShell.biometrics.authenticate()via nativeBiometricPrompt. - Downloads Manager:
NanoShell.downloads.start()with progress notifications. - Haptics & Toast:
NanoShell.mobile.vibrate(),NanoShell.mobile.toast(). - Home Screen Widgets:
NanoShell.widget.update(data)& click action listeners. - MediaSession & PiP:
NanoShell.mediaSession.setMetadata(),NanoShell.pip.enter().
🛠️ Platform Management CLI (nanoshell add / remove)
nanoshell add android/nanoshell add windows: Add target platform support anytime with 1.5MB/43MB isolated packages.nanoshell remove <platform>: Remove platforms with duplicate and single-platform floor guards.
⚡ Direct Native Execution Flags (--build, --package)
- Zero
npx& Zero GUI Opening during Build/Package: Runningnpm run packageornpm run builddirectly executes native flags on the portable app binary.--packagebuilds the Inno Setup installer directly without launching the GUI window.
📦 Auto-Generated package.json for Scaffolded Apps
- Seamless
npm start&npm run package: Newly scaffolded projects automatically include a standardpackage.jsonpreconfigured withnpm start,npm run build, andnpm run packagescripts out of the box.
🌟 Seamless npm create nanoshell & Interactive Prompt
- Word-for-Word Scaffolding: Published
create-nanoshellpackage sonpm create nanoshellworks natively without 404 errors or stalenpxcache issues. - Interactive Scaffolding: Running
npm create nanoshellwithout arguments interactively prompts for the project name.
🪟 Pure Native Win32 Windowing & Full API Control
- Zero Windowing Wrappers: Fully excised AppCore window wrappers to give direct, un-sandboxed
HWNDcontrol to native Zig code. - Instant Window Operations: Native
ShowWindow,SetWindowPos, and window manipulation calls execute in< 0.1mswithout AppCore state collisions or crashes.
🖥️ Per-Monitor DPI V2 & High-DPI Crisp Rendering
- Per-Monitor DPI V2 Support: Integrated
DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2across all Windows displays. - Dynamic
WM_DPICHANGEDHandling: Automatically resizes physical canvas, recalculates client metrics, and scales WebKit view when moving windows across multi-monitor setups with different scaling (100%, 125%, 150%, 200%). - Pixel-Accurate Hit-Testing: Mouse input coordinates
(x, y)are dynamically converted from Windows physical pixels to WebKit logical CSS coordinates (toLogical = physical / dpi_scale). Clicks, hovers, and drags land pixel-perfectly on DOM elements at any DPI. - High-Quality GDI Halftone Blitting:
SetStretchBltMode(HALFTONE)ensures razor-sharp text and graphics rendering.
📦 Automatic Out-of-the-Box Windows Installer (npm run package)
- Generate full-featured Windows Setup installers (
.exe) with one single command:npm run package - Inno Setup Integration: Auto-detects local or system Inno Setup (
ISCC.exe), generatessetup.iss, and builds single-file installers indist/with Start Menu, Desktop shortcuts, and Control Panel Uninstaller support.
⚡ Auto-Updating NPX Cache Detection
- No More Stale
npxCaches:npx nanoshellautomatically checks for the latest registry release. If a stale localnpxcache is detected, it auto-updates to@latestseamlessly.
📖 Master JavaScript API Reference (window.NanoShell)
🌐 1. Common Cross-Platform APIs (Windows & Android)
These core APIs work 100% identically across both Windows (.exe) and Android (.apk):
📁 File System (NanoShell.fs)
NanoShell.fs.readFile(path): Read text file contents.NanoShell.fs.writeFile(path, content): Write text file to disk.NanoShell.fs.exists(path): Check file/directory existence.NanoShell.fs.readDir(path): List directory folder contents.NanoShell.fs.mkdir(path): Create directory folder.NanoShell.fs.remove(path): Delete file or directory.
📋 System Clipboard (NanoShell.clipboard)
NanoShell.clipboard.writeText(text): Copy text string to system clipboard.NanoShell.clipboard.readText(): Paste text from system clipboard.
💬 OS Dialogs & Alerts (NanoShell.dialog)
NanoShell.dialog.showOpen(): Native Open File Picker.NanoShell.dialog.showSave(): Native Save File Picker.NanoShell.dialog.showMessage(title, message): Native OS Alert message box.
🔔 System Notifications (NanoShell.sys / NanoShell.notification)
NanoShell.sys.notify({ title, body, icon }): Native system notification drawer alert.
🌐 Networking & Sockets (NanoShell.net)
NanoShell.net.fetch(url, options): Fast native HTTP/HTTPS request engine.
🪟 2. Windows-Only Desktop APIs
Specific to Windows desktop window management and Win32 OS subsystems:
🪟 Window & Screen Controls (NanoShell.window & NanoShell.screen)
NanoShell.window.minimize(),maximize(),restore(),close(),center(),setTitle().NanoShell.window.minimizeToTray(): Minimize window to Windows system tray.NanoShell.window.setAlwaysOnTop(bool): Pin window above all desktop applications.NanoShell.screen.getMonitors(): List connected monitors, resolutions, and refresh rates.NanoShell.screen.getCursorPosition(): Global desktop mouse coordinates(x, y).
⚙️ Shell & Execution (NanoShell.shell & NanoShell.process)
NanoShell.shell.openExternal(urlOrPath): Open URL or file in default Windows app.NanoShell.shell.exec(command): Execute CLI command (PowerShell / CMD).NanoShell.process.list(): Windows Task Manager active process list.
⚡ Shared Memory (NanoShell.shm & NanoShell.snapshot)
NanoShell.shm.createRegion(name, size): Zero-copy C RAM allocation (< 0.01ms IPC).NanoShell.snapshot.thawState(): < 1ms instant cold-start thaw engine.
📱 3. Android-Only Mobile APIs (NanoShell.mobile.*)
Specific to Android mobile hardware, System UI insets, sensors, and OS services:
🎨 System UI, Status Bar & Navigation Bar Controls
NanoShell.statusBar.setColor(hexColor): Dynamically set top status bar color (e.g.#1a1a1a).NanoShell.statusBar.setStyle('light' | 'dark'): Toggle top battery/clock icon text theme.NanoShell.statusBar.hide() / show(): Hide or reveal top status bar.NanoShell.navigationBar.setColor(hexColor): Set bottom navigation bar background color.NanoShell.navigationBar.hide() / show(): Hide or reveal bottom gesture/nav bar.NanoShell.window.setFullScreen(bool): Immersive fullscreen mode.NanoShell.screen.setBrightness(0.0 - 1.0): Dynamically control screen brightness level.
🔐 Biometric Authentication (Fingerprint & Face ID)
NanoShell.biometrics.isAvailable(): Returns{ supported: true, type: 'fingerprint'|'face' }.NanoShell.biometrics.authenticate({ title, reason }): Triggers Android nativeBiometricPrompt.
📥 Native Downloads Manager
NanoShell.downloads.start({ url, filename }): Enqueues download in AndroidDownloadManagerwith notification progress bar.
📳 Haptics, Toasts & Audio Streams
NanoShell.mobile.vibrate(durationMs): Trigger haptic feedback vibration.NanoShell.mobile.toast(message, 'short'|'long'): Native Android Toast popup.NanoShell.audio.setVolume({ stream: 'media'|'ring', level: 0-100 }): Adjust device volume streams.
🧩 Home Screen App Widgets
NanoShell.widget.update({ widgetId, title, subtitle, progress }): Update live home screen widgets from JS.NanoShell.widget.onAction(callback): Handle home screen widget button taps.
🎵 MediaSession & Picture-in-Picture (PiP)
NanoShell.mediaSession.setMetadata({ title, artist, album, coverUrl }): Lockscreen & notification media controls.NanoShell.pip.enter(): Trigger Picture-in-Picture video mode.
📲 Native Sharing & Device Info
NanoShell.mobile.share({ title, text, url }): Trigger native Android system share sheet.NanoShell.mobile.getBatteryInfo(): Returns{ level: 85, isCharging: true }.NanoShell.mobile.scanQrCode(): Triggers instant native camera QR/Barcode scanner.
📦 100% Portable Bundle
Every scaffolded NanoShell app includes portable Visual C++ runtime DLLs (vcruntime140.dll, msvcp140.dll, vcruntime140_1.dll) and is compiled against x86_64-windows-gnu baseline CPU targets — ensuring 100% portable execution on any Windows laptop without admin rights or external installers.
📁 Project Structure
my-awesome-app/
├── app/
│ ├── index.html <-- Standard HTML markup
│ ├── styles.css <-- Standard CSS (Flexbox, Grid, Glassmorphism)
│ └── app.js <-- Application JavaScript logic
├── nanoshell.json <-- App manifest & FPS overlay configuration
├── resources/
│ ├── icudt67l.dat <-- Unicode ICU data
│ └── cacert.pem <-- SSL certificates
└── dist/
├── MyAwesomeApp.exe <-- Standalone Executable
└── MyAwesomeApp-Setup.exe <-- Windows Setup Installer📊 Real-Time FPS Overlay Control (nanoshell.json)
You can control real-time FPS overlay rendering directly inside your app's nanoshell.json manifest:
{
"name": "My Awesome App",
"version": "1.0.0",
"exe_name": "my_app.exe",
"show_fps": true,
"window": {
"width": 1280,
"height": 720
}
}🤖 AI Agent Integration
NanoShell includes a built-in AI Agent Skill definition (SKILL.md). Any AI coding assistant (Antigravity, Claude, Copilot, ChatGPT) can read SKILL.md to scaffold, style, and build NanoShell desktop applications automatically.
📄 Creator & License
Created & Engineered by Suman Biswas
MIT License © Suman Biswas (NanoShell Creator)
