A simple CLI tool to generate the minimal required files for a Progressive Web App (PWA).
- Generates all the required files for a minimal PWA:
manifest.json- Web app manifest with basic configurationindex.html- Simple HTML file with service worker registrationsw.js- Service worker for offline functionalityicon.png- Basic square icon with your chosen colour
- Customizable project name, icon colour, and platform support
- Interactive CLI interface
- Zero configuration - just run and answer prompts
To run the tool, use npx:
npx create-minimal-pwaTo install the tool globally:
npm install -g create-minimal-pwaThen run the tool:
create-minimal-pwaWhen you run the tool, you'll be prompted for:
- Project name - The name of your PWA
- Icon color - Color for the generated icon (hex code or color name)
- Platform support - Which platforms the icon should support (iOS, Android, Desktop)
The tool will then generate a directory with your project name containing all required PWA files.
Contains the basic metadata for your PWA:
{
"name": "Your PWA Name",
"short_name": "PWA Name",
"start_url": "/",
"display": "standalone",
"background_color": "#ffffff",
"theme_color": "#000000",
"icons": [
{
"src": "./icon.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "./icon.png",
"sizes": "512x512",
"type": "image/png"
}
]
}A simple HTML file with:
- Proper meta tags
- Manifest link
- Service worker registration
- Platform-specific meta tags (based on your selections)
A basic service worker that:
- Caches core application files
- Serves files from cache when offline
- Manages cache updates
A simple square icon in your chosen colour.
After generating the files:
cd your-project-name
npx serveThen open your browser to the displayed URL (usually http://localhost:3000).
To verify PWA functionality:
- Open Chrome DevTools
- Go to the "Application" tab
- Check the "Manifest" and "Service Workers" sections
- Node.js >= 18
- For the canvas dependency (used to generate the icon), you might need additional system libraries:
- Ubuntu/Debian:
sudo apt-get install build-essential libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev - macOS:
brew install pkg-config cairo pango libpng jpeg giflib librsvg - Windows: See the node-canvas wiki
- Ubuntu/Debian:
create-minimal-pwa/
├── bin/
│ └── index.js # Main executable entry point
├── src/
│ ├── cli.js # Command-line interface and user input handling
│ ├── generators/
│ │ ├── iconGenerator.js # Icon generation logic
│ │ ├── manifestGenerator.js # Manifest.json generation
│ │ ├── htmlGenerator.js # Index.html generation
│ │ └── serviceWorkerGenerator.js # Service worker generation
│ └── utils/
│ ├── fileSystem.js # File system operations
│ └── platformHelpers.js # Platform-specific helpers
├── package.json
└── README.md
- Progressive Web Apps - For inspiration and standards
- node-canvas - For icon generation
- inquirer - For the interactive CLI