A complete step-by-step guide to setting up a Lavalink v4 audio node for your Discord music bot — from application.yml configuration to connecting with discord.js and Shoukaku.
Lavalink is a standalone audio server that handles audio downloading, encoding, and streaming for Discord bots. Instead of your bot process doing the heavy CPU work of decoding YouTube audio, Lavalink offloads this to a dedicated Java process. This means your bot stays lightweight and responsive, even when streaming music to dozens of voice channels simultaneously.
Before setting up Lavalink, you need:
Grab the latest Lavalink.jar from the official GitHub releases page. As of 2026, Lavalink v4 is the recommended version with improved plugin support and better memory management.
This is the most critical step. Create an application.yml file in the same directory as your Lavalink.jar:
yamlserver: port: 2333 address: 0.0.0.0 lavalink: plugins: - dependency: "dev.arbjerg.lavalink:youtube-plugin:1.11.3" repository: "https://maven.lavalink.dev/releases" server: password: "your_secure_password_here" sources: youtube: true bandcamp: true soundcloud: true twitch: true vimeo: true http: true local: false bufferDurationMs: 400 frameBufferDurationMs: 5000 opusEncodingQuality: 10 resamplingQuality: HIGH trackStuckThresholdMs: 10000 useSeekGhosting: true youtubePlaylistLoadLimit: 6 playerUpdateInterval: 5 youtubeSearchEnabled: true soundcloudSearchEnabled: true gc-warnings: true logging: level: root: INFO lavalink: INFO
Run the server with optimal JVM flags:
bashjava -Xmx1G -Xms512M -jar Lavalink.jar
You should see Lavalink is ready to accept connections in the console output.
Here's a minimal discord.js + Shoukaku setup:
javascriptconst { Client, GatewayIntentBits } = require('discord.js'); const { Shoukaku, Connectors } = require('shoukaku'); const nodes = [{ name: 'VisiHost Node', url: 'localhost:2333', auth: 'your_secure_password_here' }]; const client = new Client({ intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildVoiceStates] }); const shoukaku = new Shoukaku(new Connectors.DiscordJS(client), nodes); shoukaku.on('ready', (name) => console.log(`Node ${name} connected`));
Self-hosting on your PC means your music bot goes offline when you close your laptop. For 24/7 audio streaming, VisiHost's cheap Lavalink node hosting gives you enterprise AMD EPYC hardware with guaranteed uptime, low-latency network routing to Discord's voice servers, and pre-configured Java 17 environments — deploy in minutes, not hours.
Ready to get started? Start hosting your bot 24/7.
Explore related hosting tutorials, benchmarks, and deployment guides
High-performance infrastructure built for developers, bot creators, and server owners
24/7 no-sleep bot hosting with Pterodactyl panel, DDoS protection and Node.js/Python support.
Full-root cloud VPS with guaranteed resources, NVMe SSD and DDoS protection.
High-performance Minecraft Java & Bedrock servers with Pterodactyl panel.
High-speed managed MongoDB, PostgreSQL & MySQL databases with automated daily backups.
Managed Lavalink nodes for Discord music bots with ultra-low audio latency.
Run your Telegram bots 24/7 with low-latency servers and affordable INR plans.