> For the complete documentation index, see [llms.txt](https://ferralink.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ferralink.gitbook.io/docs/getting-started.md).

# Getting Started

### 1. Declaring FerraLink

```javascript
const { FerraLink } = require("ferra-link");
```

### 2. Defining your Nodes

{% hint style="info" %}

1. This step depends if you have any hosting to get your lavalink server.
2. You can get your password from `application.yml.`
   {% endhint %}

```javascript
const nodes = [{
name: "Node",
url: "localhost:2333",
auth: "youshallpass",
secure: false
}];
```

### 3. Set the Initilizer of Ferralink

{% hint style="info" %}
*Creating in a way like the code example you can import the bot and nodes.*
{% endhint %}

```javascript
client.FerraLink = new FerraLink(client, nodes, {
spotify: {
 playlistLimit: "Playlist search limit here", //default limit is 5 = 500.
 albumLimit: "Album search limit here", //default limit is 5 = 500.
 artistLimit: "Artist search limit here", //default limit is 5 = 500.
 searchMarket: "searchMarket(ISO code) here", //default searchMarket is US.
 clientID: "Your spotify clientId here",
 clientSecret: "Your spotify clientSecret here"
}
});
```

### 4. A small example to create play command.

```javascript
const player = await client.FerraLink.createPlayer({
guildId: message.guild.id,
voiceId: message.member.voice.channel.id,
textId: message.channel.id,
shardId: message.guild.shardId,
volume: 100,
deaf: true,
});

const resolve = await client.FerraLink.search(queue, { engine: "spsearch" }); // spsearch is work for search spotify tracks.
const { loadType, tracks, playlistInfo } = resolve;

if (loadType === "NO_MATCHES" || !tracks.length) return;

if (loadType === "PLAYLIST_LOADED") {
for (const track of tracks) {
player.queue.add(track);
}
if (!player.queue.current && !player.paused) await player.play();
message.channel.send({content: `Added ${player.queue.length} tracks from ${playlistInfo.name}`});
} else if (loadType === "SEARCH_RESULT" || loadType === "TRACK_LOADED") {
player.queue.add(tracks[0]);
if (!player.queue.current && !player.paused) await player.play();
message.channel.send({content: `Queued ${tracks[0].info.title}`});
} else return;
```
