Guide · Vite
Share a Vite app from localhost
1. Start Vite
$ npm run devVite listens on port 5173, or the next free port if that one is busy. Use the port it prints.
2. Share the port
$ npx localians share 5173Approve this computer in your browser the first time; after that the command prints your HTTPS preview link straight away. Keep it running while you share and press Ctrl+C to stop.
Why it works without changes
- Host checks: Vite only answers requests for hosts it trusts. Localians forwards requests as
localhost:5173, which Vite always trusts. - Hot reload: Vite's HMR runs over a WebSocket, and preview links carry WebSockets, so edits reach your viewers live.
When you need server.allowedHosts
If your app needs to see the public address — for example it builds absolute links from the request — share with --host-header preserve and allow Localians preview domains in vite.config:
$ server: { allowedHosts: [".preview.localians.com"] }A leading dot allows every preview subdomain.
Demo a production build
For a client walkthrough, a production build is faster and closer to what you'll ship:
$ npm run build$ npx vite preview$ npx localians share 4173Protect client work with a password (how it works). Using Next.js instead? See sharing a Next.js app.
Questions
Do I need to change vite.config?
No, not by default. Localians sends requests to Vite as localhost:5173, which Vite always allows. You only add the preview domain to server.allowedHosts if you share with --host-header preserve.
Does hot module replacement work for viewers?
Yes. Vite's HMR connection is a WebSocket, and Localians forwards WebSockets, so viewers see your edits as you save.
Vite started on 5174 instead of 5173. Which port do I share?
Always the port Vite prints. It moves to the next free port when 5173 is busy, for example because another project is running.
Can I share a production build?
Yes. Run vite build and vite preview, then share the port vite preview prints (4173 by default). It loads faster for clients than the dev server.
Share your first preview in about a minute.
Free to start with a 24-hour preview per project. No credit card, nothing to deploy.