Discord Lanyard Activity

A headless, framework-agnostic Discord activity tracker using Lanyard API

Live Demo

Real-time Discord presence tracking powered by Lanyard API

Discord Activity

Connecting...

Loading Discord activity...

Features

  • Real-time presence updates
  • Music services integration
  • Game & app tracking
  • Auto-reconnection
  • Framework agnostic
  • TypeScript support

Framework Support

Works seamlessly with your favorite frameworks

React

Simple hooks for React 16.8+

Vue 3

Composables for Vue 3

Svelte

Native stores for Svelte

Vanilla JS

Pure JavaScript, no framework needed

Supported Activities

Track what matters to you

🎵

Music Services

Native Discord integration support for:

  • Spotify
  • YouTube Music
  • Apple Music
  • SoundCloud
  • Deezer
  • Tidal
  • Amazon Music
  • Pandora
🚀

Enhanced with PreMID

Track 2000+ services with rich presence!

  • 🎬 Netflix, YouTube, Twitch
  • 🎮 Steam, Epic Games, Xbox
  • 💻 VS Code, GitHub, GitLab
  • 🎨 Figma, Canva, Adobe
  • 📱 Twitter, Reddit, Discord
  • 🎧 All music web players
🎮

Games & Apps

Automatically tracked by Discord:

  • Steam games
  • Epic Games
  • League of Legends
  • Valorant
  • Minecraft
  • And 100+ more

💡 Why Use PreMID?

PreMID is a powerful browser extension and desktop app that displays rich presence for thousands of websites and services on Discord. When combined with this package, you get:

Track activities from 2000+ websites
Rich presence with thumbnails & details
Automatic Lanyard API integration
Real-time updates on your website

Setup is easy: Install extension + desktop app → Browse supported services → Your activity appears automatically! All data flows through Lanyard and works with this package out of the box.

Installation & Setup

Get started in minutes with your favorite framework

1. Install the Package

# Using npm
npm install discord-lanyard-activity

# Using yarn
yarn add discord-lanyard-activity

# Using pnpm
pnpm add discord-lanyard-activity

# Using bun
bun add discord-lanyard-activity

2. Get Your Discord User ID

1

Enable Developer Mode

Go to Discord Settings → Advanced → Enable Developer Mode

2

Copy Your User ID

Right-click your profile → Copy User ID

3

Join Lanyard Discord

Join the Lanyard Discord server to enable tracking

3. Implement in Your Project

Choose your framework and follow the example below

import { useDiscordActivity } from 'discord-lanyard-activity/react';

function App() {
  const { data, isLoading, error } = useDiscordActivity({
    userId: 'YOUR_DISCORD_USER_ID',
  });

  if (isLoading) return <div>Loading...</div>;
  if (error) return <div>Error: {error.message}</div>;

  return (
    <div>
      <h2>{data.discord_user.username}</h2>
      <p>Status: {data.discord_status}</p>
    </div>
  );
}
<script setup>
import { useDiscordActivity } from 'discord-lanyard-activity/vue';

const { data, isLoading, error } = useDiscordActivity({
  userId: 'YOUR_DISCORD_USER_ID',
});
</script>

<template>
  <div v-if="isLoading">Loading...</div>
  <div v-else-if="error">Error: {{ error.message }}</div>
  <div v-else>
    <h2>{{ data.discord_user.username }}</h2>
    <p>Status: {{ data.discord_status }}</p>
  </div>
</template>
<script>
  import { useDiscordActivity } from 'discord-lanyard-activity/svelte';
  
  const activity = useDiscordActivity({
    userId: 'YOUR_DISCORD_USER_ID',
  });
</script>

{#if $activity.isLoading}
  <div>Loading...</div>
{:else if $activity.error}
  <div>Error: {$activity.error.message}</div>
{:else if $activity.data}
  <h2>{$activity.data.discord_user.username}</h2>
  <p>Status: {$activity.data.discord_status}</p>
{/if}
import { DiscordActivityClient } from 'discord-lanyard-activity';

const client = new DiscordActivityClient({
  userId: 'YOUR_DISCORD_USER_ID',
});

client.subscribe((state) => {
  if (state.data) {
    console.log('Username:', state.data.discord_user.username);
    console.log('Status:', state.data.discord_status);
  }
});

client.connect();