# Introduction

# JioSaavn API

# A wrapper for JioSaavn API in Typescript Rust programming language 🦀.


# Features

  • 🚀 Ultrafast - Powered by Hono.js.The router RegExpRouter is really fast.
  • 🪶 Lightweight - Has minimal dependencies.
  • 🌍 Multi-runtime - Works on Bun, Node.js, Vercel or Cloudflare Workers. The same code runs on all platforms.
  • 🔥 Download High Quality Songs, w/ lyrics for supported songs.
  • 🎵 Get Songs, Albums, Playlists, Artists, Radio Stations, Podcasts Lyrics, Recommendations, and more.
  • ❤️ Open Source
  • 🚀 Ultrafast - Powered by Axum Web Framework
  • 🪶 Lightweight - Has minimal dependencies.
  • 🌍 Multi-platform - Supports Vercel (using community based Rust Runtime) Docker, Render, Shuttle.rs or Fly.io and more.
  • 🔥 Download High Quality Songs, w/ lyrics for supported songs.
  • 🎵 Get Songs, Albums, Playlists, Artists, Radio Stations, Podcasts Lyrics, Recommendations, and more.
  • ❤️ Open Source

# 🛠️ Local Development

  • Clone the repository
git clone https://github.com/rajput-hemant/jiosaavn-api-ts
cd jiosaavn-api-ts
  • Install dependencies

# Bun

bun i || pnpm i || yarn || npm i
bun run dev || pnpm dev || yarn dev || npm run dev

# Node.js

bun run dev:node || pnpm dev:node || yarn dev:node || npm run dev:node

# Vercel Dev Server

bun run dev:vercel || pnpm dev:vercel || yarn dev:vercel || npm run dev:vercel

# Cloudflare Workers

src/index.ts

...

-  port: +(process.env.PORT ?? 3000),
+ port: 3000, # update accordingly

...

src/lib/config.ts

...

-  enableRateLimit: process.env.ENABLE_RATE_LIMIT === "true" ?? false,
+  enableRateLimit: false, # update accordingly
...
bun run dev:vercel || pnpm dev:cf || npm run dev:cf || yarn dev:cf
  • Rust should be installed on your system. If not, then install it from here.
git clone https://github.com/rajput-hemant/jiosaavn-api-rs
cd jiosaavn-api-rs
  • Run the following command to build the project.
cargo build --release
  • Run the following command to launch the api server.
cargo run --release

# ☁️ Deploying your own instance

# One Click Deploy

You can easily deploy your own hosted version of the JioSaavn API by clicking on one of the links below, which will set up a ready-to-go version for you:

Deploy with Vercel
Deploy with Vercel
Deploy with Cloudflare Workers
Deploy with Cloudflare Workers

OR

# Deploying using CLI

# Vercel

  • It utilizes Edge Functions and can automatically execute in the region nearest to the user who triggers them.
  • It's worth noting that Mumbai, India (South) - bom1 is the recommended region for this project deployment.
bun run deploy:vercel || pnpm deploy:vercel || npm run deploy:vercel || yarn deploy:vercel

# Cloudfare Workers

bun run deploy:cf || pnpm deploy:cf || npm run deploy:cf || yarn deploy:cf

# Build and Run Docker Image

# Docker Compose (Recommended)

  • Start the container
docker-compose up -d # detached mode
  • Stop the container
docker-compose stop # stops the container
docker-compose down # stops and removes the container

# Docker

  • Start Docker daemon (Skip if already running)
sudo dockerd
  • Build the image
docker build -t jiosaavn .
  • Run the image
docker run -p 80:3000 jiosaavn
  • Open http://localhost to view it in the browser.

  • Stop the container

docker ps
docker stop <container-id>

# One Click Deploy

Deploy with Vercel
Deploy with Vercel
Deploy to Render
Deploy to Render

Login to your Render account and create a new 🌐 Web Service.

Fill in the details, choose Runtime as Rust and click on Create Web Service.


# Build and Run Docker Image

# Docker Compose (Recommended)

  • Start the container
docker-compose up -d # detached mode
  • Stop the container
docker-compose stop # stops the container
docker-compose down # stops and removes the container

# Docker

  • Start Docker daemon (Skip if already running)
sudo dockerd
  • Build the image
docker build -t jiosaavn .
  • Run the image
docker run -p 8080:8080 jiosaavn
  • Stop the container
docker ps
docker stop <container-id>

# Shuttle.rs

cargo install cargo-shuttle
  • Add the following crates for shuttle to work
cargo add shuttle-runtime shuttle-axum
  • Make sure to change the main.rs file to the following:
main.rs
// #[tokio::main]
// async fn main() {
#[shuttle_runtime::main]
async fn axum() -> shuttle_axum::ShuttleAxum {
    // tracing_subscriber::fmt::init();

    ...

    // let addr = "[::]:8080".parse().unwrap();

    // tracing::debug!("🚀 Server listening on {}", addr);
    // axum::Server::bind(&addr)
    //     .serve(app.into_make_service())
    //     .await
    //     .unwrap();

    Ok(router.into())
}
cargo shuttle project start
cargo shuttle deploy --allow-dirty

# Fly.io

curl -L https://fly.io/install.sh | sh
  • A fly.toml file will be automatically generated by fly launch command which will ask a few questions to set everything up.
fly launch --name jiosaavn
  • Deploy the app
fly deploy

# 📜 License

This project is licensed under the MIT License - see the LICENSE file for details.

# 🦾 Contributors: