Skip to main content
The kit serve command starts both the backend Rust server and the frontend Vite development server with hot-reload support.

Usage

Options

Examples

Start Both Servers

Starts:
  • Backend server on http://localhost:8000
  • Frontend Vite server on http://localhost:5173
  • Watches for changes and auto-rebuilds
  • Generates TypeScript types from Rust structs

Custom Ports

Backend Only

Useful when:
  • Working on API-only features
  • Frontend is deployed separately
  • Running in production mode

Frontend Only

Useful when:
  • Backend is running elsewhere
  • Testing frontend in isolation

Skip Type Generation

Skips the automatic TypeScript type generation from Rust InertiaProps structs. Useful if you’re managing types manually.

How It Works

When you run kit serve, the CLI:
  1. Builds the Rust backend - Compiles your application in debug mode
  2. Generates TypeScript types - Scans for InertiaProps structs and generates corresponding TypeScript interfaces
  3. Starts the backend server - Runs your Rust application with hot-reload using cargo watch
  4. Starts the frontend server - Runs Vite development server with HMR (Hot Module Replacement)

Development Workflow

Environment Variables

The serve command respects environment variables from .env:

Troubleshooting

Port Already in Use

If you see a port conflict error:

Frontend Not Connecting

Ensure your frontend is configured to proxy to the correct backend port in vite.config.ts.