forge
The forge crate is the command-line interface (CLI) for Forge. It provides commands for creating, developing, building, and distributing Forge applications.
Overview
The CLI is the primary entry point for Forge users. It handles:
- Development mode - Run apps with hot reload
- Production builds - Bundle assets for distribution
- Platform packaging - Create native installers
- Code signing - Sign packages for distribution
- Icon management - Validate and generate app icons
Getting Started
Copy an example to start a new project:
# Copy an examplecp -r examples/react-app my-appcd my-app
# Available examples# - examples/example-deno-app Minimal TypeScript# - examples/react-app React with TypeScript# - examples/nextjs-app Next.js-style patterns# - examples/svelte-app Svelte with TypeScriptCommands
forge dev
Run an app in development mode with hot reload:
forge dev <app-dir>Features:
- Live reload on file changes
- Development-friendly CSP settings
- Console output in terminal
forge build
Build web assets for production:
forge build <app-dir>Process:
- Detect framework (React, Vue, Svelte, Minimal)
- Bundle with esbuild via Deno
- Transform SFC files (Vue/Svelte)
- Output to
dist/directory
forge bundle
Create platform-specific distributable packages:
forge bundle <app-dir>Output formats:
- macOS:
.appbundle +.dmgdisk image - Windows:
.msixpackage - Linux:
.AppImageor.tar.gz
forge sign
Sign a bundled artifact for distribution:
forge sign [--identity <IDENTITY>] <artifact>Supports:
- macOS code signing with Developer ID
- Windows code signing with certificates
- Notarization for macOS
forge icon
Manage app icons:
forge icon create <path> # Create placeholder iconforge icon validate <app-dir> # Validate icon requirementsIcon requirements:
- Format: PNG with transparency (RGBA)
- Size: 1024x1024 pixels (minimum 512x512)
- Shape: Square (1:1 aspect ratio)
Key Types
Framework
Detected framework type for build configuration:
enum Framework { Minimal, React, Vue, Svelte,}File Structure
crates/forge/├── src/│ ├── main.rs # CLI entry point and commands│ └── bundler/ # Platform bundling logic│ ├── mod.rs # Bundler module│ ├── codesign.rs # Code signing│ └── icon.rs # Icon processing└── build.rs # Build scriptDependencies
| Dependency | Purpose |
|---|---|
anyhow | Error handling |
serde, toml | Manifest parsing |
image | Icon processing |
zip | MSIX package creation |
walkdir | Directory traversal |
which | Binary discovery |
dirs | User directories |
Related
- forge-host - Runtime binary launched by
forge dev - Getting Started - User guide for CLI usage