Code Monkey home page Code Monkey logo

jiosaavn-api-ts's Introduction

๐ŸŽต Jio Saavn API

A simple wrapper for the Jio Saavn API powered by Hono.js ๐Ÿ”ฅ.

๐Ÿ“š Documentation (in progress)

โœจ 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

๐Ÿ› ๏ธ Building from source

  • Clone the repository
git clone https://github.com/rajput-hemant/jiosaavn-api-ts
cd jiosaavn-api-ts
  • Install dependencies
bun i || pnpm i || npm i || yarn

Bun

Warning You need to have Bun.js installed on your machine to run the project with bun.

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

Node.js

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

Vercel Dev Server

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

Cloudflare Workers

Warning Make sure to remove Node API code from src/index.ts & config.ts before deploying or running the project with 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

๐ŸŒ Deploying your own instance

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 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

Note We are using community based ๐Ÿฐ Bun runtime for โ–ฒ Vercel Serverless Functions by default, You can also use โ–ฒ Vercel Serverless Functions w/ Node Runtime or โ–ฒ Vercel Edge Functions to deploy the project. To use Node Runtime or Edge Functions rename the _api folder to api and remove 'buildCommand' from vercel.json file.

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
docker ps
docker stop <container-id>

๐Ÿ“œ License

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

๐Ÿฆพ Contributors:

jiosaavn-api-ts's People

Contributors

rajput-hemant avatar renovate[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

jiosaavn-api-ts's Issues

[Help Wanted] Incomplete Data Retrieval on Vercel Edge Functions

I'm encountering an issue with my API, it appears that the API does not retrieve complete data when using Vercel Edge functions. Even after configuring the region to Mumbai, India (South) - bom1.
To illustrate the problem, consider the following examples:

Vercel Edge function

  • /modules
    The mixes and city_mod fields are not populated.

  • /song/recommend
    The Edge version of the API does not provide recommendations for certain songs.

Serverless function on the community based Rust runtime

  • /modules
    Verify if the mixes and city_mod fields are populated.

  • /song/recommend
    Confirm that the serverless version of the API successfully provides recommendations for the same songs.

Due to these issues, I am considering migrating my function from Vercel Edge to a serverless architecture.
I've explored using Hono.js, offers a handler for Node.js serverless functions. However, I'm encountering difficulties in making it work.

Below is the code snippet I've attempted for transitioning from Edge to serverless:

import { handle } from "@hono/node-server/vercel";
import { app } from "../src";

export default handle(app);

Unfortunately, I'm encountering the following error on running vc dev:

Error: ERR_UNSUPPORTED_DIR_IMPORT /mnt/rajput-hemant/Projects/Typescript/jiosaavn-api-ts/src /mnt/rajput-hemant/Projects/Typescript/jiosaavn-api-ts/api/index.ts

Please let me know if any further information is needed to investigate and resolve this issue. Thank you!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.