---
title: "Authoring Node Modules"
description: "Best practices for creating and publishing npm packages. Practical notes and code examples on Authoring Node Modules by."
url: "https://h3manth.com/scribe/authoring-node-modules/"
canonical_url: "https://h3manth.com/scribe/authoring-node-modules/"
markdown_url: "https://h3manth.com/scribe/blog/authoring-node-modules.md"
publishDate: "2015-07-30T00:00:00.000Z"
author: "Hemanth HM"
category: "node"
tags: ["node","npm"]
word_count: 127
reading_time_minutes: 1
x_markdown_tokens: 323
content_signal: "ai-train=yes, search=yes, ai-input=yes"
---

# Authoring Node Modules

> Best practices for creating and publishing npm packages. Practical notes and code examples on Authoring Node Modules by.

With [200+ modules on npm](https://www.npmjs.com/~hemanth) getting 1.5M downloads per month, here are my learnings.

## Before Writing a Module

1. Search npm for existing solutions
2. If you find one, read its code and see if you can improve it
3. If it doesn't do exactly what you need, send a PR

## Writing a Neat Package

- Use [generator-node](https://github.com/yeoman/generator-node) or [generator-nm](https://github.com/sindresorhus/generator-nm)
- Make sure your `package.json` is valid
- Have `files` and `main` attributes in package.json
- Write test cases and integrate with Travis CI
- Use badges from [nodei.co](https://nodei.co/) and [david-dm](https://david-dm.org/)
- Make your `README.md` great with install instructions, API docs, and GIFs
- Use [release-it](https://www.npmjs.com/package/release-it) for releasing

## Getting to the Top

Find trending GitHub projects, extract reusable code into modules, and send PRs!
