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.
Launch your high-performance Minecraft or VPS server in India with 20.0 steady TPS, NVMe SSD storage, and instant UPI activation.
Dedicated Lavalink hosting for Discord music bots with clean routing and instant setup.