kit serve command starts both the backend Rust server and the frontend Vite development server with hot-reload support.
Usage
Options
| Option | Default | Description |
|---|---|---|
-p, --port <PORT> | 8000 | Backend server port |
--frontend-port <PORT> | 5173 | Frontend Vite server port |
--backend-only | false | Only start the backend server |
--frontend-only | false | Only start the frontend server |
--skip-types | false | Skip TypeScript type generation |
Examples
Start Both Servers
- 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
- Working on API-only features
- Frontend is deployed separately
- Running in production mode
Frontend Only
- Backend is running elsewhere
- Testing frontend in isolation
Skip Type Generation
InertiaProps structs. Useful if you’re managing types manually.
How It Works
When you runkit serve, the CLI:
- Builds the Rust backend - Compiles your application in debug mode
- Generates TypeScript types - Scans for
InertiaPropsstructs and generates corresponding TypeScript interfaces - Starts the backend server - Runs your Rust application with hot-reload using
cargo watch - 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 invite.config.ts.