Checks domain availability and sends email notifications if a domain becomes available.
npm install @digelo/domain-checkerA Node.js/TypeScript tool to check domain availability and send email notifications when a domain becomes available.
1. Clone the repository and install dependencies:
``sh`
git clone https://github.com/yourusername/domain-checker.git
cd domain-checker
npm install
`
2. Copy and edit the environment file:
sh`
cp .env.example .env
# Edit .env with your domain and email/SMTP details
`
3. Run the checker:
sh`
npm run build
node dist/index.js
# or, for TypeScript directly:
npx ts-node index.ts
1. The script checks the availability of the domain specified in your .env file using the whois command.
2. If the domain is available, it sends an email notification to the address you configure.
3. All SMTP and notification settings are managed via environment variables for security and flexibility.
command
- Sends email notifications via SMTP (Gmail and others supported)
- Configurable via .env file
- Fully tested with Jest
- TypeScript supportSetup
$3
`sh
git clone https://github.com/yourusername/domain-checker.git
cd domain-checker
npm install
`$3
Copy .env.example to .env and fill in your details:
`sh
cp .env.example .env
`
Edit .env:
`
DOMAIN=yourdomain.com
EMAIL_TO=your@email.com
SMTP_HOST=smtp.gmail.com
SMTP_PORT=465
SMTP_USER=your@gmail.com
SMTP_PASS=your_app_password
`
> For Gmail, use an App Password (see: https://support.google.com/accounts/answer/185833)$3
`sh
npm run build # Compile TypeScript
node dist/index.js
`
Or directly with ts-node:
`sh
npx ts-node index.ts
`Testing
Run all tests with coverage:
`sh
npm test
`Linting
Lint and auto-fix code:
`sh
npx eslint --fix *.ts
`Project Structure
- index.ts - Main checker logic
- index.test.ts - Jest tests
- .env.example - Example environment config
- env-loader.js - Loads .env at runtime
- package.json - Project config
- tsconfig.json - TypeScript config
- jest.config.js` - Jest config