What is Lavalink, and how do you connect it to a music bot?
What a Lavalink node does for a Discord music bot, when you need one, and how to connect your bot to a node with its address, port and password.
3 min read
Lavalink is a separate program that handles audio for Discord music bots. Your bot tells it what to play; Lavalink finds the track, decodes it and sends the sound to the voice channel.
Why music bots use it
Playing audio is heavy work. A bot that decodes and streams music by itself uses a lot of processor and memory, and it starts to stutter as soon as a few servers play at once.
With Lavalink, that work moves off the bot. The bot stays small and quick at answering commands, and the node does the lifting. One node can play in many servers at the same time, and a large bot can spread the load over several nodes.
Do you need your own node?
Public nodes exist, and they are handy for a test. They are shared with strangers, so they go offline without warning and slow down when busy. If people depend on your music bot, a node of your own is what keeps it steady: you decide its settings, its plugins and when it restarts.
What you need to connect
Every Lavalink client asks for the same three things:
- Address: where the node is.
- Port: Lavalink listens on
2333unless you change it. - Password: set in the node's
application.yml.
Most clients also ask whether the connection is secure. For a node reached by address and port, that is usually false.
Connecting your bot
- Pick a client library for your language. Lavalink v4 works with clients such as Shoukaku and Lavalink-Client for JavaScript, Wavelink and Lavalink.py for Python, and Lavalink4NET for .NET.
- Give the client the node's address, port and password.
- Start the bot. A line like "node connected" in its log means the two are talking.
The node block in a typical client looks like this:
host: your.node.address
port: 2333
password: your-own-password
secure: falseChange the password first
A new Lavalink node starts with a default password that everyone knows. Before you connect anything:
- Open
application.ymlin the node's files. - Find
passwordunderlavalinkand thenserver. - Set a long password of your own.
- Restart the node.
Then use that password in your bot. Anyone with the address and the default password could otherwise use your node.
Sources and plugins
Lavalink v4 loads audio through sources and plugins that you list in application.yml. Plugins add things like extra sources and search providers. After you change the file, restart the node for it to take effect. Add one plugin at a time and check the console after each restart, so you know which change caused a problem if one appears.
Sizing a node
Go by how many servers will play music at the same moment, not by how many servers the bot is in. A small bot with a few players at once needs little. A bot playing in dozens of servers together needs more memory and cores.
A node on Mavelo
Each Lavalink hosting plan is a node of your own in India, with a console, a file manager for application.yml and power controls in the Mavelo panel. Your node's address and port are shown in your portal once it is ready. If your bot itself needs a home too, see how to host a Discord bot 24/7.

