CLI Commands
The Quarry CLI provides commands for scaffolding, developing, building, and generating types for your Inertia application. All commands are registered automatically when InertiaModule is imported in your application module.
Commands overview
Section titled “Commands overview”| Command | Description |
|---|---|
inertia:install | Scaffold the Inertia directory structure and starter files |
inertia:dev | Start the Vite development server with HMR |
inertia:build | Build client and SSR bundles for production |
inertia:types | Generate TypeScript types for page components |
inertia:install
Section titled “inertia:install”Scaffolds the Inertia directory structure and creates starter files so you can begin building immediately.
npx quarry inertia:installThis creates the following files:
| File | Purpose |
|---|---|
src/inertia/app.tsx | Client-side entry point |
src/inertia/ssr.tsx | Server-side rendering entry point |
src/inertia/root.html | Root HTML template |
src/inertia/pages/Home.tsx | Sample page component |
| Flag | Description |
|---|---|
--skip-deps | Skip installing npm dependencies. Use this if you want to manage dependencies yourself. |
inertia:dev
Section titled “inertia:dev”Starts the Vite development server with hot module replacement enabled. This is the recommended way to develop Inertia applications.
npx quarry inertia:dev| Flag | Default | Description |
|---|---|---|
--port | 5173 | Port for the Vite development server |
--host | — | Expose the server to your local network |
Example
Section titled “Example”npx quarry inertia:dev --port=3000 --hostinertia:build
Section titled “inertia:build”Builds the client bundle and optionally the SSR bundle for production deployment.
npx quarry inertia:build| Flag | Default | Description |
|---|---|---|
--outDir | dist | Output directory for the build |
--ssr | — | Also build the SSR bundle |
Example
Section titled “Example”Build both client and SSR bundles:
npx quarry inertia:build --ssrBuild to a custom output directory:
npx quarry inertia:build --outDir=buildinertia:types
Section titled “inertia:types”Generates TypeScript type definitions for your page components. It scans src/inertia/pages/ for React components and produces types for the InertiaPageRegistry, enabling type-safe rendering from your controllers.
npx quarry inertia:types| Flag | Description |
|---|---|
--watch | Regenerate types automatically when page files change |
Example
Section titled “Example”Run in watch mode during development:
npx quarry inertia:types --watch