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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@mostajs/sms-lite

v0.1.0

Published

Transport SMS minimal ZÉRO-DÉPENDANCE (drivers façon dialectes : console + passerelle HTTP via fetch). Pendant SMS de @mostajs/smtp-lite. S'enregistre comme canal de @mostajs/broadcast (smsBroadcastChannel).

Readme

@mostajs/sms-lite

Auteur : Dr Hamid MADANI [email protected] · Licence : AGPL-3.0-or-later

Transport SMS minimal zéro-dépendance : envoie un texto au numéro de téléphone mobile du destinataire. Pendant SMS de @mostajs/smtp-lite (email).

Qu'est-ce qu'un SMS ici ? Un message texte vers un numéro de mobile (réseau cellulaire). Ce module n'émet pas depuis une carte SIM : il appelle une passerelle SMS (API HTTP) — opérateur algérien (Mobilis/Djezzy/Ooredoo via agrégateur), Twilio, Vonage… Le driver consoleSms simule (dev) ; httpSms appelle la vraie passerelle. (Un driver modem GSM/AT ou WhatsApp peut être ajouté — façon dialectes.)

Drivers (façon dialectes)

| Driver | Usage | |---|---| | consoleSms() | dev / tests — journalise, n'envoie rien | | httpSms({ url, headers?, build?, parseId? }) | passerelle HTTP réelle (zéro-dép : fetch) |

Usage

import { createSmsTransport, httpSms, consoleSms, smsBroadcastChannel } from '@mostajs/sms-lite';

// Dev :
const sms = createSmsTransport({ driver: consoleSms() });
// Prod (ex. passerelle générique) :
// const sms = createSmsTransport({ driver: httpSms({ url: process.env.SMS_GATEWAY_URL, headers: { authorization: 'Bearer '+process.env.SMS_API_KEY } }) });

await sms.send({ to: '+213550000000', text: 'Votre RDV est confirmé.' });

// Branchement à @mostajs/broadcast (canal 'sms') :
import { registerChannel } from '@mostajs/broadcast';
registerChannel(smsBroadcastChannel(sms));   // puis sendVia('sms', { to, text })

Configuration des clés API SMS (.env)

Les identifiants de passerelle ne se codent jamais en dur — ils vivent dans le .env (lus par @mostajs/config ou process.env). smsFromEnv() choisit le driver selon les variables présentes :

# ── Option A — passerelle HTTP générique (ex. agrégateur DZ) ──
SMS_GATEWAY_URL=https://api.passerelle.example/send
SMS_API_KEY=VOTRE_CLE_API          # → en-tête Authorization: Bearer …
SMS_FROM=Salsabil                  # expéditeur (si supporté)

# ── Option B — Twilio (international, vers l'Algérie) ──
SMS_PROVIDER=twilio
TWILIO_ACCOUNT_SID=ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
TWILIO_AUTH_TOKEN=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
TWILIO_FROM=+1XXXXXXXXXX

# ── Aucune des deux → driver 'console' (dev, n'émet rien) ──
import { smsFromEnv } from '@mostajs/sms-lite';
const sms = smsFromEnv();                 // driver choisi d'après le .env
await sms.send({ to: '+213790373590', text: 'Convocation : RDV le 01/07.' });

Convention (comme SMTP) : en production, renseigner la clé directement dans le .env du serveur (jamais commitée), puis redémarrer le process. Le format exact du corps/headers d'un agrégateur DZ s'ajuste via httpSms({ build, headers, parseId }).

API

  • consoleSms() · httpSms({url,method?,headers?,build?,parseId?}) → driver { name, send({to,text,from?}) → {ok,id?,error?} }
  • createSmsTransport({ driver? }){ driver, send(msg) } (défaut : console)
  • smsBroadcastChannel(transport,{key?,label?}) → canal @mostajs/broadcast { key:'sms', label, send }

Tests

npm test (@mostajs/mjs-unit, 4 tests). Envoi réseau réel non testé en unitaire (passerelle externe).