This guide covers all configuration options available in LiveVue, from basic setup to advanced customization.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Valian/live_vue/llms.txt
Use this file to discover all available pages before exploring further.
Application configuration
LiveVue configuration is managed in yourconfig/config.exs file:
Environment-specific configuration
- Development
- Production
- Test
Recommended development configuration:
config/dev.exs
Vue application setup
Configure your Vue application inassets/vue/index.js. You should use createLiveVue to provide two required functions:
| Option | Type | Description |
|---|---|---|
resolve | (name: string) => Component | Promise<Component> | Component resolution function |
setup | (context: SetupContext) => VueApp | Vue app setup function |
Basic configuration
assets/vue/index.js
SetupContext
SetupContext is an object passed to the setup function:| Property | Type | Description |
|---|---|---|
createApp | Function | Vue’s createApp or createSSRApp |
component | Component | The Vue component to render |
props | object | Props passed from LiveView |
slots | object | Slots passed from LiveView |
plugin | Plugin | LiveVue plugin (required) |
el | HTMLElement | Mount target element |
ssr | boolean | Whether this is SSR context |
Component resolution options
- Eager loading
- Lazy loading
- Custom logic
All components are bundled with the main application (default):
Vue app customization
Add plugins, stores, and other Vue features:Component organization
Directory structure
By default, Vue components are resolved from:assets/vue/- Main Vue components directorylib/my_app_web/- Colocated with LiveView files
Custom Vue root directories
Configure component discovery paths in your LiveView module:lib/my_app_web.ex
Component naming conventions
Components are resolved by name or path suffix:Counter.vue→ accessible as"Counter"path/to/Component.vue→ accessible as"path/to/Component"or"Component"path/to/component/index.vue→ accessible as"path/to/component"or"component"
Server-side rendering (SSR)
LiveVue provides flexible SSR options that work great in both development and production environments.SSR modules
LiveVue offers two SSR strategies depending on your environment:- ViteJS (Development)
- NodeJS (Production)
Perfect for development with hot module replacement:Uses Vite’s
config/dev.exs
ssrLoadModule for efficient development compilation with instant updates.SSR configuration
Control SSR behavior globally or per-component:config/config.exs
SSR behavior
SSR is intelligently applied:- Runs during: Initial page loads (dead renders)
- Skips during: Live navigation and WebSocket updates
- Can be disabled: Per-component with
v-ssr={false}
What are “dead renders”?A “dead render” occurs when the page is loaded without an active WebSocket connection - this includes the initial HTTP request before LiveView connects. During this phase, SSR renders the Vue component to HTML on the server so users see content immediately.Once the WebSocket connects (making the view “live”), SSR is skipped because Vue components are already mounted and hydrated client-side.
Per-component SSR control
Override global settings for specific components:Production SSR setup
For production deployments, you’ll need Node.js 19+ and proper configuration:SSR troubleshooting
SSR not working in development?
SSR not working in development?
- Check that Vite dev server is running on the configured port
- Verify
vite_hostmatches your Vite server URL
SSR failing in production?
SSR failing in production?
- Ensure Node.js 19+ is installed
- Check that
priv/static/server.mjsexists after build - Verify NodeJS supervisor is properly configured
Performance issues?
Performance issues?
- Consider adjusting the NodeJS pool size based on your server capacity
- Disable SSR for components that don’t benefit from it
Testing configuration
LiveVue provides testing-specific configuration options.enable_props_diff
By default, LiveVue optimizes performance by only sending prop changes (diffs) to the client. During testing, you may need access to the complete props state:config/test.exs
- LiveVue will always send full props and not send diffs
- The
propsfield returned byLiveVue.Test.get_vue/2will contain the complete props state - This makes it easier to write comprehensive tests that verify the full component state
This option is primarily intended for testing scenarios. In production, the default behavior (sending only diffs) provides better performance.
Deprecated features
Shared props (removed)
Next steps
- Basic usage for fundamental patterns
- Forms for complex forms with server-side validation