What Is Lavalink? A Beginner's Guide for Discord Music Bots
What Lavalink is, how it works with your Discord bot, why almost every serious music bot uses it, and the options for running a node — explained from scratch.
On this page
If you’ve looked into building a Discord music bot, you’ve run into Lavalink within minutes. Every tutorial mentions it, every library supports it, and most popular music bots depend on it. This guide explains what it is, how it fits alongside your bot, and how to get a node running.
Lavalink in one sentence
Lavalink is a standalone audio server that your Discord bot controls: it finds tracks, downloads and decodes audio, applies effects, and streams it to Discord voice channels, while your bot just tells it what to do.
Why music bots need it
Playing audio in Discord is surprisingly heavy work. For every server listening to music, something has to:
- Resolve a search or link into an actual audio stream.
- Download that stream and decode it.
- Apply volume, equalizer and effects.
- Encode it into Opus, the format Discord voice uses.
- Send a steady stream of packets to Discord’s voice server — about 50 per second — with no gaps.
If your bot does all of this itself, it spends most of its CPU and memory on audio. It stutters under load, and when it crashes or redeploys, every song in every server stops. Lavalink moves that work into a separate, purpose-built process. Your bot stays small and responsive; the audio node does the heavy lifting.
How it works
Lavalink is a Java application. You run it on a server, and your bot connects to it with a small client library.
Discord user → /play song → Your bot
│ "load this track, play it in guild X"
▼
Lavalink node ──► audio ──► Discord voice server
The pieces:
- Your bot handles slash commands, queues and settings. It forwards the voice connection details Discord gives it to Lavalink.
- Lavalink exposes a REST API (load tracks, control players) and a WebSocket (events like “track ended”). It connects to Discord’s voice servers directly and streams the audio.
- The client library — Shoukaku or lavalink-client for discord.js, Wavelink for discord.py, the Lavalink client for JDA — wraps that API so you write
player.play(track)instead of raw HTTP calls.
To connect, a client needs three things: the node’s host, port and password.
What Lavalink can do
- Sources. Out of the box, Lavalink handles sources like SoundCloud, Bandcamp, Twitch, Vimeo and direct HTTP streams. YouTube support now comes from a dedicated plugin — see the YouTube source plugin.
- Plugins. The plugin system adds sources and features: LavaSrc for Spotify, Apple Music and Deezer links, SponsorBlock for skipping sponsor segments, LavaSearch for richer search, and lyrics plugins.
- Filters. Equalizer, bass boost, nightcore (speed and pitch), 8D rotation, karaoke, tremolo, vibrato, low-pass and more — applied in real time. See Lavalink audio filters.
- Many players. One node can serve many guilds, and several bots or shards can connect to the same node.
- Resuming. Clients can resume a session after a brief disconnect, so a bot restart doesn’t have to end every song.
Lavalink v4
The current major version is Lavalink v4. Compared with v3, it uses a versioned REST API (/v4/...), a cleaner player model, and moves YouTube out of core into a plugin. It requires Java 17 or newer. If you’re starting today, use v4 with a client library that supports it — all the major ones do.
Your options for running a node
Public nodes
Free public nodes shared online look tempting, but they’re overloaded, often go offline, and give strangers control over your bot’s audio. They’re fine for five minutes of testing and a poor foundation for anything else. Why free public Lavalink nodes keep breaking your bot explains why.
Self-managed
Run Lavalink yourself on a VPS: install Java, download the JAR, write application.yml, add plugins and keep it running with systemd or Docker. You get full control over every setting. Kerit Cloud’s self-managed Lavalink plans give you root SSH on AMD EPYC with Ubuntu 22.04 and Java 17 pre-installed, from ₹49/month. The full walkthrough is in setting up Lavalink v4 from scratch.
Managed
Let someone else install, configure, update and monitor the node. You receive a host, port and password and plug them into your bot. Kerit Cloud’s managed Lavalink plans start at ₹59/month with LavaSrc and SponsorBlock pre-installed, higher tiers adding LavaSearch, lyrics and custom plugins, across 14 regions.
Managed vs self-managed Lavalink compares the two in detail.
How much does a node need?
Lavalink’s needs scale with the number of simultaneous players, not the number of servers your bot is in. As a rough guide, a small bot with a handful of concurrent players runs fine in 512 MB, while busy public bots with many players and a full plugin stack want 1–2 GB or more and several CPU cores. How much RAM does Lavalink need? goes into detail.
Where to put the node
Audio latency depends on the distance between the Lavalink node and the Discord voice server handling the call, which is chosen near the people in the channel. Put the node near your listeners: Mumbai or Delhi for Indian audiences, Frankfurt for Europe, a US region for North America. The bot itself can stay near Discord’s US East infrastructure. See choosing a Lavalink region.
A minimal mental model for your bot code
Whatever library you use, playback follows the same pattern:
- Connect the client to your node(s) when the bot starts.
- On
/play, join the user’s voice channel through the client. - Resolve the query — a URL or a search like
ytsearch:song name— into tracks. - Play a track, or add it to a queue.
- Listen for events such as “track ended” to play the next one.
- Leave the channel when the queue is empty or everyone’s gone.
Step-by-step code: discord.js with Shoukaku and discord.py with Wavelink.
A note on responsibility
Lavalink is a tool; what you stream with it is your responsibility as the bot’s operator. Respect the terms of the platforms you pull audio from and Discord’s developer policies.
Summary
Lavalink is a standalone Java audio server that your Discord bot controls through a client library. It resolves tracks, decodes and encodes audio, applies filters and streams to Discord voice, keeping your bot light and your music stable. Use Lavalink v4 on Java 17+, avoid public nodes for anything real, and choose between self-managed control and a managed node, placed near your listeners.