Mazzarolo Matteo
Mazzarolo Matteo

NumValidate: open source phone number validation REST API

By Mazzarolo Matteo

I recently published NumValidate, a fully-featured open-source phone number validation REST API service.

NumValidate website screenshot
NumValidate website screenshot

NumValidate might not be a big project, but from my point of view it can be used as an example of how you can build a “complete” application from the ground up using modern Javascript.

In this post I’ll try to highlight some features of NumValidate and to share what I learned while working on it.
The complete repository is available on GitHub.

Here is a small overview of NumValidate:

  • Plain simple phone number validation rest API, powered by Google LibPhoneNumber and documented with Slate
  • Server-side rendered responsive React website/landing-page (~160kb GZipped) using NextJS
  • Private API tokens generation and management for authenticated users through the Dashboard
  • Fully featured authentication for accessing the Dashboard: email + password, Github and Google login thanks to Auth0
  • API requests with different rate limits for unauthenticated user, free user and pro user, updated in real-time after a subscription change
  • Rate limits can be increased by subscribing to a paid account: The secure payment is handled by Stripe and its settings can be changed at any given time
  • API tokens cached with Redis for faster response time on consecutive requests
  • Production-ready logging and error reporting using Winston, Sentry and Papertrail

That’s it!
If you’re interested in the setup of the project and in the more technical details you should also take a look at the README on GitHub.

P.S.: As you may already have noticed by the small size of the validation-related code, I didn’t even start working on NumValidate with the aim of validating phone numbers: I was more interested in a way to distribute an API using api-tokens and paid subscriptions, which has indeed been the most fun part of the project.