npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

sendcode

v1.0.0

Published

Send the generated code to the given phone number with any SMS sending service

Downloads

6

Readme

Send verification code via sms

Send the generated code to the given phone number with any SMS sending service.

✨ This is the main task of this module. ✨

The code generated by faker module is 5 digits. Of course, you can change the number of these figures.

Features & Ability

  • Ability to change the number of digits of the sent code
  • Ability to test and document api with swagger
  • Ability to change SMS sending service
  • Ability to save given phone number and it's code in redis database

Features of generated code

  • If the code has been generated once, no more code will be generated.
  • The code will expire after 60 seconds.
  • If the user uses the code once, he cannot use it again.

Tech

This module uses a number of open source projects to work properly:

  • Node.js - evented I/O for the backend
  • Swagger - Simplifying API development
  • Redis - open source, in-memory data structure store, used as a database, cache, and message broker
  • Fastify - Fast and low overhead web framework, for Node.js
  • Faker - Generate massive amounts of fake (but realistic) data for testing and development.

✨ This project was bootstrapped with Fastify-CLI. ✨

Installation guide for the user

git clone https://github.com/tendal-lox/Send-verification-code-via-sms.git
cd sendCode

Note: You need to install fastify-cli for this module to work properly.

Installation guide for developers

npm install Send-verification-code-via-sms
npm run dev

To start the app in dev mode.
Open http://localhost:3000/docs/static/index.html to view it in the browser.

Note: SMS sending service is according to the country of Iran. So you have to adjust it according to your country. For this, you need to enter /routes/sendVerificationCode.js and change this part of the code:

// Kavenegar send api
const api = Kavenegar.KavenegarApi({apikey: 'api key from kavenegar'});
api.Send({ message: generateCode , sender: "xxx" , receptor: phoneNumber })

Bugs are being fixed

There is no any problem in the production code, but there is a problem in the test. Since there is no database in the test file, when you run npm test you will always encounter a database connection problem.

License

MIT