Lastly is a Next.js project that generates SVG images displaying music statistics from Last.fm. The project offers several API endpoints to fetch and visualize data like top artists, tracks, albums, and recent listening history for any given user.
The project provides the following API endpoints:
Endpoint | Description |
---|---|
/api/overall |
Fetches and visualizes overall statistics |
/api/top-artists |
Fetches and visualizes top artists |
/api/top-tracks |
Fetches and visualizes top tracks |
/api/top-albums |
Fetches and visualizes top albums |
/api/recent |
Fetches and visualizes recent tracks |
Endpoint:
/api/overall?username=ni5arga&period=overall
Preview:
Endpoint:
/api/top-artists?username=ni5arga
Preview:
Endpoint:
/api/top-tracks?username=ni5arga
Preview:
Endpoint:
/api/top-albums?username=ni5arga
Preview:
Endpoint:
/api/recent?username=ni5arga
Preview:
To embed these images in your GitHub README (or other markdown content):
- Use the following markdown syntax to display the overall statistics for a user.
![Overall Statistics](https://lastly.nisarga.me/api/overall?username=USERNAME&period=PERIOD)
Replace USERNAME
with your Last.fm username and PERIOD
with the desired period (see options below).
- Alternatively, you can use HTML for more control over formatting (e.g., centering the image):
<img src="https://lastly.nisarga.me/api/overall?username=USERNAME&period=PERIOD" alt="Overall Statistics" align="center">
username
: Your Last.fm username.period
: Can be set to:overall
: All-time statistics (default)7day
: Last 7 days1month
: Last month3month
: Last 3 months6month
: Last 6 months12month
: Last year
If period
is not specified, the default is overall
.
Follow the steps below to set up and run the project on your local machine:
-
Clone the repository:
git clone https://github.com/ni5arga/lastly.git cd lastly
-
Install dependencies:
npm install # or yarn install
-
Configure environment:
Create a
.env.local
file in the root directory and add your Last.fm API key.LASTFM_API_KEY=your_lastfm_api_key
-
Run the development server:
npm run dev # or yarn dev
Open http://localhost:3000 with your browser to view the project.
Deploy the project to Vercel using the button below. Make sure to set up your environment variable (LASTFM_API_KEY
) during the process.
This project is licensed under the MIT License - see the LICENSE file for details.