Skip to content
Related Articles

Related Articles

How to Add Third Party Library Deno.js ?

View Discussion
Improve Article
Save Article
  • Last Updated : 18 Aug, 2020

Today we will learn how to add your own module to deno.js for usage by the users. As we know that there are standard modules added in any language or environment. Similarly in Deno.js a number of inbuilt/standard modules are available for a user.

Adding a new module to a language or an environment helps one in a number of ways- One learns how to contribute to open source and also to write the tested modules and scripts so that the users can use them in the best possible way.


  1. Familiar with JavaScript or TypeScript
  2. Install Deno.js on machine. (Confirm by typing deno -v in command line).
  3. Familiar with GitHub and how to pull, fork a Repository.

Code Structure: To get started with the code structure for adding a module to Deno.js one needs to follow a particular file structure.

git clone
cd ip_details

This is one of the module added by me. One needs to follow the same pattern for adding the module to DENO.

So lets see the code structure and understand what all you need to do.

  • MOD.ts – It is usually the entry point of any module. One needs to write the main function/code in this file. It is similar to index.js/app.js in Node.js.
  • CLI.ts – It is the file which would be executed when one uses the module from CLI. Here you can define what all arguments need to be passed while executing the script.
  • MOD_TEST.TS – It is the file which is used during development and used to test the module from CLI. In this standard Library, Deno is used to get the functions of testing in Deno.
  • README.MD – It is the file which gives the viewer/user all the information related to the module like how the module is to be used, what will be request and what will be the response and how to use the module in different situations like CLI, Importing from a module, bash etc. One need to add this image of testing all the cases for getting the module available from Deno website.
    Important – One needs to add all configuration/permissions in this file such as –allow-net, –allow-read, –allow-write.

Where is PACKAGE.JSON? As we know that while developing module using Node.js, we need to have a Package.json file in the code folder. But in case of using Deno, one don’t need to have such file and can directly use the modules from URL and store them in computer cache.

Now start Building your module and run and test it from CLI as well as using test command.

Now comes the Publishing part-

  1. Add your module to your Github and enable the actions from your repo.
  2. Make the repo public.
  3. Now go to DATABASE.JSON.
  4. Add your module details in the following format.
    "my_library_name": {
        "type": "github",
        "owner": "",
        "repo": ""
  5. Now create pull request to update the file.
  6. Write “Add `your_module_name` to Deno.
  7. Make Pull Request.
  8. Now your updated file need to pass some tests and you are good to go.
  9. Successfully created pull request. Wait for the approval.
My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!